address

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreetKey           = "street"
	CityKey             = "city"
	StateKey            = "state"
	PostalCodeKey       = "postal_code"
	CountryKey          = "country"
	LatitudeKey         = "latitude"
	LongitudeKey        = "longitude"
	PlaceIDKey          = "place_id"
	FormattedAddressKey = "formatted_address"
	PlaceNameKey        = "place_name"
)
View Source
const (
	TimezoneKey = "timezone"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Meta `bson:",inline"`
	Comp `bson:",inline"`
	// FormattedAddress is the full address from Google.
	// example:1600 Amphitheatre Parkway, Mountain View, CA 94043, USA
	// required:false
	FormattedAddress *string `json:"formatted_address" bson:"formatted_address" validate:"nonnilpointer"`
	// PlaceName is the location’s name, often a landmark.
	// example:Central Park
	// required:false
	PlaceName *string `json:"place_name" bson:"place_name" validate:"nonnilpointer"`
	// Street is the address’s street number and name.
	// example:1600 Amphitheatre Parkway
	// required:false
	Street *string `json:"street" bson:"street" validate:"nonnilpointer"`
	// City is the address’s city or locality.
	// example:Mountain View
	// required:false
	City *string `json:"city" bson:"city" validate:"nonnilpointer"`
	// State is the address’s state, province, or region.
	// example:CA
	// required:false
	State *string `json:"state" bson:"state" validate:"nonnilpointer"`
	// PostalCode is the address’s postal code.
	// example:94043
	// required:false
	PostalCode *string `json:"postal_code" bson:"postal_code" validate:"nonnilpointer"`
	// Country is the address’s country.
	// example:USA
	// required:false
	Country *string `json:"country" bson:"country" validate:"nonnilpointer"`
	// Latitude is the location’s latitude, if available.
	// example:37.4224764
	// required:false
	// format:double
	Latitude *float64 `json:"latitude" bson:"latitude" validate:"nonnilpointer"`
	// Longitude is the location’s longitude, if available.
	// example:-122.0842499
	// required:false
	// format:double
	Longitude *float64 `json:"longitude" bson:"longitude" validate:"nonnilpointer"`
	// PlaceID is the Google Place ID for the location.
	// example:ChIJ2eUgeAK6j4ARbn5u_wAGqWA
	// required:false
	PlaceID *string `json:"place_id" bson:"place_id" validate:"nonnilpointer"`
}

Address defines a location from Google’s place picker. swagger:model

func NewAddress

func NewAddress(
	m Meta,
	c Comp,
	formattedAddress,
	placeName,
	street,
	city,
	state,
	postalCode,
	country,
	placeID string,
	latitude,
	longitude float64,
) (*Address, error)

func (*Address) GetCity

func (a *Address) GetCity() string

func (*Address) GetCountry

func (a *Address) GetCountry() string

func (*Address) GetFormattedAddress

func (a *Address) GetFormattedAddress() string

func (*Address) GetLatitude

func (a *Address) GetLatitude() float64

func (*Address) GetLongitude

func (a *Address) GetLongitude() float64

func (*Address) GetPlaceID

func (a *Address) GetPlaceID() string

func (*Address) GetPlaceName

func (a *Address) GetPlaceName() string

func (*Address) GetPostalCode

func (a *Address) GetPostalCode() string

func (*Address) GetState

func (a *Address) GetState() string

func (*Address) GetStreet

func (a *Address) GetStreet() string

func (*Address) SetCity

func (a *Address) SetCity(x string)

func (*Address) SetCountry

func (a *Address) SetCountry(x string)

func (*Address) SetFormattedAddress

func (a *Address) SetFormattedAddress(x string)

func (*Address) SetLatitude

func (a *Address) SetLatitude(x float64)

func (*Address) SetLongitude

func (a *Address) SetLongitude(x float64)

func (*Address) SetPlaceID

func (a *Address) SetPlaceID(x string)

func (*Address) SetPlaceName

func (a *Address) SetPlaceName(x string)

func (*Address) SetPostalCode

func (a *Address) SetPostalCode(x string)

func (*Address) SetState

func (a *Address) SetState(x string)

func (*Address) SetStreet

func (a *Address) SetStreet(x string)

type Comp

type Comp struct {
	// Timezone is the address’s timezone.
	// example:America/Los_Angeles
	// readOnly:true
	Timezone *string `json:"timezone" bson:"timezone" validate:"nonnilpointer"`
}

func ApplyComp

func ApplyComp(c *Comp, modifiers ...CompOption) Comp

func (*Comp) GetTimezone

func (a *Comp) GetTimezone() string

func (*Comp) SetTimezone

func (a *Comp) SetTimezone(x string)

type CompOption

type CompOption = contract.CompOption[Comp]

func WithProcessedTimezone

func WithProcessedTimezone(ctx context.Context, latitude, longitude float64, client contract.Geocoder) (CompOption, error)

func WithTimezone

func WithTimezone(tz string) CompOption

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