Documentation ¶
Index ¶
- Constants
- func A2gCsvFullPath() string
- func E164Format(numberToParse, defaultRegion string, ...) (string, error)
- func LetterToNumberMap() map[string]int
- func LocalNumberUS(ac uint16, ln uint16) uint64
- func MustE164Format(numberToParse, defaultRegion string, ...) string
- func NewPointString(lat string, lon string) (*geo.Point, error)
- func StringToNumbers(s string) string
- type AreaCodeIncrementor
- type AreaCodeInfo
- type AreaCodeToGeo
- func (a2g *AreaCodeToGeo) AreaCodeSlice() []AreaCodeInfo
- func (a2g *AreaCodeToGeo) AreaCodes() []uint16
- func (a2g *AreaCodeToGeo) AreaCodesSorted() []uint16
- func (a2g *AreaCodeToGeo) GcdAreaCodes(ac1Int uint16, ac2Int uint16) (float64, error)
- func (a2g *AreaCodeToGeo) GetDistanceMatrix() map[uint16]map[uint16]float64
- func (a2g *AreaCodeToGeo) Inflate()
- func (a2g *AreaCodeToGeo) ReadCsvPath(csvpath string) error
- func (a2g *AreaCodeToGeo) ReadData() error
- type FakeNumberGenerator
- func (fng *FakeNumberGenerator) LocalNumberUS(ac uint16, ln uint16) uint64
- func (fng *FakeNumberGenerator) RandomAreaCode() uint16
- func (fng *FakeNumberGenerator) RandomLineNumber() uint16
- func (fng *FakeNumberGenerator) RandomLineNumberMinMax(min, max uint16) uint16
- func (fng *FakeNumberGenerator) RandomLocalNumberUS() uint64
- func (fng *FakeNumberGenerator) RandomLocalNumberUSAreaCodes(acs []uint16) uint64
- func (fng *FakeNumberGenerator) RandomLocalNumberUSUnique(set map[uint64]int8) (uint64, map[uint64]int8)
- func (fng *FakeNumberGenerator) RandomLocalNumberUSUniqueAreaCodeSet(set map[uint64]int8, acs []uint16) (uint64, map[uint64]int8)
Constants ¶
const (
A2gCsvRelPath = "github.com/grokify/mogo/strconv/phonenumber/us-area-code-geo.csv"
)
Variables ¶
This section is empty.
Functions ¶
func A2gCsvFullPath ¶
func A2gCsvFullPath() string
A2gCsvFullPath reads data from: https://github.com/ravisorg/Area-Code-Geolocation-Database
func E164Format ¶
func E164Format(numberToParse, defaultRegion string, numberFormat phonenumbers.PhoneNumberFormat) (string, error)
func LetterToNumberMap ¶
func LocalNumberUS ¶
LocalNumberUS returns a US E.164 number given an areacode and line number
func MustE164Format ¶
func MustE164Format(numberToParse, defaultRegion string, numberFormat phonenumbers.PhoneNumberFormat) string
func NewPointString ¶
NewPointString returns a *geo.Point based on string lat and lon values.
func StringToNumbers ¶
Types ¶
type AreaCodeIncrementor ¶
func NewAreaCodeIncrementor ¶
func NewAreaCodeIncrementor(base uint16) AreaCodeIncrementor
func (*AreaCodeIncrementor) GetNext ¶
func (aci *AreaCodeIncrementor) GetNext(ac uint16) uint64
type AreaCodeInfo ¶
func NewAreaCodeInfoStrings ¶
func NewAreaCodeInfoStrings(ac, lat, lon string) (AreaCodeInfo, error)
NewAreaCodeInfoStrings returns an AreaCodeInfo based on string area code, lat and lon values.
type AreaCodeToGeo ¶
type AreaCodeToGeo struct { AreaCodeInfos map[uint16]AreaCodeInfo DistanceMatrix map[uint16]map[uint16]float64 }
func NewAreaCodeToGeo ¶
func NewAreaCodeToGeo() AreaCodeToGeo
func (*AreaCodeToGeo) AreaCodeSlice ¶
func (a2g *AreaCodeToGeo) AreaCodeSlice() []AreaCodeInfo
func (*AreaCodeToGeo) AreaCodes ¶
func (a2g *AreaCodeToGeo) AreaCodes() []uint16
func (*AreaCodeToGeo) AreaCodesSorted ¶
func (a2g *AreaCodeToGeo) AreaCodesSorted() []uint16
func (*AreaCodeToGeo) GcdAreaCodes ¶
func (a2g *AreaCodeToGeo) GcdAreaCodes(ac1Int uint16, ac2Int uint16) (float64, error)
func (*AreaCodeToGeo) GetDistanceMatrix ¶
func (a2g *AreaCodeToGeo) GetDistanceMatrix() map[uint16]map[uint16]float64
func (*AreaCodeToGeo) Inflate ¶
func (a2g *AreaCodeToGeo) Inflate()
func (*AreaCodeToGeo) ReadCsvPath ¶
func (a2g *AreaCodeToGeo) ReadCsvPath(csvpath string) error
func (*AreaCodeToGeo) ReadData ¶
func (a2g *AreaCodeToGeo) ReadData() error
type FakeNumberGenerator ¶
func NewFakeNumberGenerator ¶
func NewFakeNumberGenerator(areacodes []uint16) FakeNumberGenerator
func (*FakeNumberGenerator) LocalNumberUS ¶
func (fng *FakeNumberGenerator) LocalNumberUS(ac uint16, ln uint16) uint64
LocalNumberUS returns a US E.164 number given an areacode and line number
func (*FakeNumberGenerator) RandomAreaCode ¶
func (fng *FakeNumberGenerator) RandomAreaCode() uint16
RandomAreaCode generates a random area code.
func (*FakeNumberGenerator) RandomLineNumber ¶
func (fng *FakeNumberGenerator) RandomLineNumber() uint16
RandomLineNumber generates a random line number
func (*FakeNumberGenerator) RandomLineNumberMinMax ¶
func (fng *FakeNumberGenerator) RandomLineNumberMinMax(min, max uint16) uint16
RandomLineNumber generates a random line number
func (*FakeNumberGenerator) RandomLocalNumberUS ¶
func (fng *FakeNumberGenerator) RandomLocalNumberUS() uint64
RandomLocalNumberUS returns a US E.164 number AreaCode + Prefix + Line Number
func (*FakeNumberGenerator) RandomLocalNumberUSAreaCodes ¶
func (fng *FakeNumberGenerator) RandomLocalNumberUSAreaCodes(acs []uint16) uint64
RandomLocalNumberUS returns a US E.164 number AreaCode + Prefix + Line Number
func (*FakeNumberGenerator) RandomLocalNumberUSUnique ¶
func (fng *FakeNumberGenerator) RandomLocalNumberUSUnique(set map[uint64]int8) (uint64, map[uint64]int8)
RandomLocalNumberUSUnique returns a US E.164 number AreaCode + Prefix + Line Number
func (*FakeNumberGenerator) RandomLocalNumberUSUniqueAreaCodeSet ¶
func (fng *FakeNumberGenerator) RandomLocalNumberUSUniqueAreaCodeSet(set map[uint64]int8, acs []uint16) (uint64, map[uint64]int8)
RandomLocalNumberUSUnique returns a US E.164 number AreaCode + Prefix + Line Number