Documentation ¶
Overview ¶
Package numkey is a Go wrapper for the numkey C software library. 64 bit Encoding for Short Codes and E.164 LVN.
@category Libraries @author Nicola Asuni @license see LICENSE file @link https://github.com/Vonage/numkey
Index ¶
- func CompareNumKeyCountry(nka, nkb uint64) int
- func CountryKey(country string) uint16
- func DecodeCountryKey(ck uint16) string
- func Hex(v uint64) string
- func NumKey(country, number string) uint64
- func ParseHex(s string) uint64
- func PrefixKey(number string) uint64
- func StringToNTBytesN(s string, size int) []byte
- type TNumKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareNumKeyCountry ¶
CompareNumKeyCountry compares two NumKeys by country only.
func CountryKey ¶
CountryKey encodes ISO 3166 alpha-2 country code into uint16.
func DecodeCountryKey ¶
DecodeCountryKey decodes countrykey into ISO 3166 alpha-2 country code.
func NumKey ¶
NumKey returns an encoded COUNTRY + NUMBER If the country or number are invalid this function returns 0
func PrefixKey ¶
PrefixKey encodes a number string into uint64. The encoded number is always 15 digits long as it is either right-padded with zeros or truncated. The prefixkey is safe to cast as int64 as it is always smaller than max int64.
func StringToNTBytesN ¶
StringToNTBytesN convert a string to byte array allocating "size" bytes.