countries

package
v0.0.0-...-0941746 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown     = "Unknown"
	CodeUnknown = "XX"
)

Variables

View Source
var Bytes []byte
View Source
var (
	ErrCountryNotFound = errors.New("Country not found")
)

Functions

func GetMap

func GetMap() map[string]Country

func Init

func Init() (err error)

func Name

func Name(countryCode string) (countryName string, err error)

Types

type Country

type Country struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

func GetList

func GetList() []Country

type CountryInt32

type CountryInt32 string

CountryInt32 is a tpye that store a 2-letters country code as an int32. The goal is to have more efficient database operations than using the a basic TEXT

func (*CountryInt32) Scan

func (country *CountryInt32) Scan(src interface{}) (err error)

Scan implements sql.Scanner so CountryInt32 can be read from databases transparently.

func (CountryInt32) Value

func (country CountryInt32) Value() (driver.Value, error)

Value implements sql.Valuer so that CountryInt32 can be written to databases

Jump to

Keyboard shortcuts

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