address

package
v0.0.366 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreetKey           = "street"
	CityKey             = "city"
	StateKey            = "state"
	PostalCodeKey       = "postal_code"
	CountryKey          = "country"
	PlaceIDKey          = "place_id"
	FormattedAddressKey = "formatted_address"
	PlaceNameKey        = "place_name"
)
View Source
const (
	AddressTimezoneKey = "address_timezone"
)

Variables

View Source
var (
	StreetKeyFn           = contract.PathKeyFn(StreetKey)
	CityKeyFn             = contract.PathKeyFn(CityKey)
	StateKeyFn            = contract.PathKeyFn(StateKey)
	PostalCodeKeyFn       = contract.PathKeyFn(PostalCodeKey)
	CountryKeyFn          = contract.PathKeyFn(CountryKey)
	PlaceIDKeyFn          = contract.PathKeyFn(PlaceIDKey)
	FormattedAddressKeyFn = contract.PathKeyFn(FormattedAddressKey)
	PlaceNameKeyFn        = contract.PathKeyFn(PlaceNameKey)
)
View Source
var AddressTimezoneKeyFn = contract.PathKeyFn(AddressTimezoneKey)

Functions

func Idx

func Idx(p ...string) []contract.IndexEntry

func IdxSrch

func IdxSrch(p ...string) []contract.SearchIndexEntry

func Rules

Types

type Address

type Address struct {
	Meta `bson:",inline" validate:"recurse"`
	Comp `bson:",inline" validate:"recurse"`
	Core `bson:",inline" validate:"recurse"`
}

Address defines a location from Google’s place picker.

func Mock added in v0.0.42

func Mock() *Address

func New

func New(m Meta, cr Core) *Address

func (*Address) Compute

func (r *Address) Compute(ctx context.Context, op contract.Geocoder) error

type Comp

type Comp struct {
	AddressTimezone *string `json:"address_timezone" validate:"nnpt,nz,tz"`
}

func (*Comp) GetAddressTimezone added in v0.0.73

func (c *Comp) GetAddressTimezone() string

func (*Comp) SetAddressTimezone added in v0.0.73

func (c *Comp) SetAddressTimezone(x string)

type Core

type Core struct {
	latlon.LatLon    `bson:",inline" validate:"recurse"`
	contract.Address `bson:",inline" validate:"recurse"`
	FormattedAddress *string `json:"formatted_address" validate:"nnpt"`
	PlaceName        *string `json:"place_name" validate:"nnpt"`
	PlaceID          *string `json:"place_id" validate:"nnpt"`
}

func ApplyCore

func ApplyCore(c *Core, modifiers ...CoreOption) Core

func (*Core) GetFormattedAddress

func (c *Core) GetFormattedAddress() string

func (*Core) GetPlaceID

func (c *Core) GetPlaceID() string

func (*Core) GetPlaceName

func (c *Core) GetPlaceName() string

func (*Core) SetFormattedAddress

func (c *Core) SetFormattedAddress(x string)

func (*Core) SetPlaceID

func (c *Core) SetPlaceID(x string)

func (*Core) SetPlaceName

func (c *Core) SetPlaceName(x string)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithAddress added in v0.0.351

func WithAddress(x contract.Address) CoreOption

func WithFormattedAddress

func WithFormattedAddress(x string) CoreOption

func WithLatLon added in v0.0.181

func WithLatLon(x latlon.LatLon) CoreOption

func WithPlaceID

func WithPlaceID(x string) CoreOption

func WithPlaceName

func WithPlaceName(x string) CoreOption

type Meta

type Meta struct{}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL