gotsrpc/demo/complex.go
2016-05-26 23:42:20 +02:00

38 lines
841 B
Go

package demo
import nstd "github.com/foomo/gotsrpc/demo/nested"
type Address struct {
City string `json:"city,omitempty"`
SecretServerCrap bool `json:"-"`
PeoplePtr []*Person
ArrayOfMaps []map[string]bool
ArrayArrayAddress [][]*Address
People []Person
MapCrap map[string]map[int]bool
NestedPtr *nstd.Nested
NestedStruct nstd.Nested
}
type Person struct {
Name string
AddressPtr *Address `json:"address"`
AddressStruct Address
Addresses map[string]*Address
InlinePtr *struct {
Foo bool
}
InlineStruct struct {
Bar string
}
iAmPrivate string
}
func (s *Service) ExtractAddress(person *Person) (*Address, *Err) {
if person.AddressPtr != nil {
return person.AddressPtr, nil
}
return nil, &Err{"there is no address on that person"}
}