location

package
v0.0.0-...-01cd907 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	ID          int64          `json:"id"`
	Name        string         `json:"name"`
	StateID     int64          `json:"state_id"`
	StateCode   string         `json:"state_code"`
	CountryID   int64          `json:"country_id"`
	CountryCode string         `json:"country_code"`
	Latitude    float64        `json:"latitude"`
	Longitude   float64        `json:"longitude"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	Flag        int64          `json:"flag"`
	WikiDataId  sql.NullString `json:"wikiDataId"`
}

type Country

type Country struct {
	ID             int64           `json:"id"`
	Name           string          `json:"name"`
	Iso3           sql.NullString  `json:"iso3"`
	NumericCode    sql.NullString  `json:"numeric_code"`
	Iso2           sql.NullString  `json:"iso2"`
	Phonecode      sql.NullString  `json:"phonecode"`
	Capital        sql.NullString  `json:"capital"`
	Currency       sql.NullString  `json:"currency"`
	CurrencyName   sql.NullString  `json:"currency_name"`
	CurrencySymbol sql.NullString  `json:"currency_symbol"`
	Tld            sql.NullString  `json:"tld"`
	Native         sql.NullString  `json:"native"`
	Region         sql.NullString  `json:"region"`
	RegionID       sql.NullInt64   `json:"region_id"`
	Subregion      sql.NullString  `json:"subregion"`
	SubregionID    sql.NullInt64   `json:"subregion_id"`
	Nationality    sql.NullString  `json:"nationality"`
	Timezones      sql.NullString  `json:"timezones"`
	Translations   sql.NullString  `json:"translations"`
	Latitude       sql.NullFloat64 `json:"latitude"`
	Longitude      sql.NullFloat64 `json:"longitude"`
	Emoji          sql.NullString  `json:"emoji"`
	EmojiU         sql.NullString  `json:"emojiU"`
	CreatedAt      sql.NullTime    `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	Flag           int64           `json:"flag"`
	WikiDataId     sql.NullString  `json:"wikiDataId"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetCityLatLongParams

type GetCityLatLongParams struct {
	Name        string `json:"name"`
	StateCode   string `json:"state_code"`
	CountryCode string `json:"country_code"`
}

type GetCityLatLongRow

type GetCityLatLongRow struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type GetStateCodeParams

type GetStateCodeParams struct {
	Name        string `json:"name"`
	CountryCode string `json:"country_code"`
}

type LatLong

type LatLong struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

LatLong represents latitude and longitude coordinates

type LocationService

type LocationService struct {
	// contains filtered or unexported fields
}

LocationService provides location lookup functionality

func NewLocationService

func NewLocationService() (*LocationService, error)

NewLocationService creates a new location service with embedded databases

func (*LocationService) Close

func (ls *LocationService) Close() error

Close closes all database connections and cleans up temporary files

func (*LocationService) GetLatLong

func (ls *LocationService) GetLatLong(ctx context.Context, city, state, country string) (*LatLong, error)

GetLatLong retrieves latitude and longitude for a given city, state, and country

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) GetCityLatLong

func (q *Queries) GetCityLatLong(ctx context.Context, arg GetCityLatLongParams) (GetCityLatLongRow, error)

func (*Queries) GetCountryCode

func (q *Queries) GetCountryCode(ctx context.Context, name string) (sql.NullString, error)

func (*Queries) GetStateCode

func (q *Queries) GetStateCode(ctx context.Context, arg GetStateCodeParams) (sql.NullString, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Region

type Region struct {
	ID           int64          `json:"id"`
	Name         string         `json:"name"`
	Translations sql.NullString `json:"translations"`
	CreatedAt    sql.NullTime   `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	Flag         int64          `json:"flag"`
	WikiDataId   sql.NullString `json:"wikiDataId"`
}

type State

type State struct {
	ID          int64           `json:"id"`
	Name        string          `json:"name"`
	CountryID   int64           `json:"country_id"`
	CountryCode string          `json:"country_code"`
	FipsCode    sql.NullString  `json:"fips_code"`
	Iso2        sql.NullString  `json:"iso2"`
	Type        sql.NullString  `json:"type"`
	Level       sql.NullInt64   `json:"level"`
	ParentID    sql.NullInt64   `json:"parent_id"`
	Native      sql.NullString  `json:"native"`
	Latitude    sql.NullFloat64 `json:"latitude"`
	Longitude   sql.NullFloat64 `json:"longitude"`
	CreatedAt   sql.NullTime    `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
	Flag        int64           `json:"flag"`
	WikiDataId  sql.NullString  `json:"wikiDataId"`
}

Jump to

Keyboard shortcuts

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