mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
38 lines
841 B
Go
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"}
|
|
}
|