Documentation
¶
Overview ¶
Package metadata holds the phone-number metadata value types (a port of upstream's Phonemetadata) together with the hand-written helpers on them. It is the acyclic home for these types now that the metadata loader depends on them; the root phonenumbers package re-exports them as aliases.
Port of java/libphonenumber/src/com/google/i18n/phonenumbers/metadata/source/* + .../MetadataLoader.java.
Index ¶
- Constants
- Variables
- func CountryCodeToRegion() map[int][]string
- func CountryCodesForNonGeographicalRegion() map[int]bool
- func IsNANPARegion(region string) bool
- func SupportedCallingCodes() map[int]bool
- func SupportedRegions() map[string]bool
- func Use(c *Container) (restore func())
- type Container
- type NumberFormat
- func (*NumberFormat) Descriptor() ([]byte, []int)deprecated
- func (x *NumberFormat) GetDomesticCarrierCodeFormattingRule() string
- func (x *NumberFormat) GetFormat() string
- func (x *NumberFormat) GetLeadingDigitsPattern() []string
- func (x *NumberFormat) GetNationalPrefixFormattingRule() string
- func (x *NumberFormat) GetNationalPrefixOptionalWhenFormatting() bool
- func (x *NumberFormat) GetPattern() string
- func (nf *NumberFormat) Merge(other *NumberFormat)
- func (*NumberFormat) ProtoMessage()
- func (x *NumberFormat) ProtoReflect() protoreflect.Message
- func (x *NumberFormat) Reset()
- func (x *NumberFormat) String() string
- type PhoneMetadata
- func (*PhoneMetadata) Descriptor() ([]byte, []int)deprecated
- func (x *PhoneMetadata) GetCarrierSpecific() *PhoneNumberDesc
- func (x *PhoneMetadata) GetCountryCode() int32
- func (x *PhoneMetadata) GetEmergency() *PhoneNumberDesc
- func (x *PhoneMetadata) GetFixedLine() *PhoneNumberDesc
- func (x *PhoneMetadata) GetGeneralDesc() *PhoneNumberDesc
- func (x *PhoneMetadata) GetId() string
- func (x *PhoneMetadata) GetInternationalPrefix() string
- func (x *PhoneMetadata) GetIntlNumberFormat() []*NumberFormat
- func (x *PhoneMetadata) GetLeadingDigits() string
- func (x *PhoneMetadata) GetLeadingZeroPossible() bool
- func (x *PhoneMetadata) GetMainCountryForCode() bool
- func (x *PhoneMetadata) GetMobile() *PhoneNumberDesc
- func (x *PhoneMetadata) GetMobileNumberPortableRegion() bool
- func (x *PhoneMetadata) GetNationalPrefix() string
- func (x *PhoneMetadata) GetNationalPrefixForParsing() string
- func (x *PhoneMetadata) GetNationalPrefixTransformRule() string
- func (x *PhoneMetadata) GetNoInternationalDialling() *PhoneNumberDesc
- func (x *PhoneMetadata) GetNumberFormat() []*NumberFormat
- func (x *PhoneMetadata) GetPager() *PhoneNumberDesc
- func (x *PhoneMetadata) GetPersonalNumber() *PhoneNumberDesc
- func (x *PhoneMetadata) GetPreferredExtnPrefix() string
- func (x *PhoneMetadata) GetPreferredInternationalPrefix() string
- func (x *PhoneMetadata) GetPremiumRate() *PhoneNumberDesc
- func (x *PhoneMetadata) GetSameMobileAndFixedLinePattern() bool
- func (x *PhoneMetadata) GetSharedCost() *PhoneNumberDesc
- func (x *PhoneMetadata) GetShortCode() *PhoneNumberDesc
- func (x *PhoneMetadata) GetSmsServices() *PhoneNumberDesc
- func (x *PhoneMetadata) GetStandardRate() *PhoneNumberDesc
- func (x *PhoneMetadata) GetTollFree() *PhoneNumberDesc
- func (x *PhoneMetadata) GetUan() *PhoneNumberDesc
- func (x *PhoneMetadata) GetVoicemail() *PhoneNumberDesc
- func (x *PhoneMetadata) GetVoip() *PhoneNumberDesc
- func (*PhoneMetadata) ProtoMessage()
- func (x *PhoneMetadata) ProtoReflect() protoreflect.Message
- func (x *PhoneMetadata) Reset()
- func (x *PhoneMetadata) String() string
- type PhoneMetadataCollection
- func (*PhoneMetadataCollection) Descriptor() ([]byte, []int)deprecated
- func (x *PhoneMetadataCollection) GetMetadata() []*PhoneMetadata
- func (*PhoneMetadataCollection) ProtoMessage()
- func (x *PhoneMetadataCollection) ProtoReflect() protoreflect.Message
- func (x *PhoneMetadataCollection) Reset()
- func (x *PhoneMetadataCollection) String() string
- type PhoneNumberDesc
- func (*PhoneNumberDesc) Descriptor() ([]byte, []int)deprecated
- func (x *PhoneNumberDesc) GetExampleNumber() string
- func (x *PhoneNumberDesc) GetNationalNumberPattern() string
- func (x *PhoneNumberDesc) GetPossibleLength() []int32
- func (x *PhoneNumberDesc) GetPossibleLengthLocalOnly() []int32
- func (pd *PhoneNumberDesc) HasPossibleLength(length int32) bool
- func (pd *PhoneNumberDesc) HasPossibleLengthLocalOnly(length int32) bool
- func (*PhoneNumberDesc) ProtoMessage()
- func (x *PhoneNumberDesc) ProtoReflect() protoreflect.Message
- func (x *PhoneNumberDesc) Reset()
- func (x *PhoneNumberDesc) String() string
Constants ¶
const ( Default_PhoneMetadata_SameMobileAndFixedLinePattern = bool(false) Default_PhoneMetadata_MainCountryForCode = bool(false) Default_PhoneMetadata_LeadingZeroPossible = bool(false) Default_PhoneMetadata_MobileNumberPortableRegion = bool(false) )
Default values for PhoneMetadata fields.
const (
Default_NumberFormat_NationalPrefixOptionalWhenFormatting = bool(false)
)
Default values for NumberFormat fields.
const Version = "v9.0.35"
Version is the upstream libphonenumber release tag that the embedded metadata was built from.
Variables ¶
var ErrEmptyMetadata = errors.New("empty metadata")
ErrEmptyMetadata is returned when a metadata collection contains no metadata.
var File_phonemetadata_proto protoreflect.FileDescriptor
Functions ¶
func CountryCodeToRegion ¶
CountryCodeToRegion returns the map from country calling code to its region codes.
func CountryCodesForNonGeographicalRegion ¶
CountryCodesForNonGeographicalRegion returns the set of calling codes that map to the non-geo entity region ("001").
func IsNANPARegion ¶
IsNANPARegion reports whether region shares country calling code 1.
func SupportedCallingCodes ¶
SupportedCallingCodes returns the set of calling codes the library supports.
func SupportedRegions ¶
SupportedRegions returns the set of regions the library supports.
func Use ¶
func Use(c *Container) (restore func())
Use swaps the active metadata container, returning a function that restores the previously active container. It is intended for tests that need to run against alternate (e.g. synthetic) metadata; callers must invoke the returned restore function (typically via t.Cleanup) and must not run such tests in parallel, since the active container is process-global.
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container bundles all of the metadata-derived lookup state used by the library. The package keeps a single active container (current), built from the embedded metadata during init. Bundling the state behind one swappable value is the seam that lets tests run against alternate metadata (e.g. upstream's synthetic PhoneNumberMetadataForTesting data) without changing the public, package-level API.
func Load ¶
Load reads the embedded metadata and builds a fresh container from it without changing the active container. It follows the same path used at package init.
func NewContainer ¶
func NewContainer(coll *PhoneMetadataCollection, countryCodeToRegion map[int][]string) (*Container, error)
NewContainer builds a fully populated Container from a parsed metadata collection and a country-code-to-region map. This is the same derivation the library has always performed at init, factored out so it can run against any metadata source, not just the embedded one.
type NumberFormat ¶
type NumberFormat struct {
// pattern is a regex that is used to match the national (significant)
// number. For example, the pattern "(20)(\d{4})(\d{4})" will match number
// "2070313000", which is the national (significant) number for Google London.
// Note the presence of the parentheses, which are capturing groups what
// specifies the grouping of numbers.
Pattern *string `protobuf:"bytes,1,req,name=pattern" json:"pattern,omitempty"`
// format specifies how the national (significant) number matched by
// pattern should be formatted.
// Using the same example as above, format could contain "$1 $2 $3",
// meaning that the number should be formatted as "20 7031 3000".
// Each $x are replaced by the numbers captured by group x in the
// regex specified by pattern.
Format *string `protobuf:"bytes,2,req,name=format" json:"format,omitempty"`
// This field is a regex that is used to match a certain number of digits
// at the beginning of the national (significant) number. When the match is
// successful, the accompanying pattern and format should be used to format
// this number. For example, if leading_digits="[1-3]|44", then all the
// national numbers starting with 1, 2, 3 or 44 should be formatted using the
// accompanying pattern and format.
//
// The first leadingDigitsPattern matches up to the first three digits of the
// national (significant) number; the next one matches the first four digits,
// then the first five and so on, until the leadingDigitsPattern can uniquely
// identify one pattern and format to be used to format the number.
//
// In the case when only one formatting pattern exists, no
// leading_digits_pattern is needed.
LeadingDigitsPattern []string `protobuf:"bytes,3,rep,name=leading_digits_pattern,json=leadingDigitsPattern" json:"leading_digits_pattern,omitempty"`
// This field specifies how the national prefix ($NP) together with the first
// group ($FG) in the national significant number should be formatted in
// the NATIONAL format when a national prefix exists for a certain country.
// For example, when this field contains "($NP$FG)", a number from Beijing,
// China (whose $NP = 0), which would by default be formatted without
// national prefix as 10 1234 5678 in NATIONAL format, will instead be
// formatted as (010) 1234 5678; to format it as (0)10 1234 5678, the field
// would contain "($NP)$FG". Note $FG should always be present in this field,
// but $NP can be omitted. For example, having "$FG" could indicate the
// number should be formatted in NATIONAL format without the national prefix.
// This is commonly used to override the rule specified for the territory in
// the XML file.
//
// When this field is missing, a number will be formatted without national
// prefix in NATIONAL format. This field does not affect how a number
// is formatted in other formats, such as INTERNATIONAL.
NationalPrefixFormattingRule *string `` /* 142-byte string literal not displayed */
// This field specifies whether the $NP can be omitted when formatting a
// number in national format, even though it usually wouldn't be. For example,
// a UK number would be formatted by our library as 020 XXXX XXXX. If we have
// commonly seen this number written by people without the leading 0, for
// example as (20) XXXX XXXX, this field would be set to true. This will be
// inherited from the value set for the territory in the XML file, unless a
// national_prefix_optional_when_formatting is defined specifically for this
// NumberFormat.
NationalPrefixOptionalWhenFormatting *bool `` /* 175-byte string literal not displayed */
// This field specifies how any carrier code ($CC) together with the first
// group ($FG) in the national significant number should be formatted
// when formatWithCarrierCode is called, if carrier codes are used for a
// certain country.
DomesticCarrierCodeFormattingRule *string `` /* 159-byte string literal not displayed */
// contains filtered or unexported fields
}
func (*NumberFormat) Descriptor
deprecated
func (*NumberFormat) Descriptor() ([]byte, []int)
Deprecated: Use NumberFormat.ProtoReflect.Descriptor instead.
func (*NumberFormat) GetDomesticCarrierCodeFormattingRule ¶
func (x *NumberFormat) GetDomesticCarrierCodeFormattingRule() string
func (*NumberFormat) GetFormat ¶
func (x *NumberFormat) GetFormat() string
func (*NumberFormat) GetLeadingDigitsPattern ¶
func (x *NumberFormat) GetLeadingDigitsPattern() []string
func (*NumberFormat) GetNationalPrefixFormattingRule ¶
func (x *NumberFormat) GetNationalPrefixFormattingRule() string
func (*NumberFormat) GetNationalPrefixOptionalWhenFormatting ¶
func (x *NumberFormat) GetNationalPrefixOptionalWhenFormatting() bool
func (*NumberFormat) GetPattern ¶
func (x *NumberFormat) GetPattern() string
func (*NumberFormat) Merge ¶
func (nf *NumberFormat) Merge(other *NumberFormat)
Merge folds the set fields of other into nf: for each field other sets, its value overwrites nf's, and leading-digit patterns are appended.
func (*NumberFormat) ProtoMessage ¶
func (*NumberFormat) ProtoMessage()
func (*NumberFormat) ProtoReflect ¶
func (x *NumberFormat) ProtoReflect() protoreflect.Message
func (*NumberFormat) Reset ¶
func (x *NumberFormat) Reset()
func (*NumberFormat) String ¶
func (x *NumberFormat) String() string
type PhoneMetadata ¶
type PhoneMetadata struct {
// The general_desc contains information which is a superset of descriptions
// for all types of phone numbers. If any element is missing in the
// description of a specific type in the XML file, the element will inherit
// from its counterpart in the general_desc. For all types that are generally
// relevant to normal phone numbers, if the whole type is missing in the
// PhoneNumberMetadata XML file, it will not have national number data, and
// the possible lengths will be [-1].
GeneralDesc *PhoneNumberDesc `protobuf:"bytes,1,opt,name=general_desc,json=generalDesc" json:"general_desc,omitempty"`
FixedLine *PhoneNumberDesc `protobuf:"bytes,2,opt,name=fixed_line,json=fixedLine" json:"fixed_line,omitempty"`
Mobile *PhoneNumberDesc `protobuf:"bytes,3,opt,name=mobile" json:"mobile,omitempty"`
TollFree *PhoneNumberDesc `protobuf:"bytes,4,opt,name=toll_free,json=tollFree" json:"toll_free,omitempty"`
PremiumRate *PhoneNumberDesc `protobuf:"bytes,5,opt,name=premium_rate,json=premiumRate" json:"premium_rate,omitempty"`
PersonalNumber *PhoneNumberDesc `protobuf:"bytes,7,opt,name=personal_number,json=personalNumber" json:"personal_number,omitempty"`
Voip *PhoneNumberDesc `protobuf:"bytes,8,opt,name=voip" json:"voip,omitempty"`
Pager *PhoneNumberDesc `protobuf:"bytes,21,opt,name=pager" json:"pager,omitempty"`
Uan *PhoneNumberDesc `protobuf:"bytes,25,opt,name=uan" json:"uan,omitempty"`
Emergency *PhoneNumberDesc `protobuf:"bytes,27,opt,name=emergency" json:"emergency,omitempty"`
Voicemail *PhoneNumberDesc `protobuf:"bytes,28,opt,name=voicemail" json:"voicemail,omitempty"`
ShortCode *PhoneNumberDesc `protobuf:"bytes,29,opt,name=short_code,json=shortCode" json:"short_code,omitempty"`
StandardRate *PhoneNumberDesc `protobuf:"bytes,30,opt,name=standard_rate,json=standardRate" json:"standard_rate,omitempty"`
CarrierSpecific *PhoneNumberDesc `protobuf:"bytes,31,opt,name=carrier_specific,json=carrierSpecific" json:"carrier_specific,omitempty"`
SmsServices *PhoneNumberDesc `protobuf:"bytes,33,opt,name=sms_services,json=smsServices" json:"sms_services,omitempty"`
// The rules here distinguish the numbers that are only able to be dialled
// nationally.
NoInternationalDialling *PhoneNumberDesc `` /* 126-byte string literal not displayed */
// The CLDR 2-letter representation of a country/region, with the exception of
// "country calling codes" used for non-geographical entities, such as
// Universal International Toll Free Number (+800). These are all given the ID
// "001", since this is the numeric region code for the world according to UN
// M.49: http://en.wikipedia.org/wiki/UN_M.49
Id *string `protobuf:"bytes,9,req,name=id" json:"id,omitempty"`
// The country calling code that one would dial from overseas when trying to
// dial a phone number in this country. For example, this would be "64" for
// New Zealand.
CountryCode *int32 `protobuf:"varint,10,opt,name=country_code,json=countryCode" json:"country_code,omitempty"`
// The international_prefix of country A is the number that needs to be
// dialled from country A to another country (country B). This is followed
// by the country code for country B. Note that some countries may have more
// than one international prefix, and for those cases, a regular expression
// matching the international prefixes will be stored in this field.
InternationalPrefix *string `protobuf:"bytes,11,opt,name=international_prefix,json=internationalPrefix" json:"international_prefix,omitempty"`
// If more than one international prefix is present, a preferred prefix can
// be specified here for out-of-country formatting purposes. If this field is
// not present, and multiple international prefixes are present, then "+"
// will be used instead.
PreferredInternationalPrefix *string `` /* 141-byte string literal not displayed */
// The national prefix of country A is the number that needs to be dialled
// before the national significant number when dialling internally. This
// would not be dialled when dialling internationally. For example, in New
// Zealand, the number that would be locally dialled as 09 345 3456 would be
// dialled from overseas as +64 9 345 3456. In this case, 0 is the national
// prefix.
NationalPrefix *string `protobuf:"bytes,12,opt,name=national_prefix,json=nationalPrefix" json:"national_prefix,omitempty"`
// The preferred prefix when specifying an extension in this country. This is
// used for formatting only, and if this is not specified, a suitable default
// should be used instead. For example, if you wanted extensions to be
// formatted in the following way:
// 1 (365) 345 445 ext. 2345
// " ext. " should be the preferred extension prefix.
PreferredExtnPrefix *string `protobuf:"bytes,13,opt,name=preferred_extn_prefix,json=preferredExtnPrefix" json:"preferred_extn_prefix,omitempty"`
// This field is used for cases where the national prefix of a country
// contains a carrier selection code, and is written in the form of a
// regular expression. For example, to dial the number 2222-2222 in
// Fortaleza, Brazil (area code 85) using the long distance carrier Oi
// (selection code 31), one would dial 0 31 85 2222 2222. Assuming the
// only other possible carrier selection code is 32, the field will
// contain "03[12]".
//
// When it is missing from the XML file, this field inherits the value of
// national_prefix, if that is present.
NationalPrefixForParsing *string `` /* 131-byte string literal not displayed */
// This field is only populated and used under very rare situations.
// For example, mobile numbers in Argentina are written in two completely
// different ways when dialed in-country and out-of-country
// (e.g. 0343 15 555 1212 is exactly the same number as +54 9 343 555 1212).
// This field is used together with national_prefix_for_parsing to transform
// the number into a particular representation for storing in the phonenumber
// proto buffer in those rare cases.
NationalPrefixTransformRule *string `` /* 140-byte string literal not displayed */
// Specifies whether the mobile and fixed-line patterns are the same or not.
// This is used to speed up determining phone number type in countries where
// these two types of phone numbers can never be distinguished.
SameMobileAndFixedLinePattern *bool `` /* 157-byte string literal not displayed */
// Note that the number format here is used for formatting only, not parsing.
// Hence all the varied ways a user *may* write a number need not be recorded
// - just the ideal way we would like to format it for them. When this element
// is absent, the national significant number will be formatted as a whole
// without any formatting applied.
NumberFormat []*NumberFormat `protobuf:"bytes,19,rep,name=number_format,json=numberFormat" json:"number_format,omitempty"`
// This field is populated only when the national significant number is
// formatted differently when it forms part of the INTERNATIONAL format
// and NATIONAL format. A case in point is mobile numbers in Argentina:
// The number, which would be written in INTERNATIONAL format as
// +54 9 343 555 1212, will be written as 0343 15 555 1212 for NATIONAL
// format. In this case, the prefix 9 is inserted when dialling from
// overseas, but otherwise the prefix 0 and the carrier selection code
// 15 (inserted after the area code of 343) is used.
// Note: this field is populated by setting a value for <intlFormat> inside
// the <numberFormat> tag in the XML file. If <intlFormat> is not set then it
// defaults to the same value as the <format> tag.
//
// Examples:
//
// To set the <intlFormat> to a different value than the <format>:
// <numberFormat pattern=....>
// <format>$1 $2 $3</format>
// <intlFormat>$1-$2-$3</intlFormat>
// </numberFormat>
//
// To have a format only used for national formatting, set <intlFormat> to
// "NA":
// <numberFormat pattern=....>
// <format>$1 $2 $3</format>
// <intlFormat>NA</intlFormat>
// </numberFormat>
IntlNumberFormat []*NumberFormat `protobuf:"bytes,20,rep,name=intl_number_format,json=intlNumberFormat" json:"intl_number_format,omitempty"`
// This field is set when this country is considered to be the main country
// for a calling code. It may not be set by more than one country with the
// same calling code, and it should not be set by countries with a unique
// calling code. This can be used to indicate that "GB" is the main country
// for the calling code "44" for example, rather than Jersey or the Isle of
// Man.
MainCountryForCode *bool `protobuf:"varint,22,opt,name=main_country_for_code,json=mainCountryForCode,def=0" json:"main_country_for_code,omitempty"`
// This field is populated only for countries or regions that share a country
// calling code. If a number matches this pattern, it could belong to this
// region. This is not intended as a replacement for IsValidForRegion since a
// matching prefix is insufficient for a number to be valid. Furthermore, it
// does not contain all the prefixes valid for a region - for example, 800
// numbers are valid for all NANPA countries and are hence not listed here.
// This field should be a regular expression of the expected prefix match.
// It is used merely as a short-cut for working out which region a number
// comes from in the case that there is only one, so leading_digit prefixes
// should not overlap.
LeadingDigits *string `protobuf:"bytes,23,opt,name=leading_digits,json=leadingDigits" json:"leading_digits,omitempty"`
// Deprecated: do not use. Will be deletd when there are no references to this
// later.
LeadingZeroPossible *bool `protobuf:"varint,26,opt,name=leading_zero_possible,json=leadingZeroPossible,def=0" json:"leading_zero_possible,omitempty"`
// This field is set when this country has implemented mobile number
// portability. This means that transferring mobile numbers between carriers
// is allowed. A consequence of this is that phone prefix to carrier mapping
// is less reliable.
MobileNumberPortableRegion *bool `` /* 144-byte string literal not displayed */
// contains filtered or unexported fields
}
If you add, remove, or rename fields, or change their semantics, check if you should change the excludable field sets or the behavior in MetadataFilter.
func NonGeoMetadata ¶
func NonGeoMetadata(countryCode int) (*PhoneMetadata, bool)
NonGeoMetadata returns the metadata for the given non-geographical country calling code, if any.
func RegionMetadata ¶
func RegionMetadata(region string) (*PhoneMetadata, bool)
RegionMetadata returns the metadata for the given region code, if supported.
func (*PhoneMetadata) Descriptor
deprecated
func (*PhoneMetadata) Descriptor() ([]byte, []int)
Deprecated: Use PhoneMetadata.ProtoReflect.Descriptor instead.
func (*PhoneMetadata) GetCarrierSpecific ¶
func (x *PhoneMetadata) GetCarrierSpecific() *PhoneNumberDesc
func (*PhoneMetadata) GetCountryCode ¶
func (x *PhoneMetadata) GetCountryCode() int32
func (*PhoneMetadata) GetEmergency ¶
func (x *PhoneMetadata) GetEmergency() *PhoneNumberDesc
func (*PhoneMetadata) GetFixedLine ¶
func (x *PhoneMetadata) GetFixedLine() *PhoneNumberDesc
func (*PhoneMetadata) GetGeneralDesc ¶
func (x *PhoneMetadata) GetGeneralDesc() *PhoneNumberDesc
func (*PhoneMetadata) GetId ¶
func (x *PhoneMetadata) GetId() string
func (*PhoneMetadata) GetInternationalPrefix ¶
func (x *PhoneMetadata) GetInternationalPrefix() string
func (*PhoneMetadata) GetIntlNumberFormat ¶
func (x *PhoneMetadata) GetIntlNumberFormat() []*NumberFormat
func (*PhoneMetadata) GetLeadingDigits ¶
func (x *PhoneMetadata) GetLeadingDigits() string
func (*PhoneMetadata) GetLeadingZeroPossible ¶
func (x *PhoneMetadata) GetLeadingZeroPossible() bool
func (*PhoneMetadata) GetMainCountryForCode ¶
func (x *PhoneMetadata) GetMainCountryForCode() bool
func (*PhoneMetadata) GetMobile ¶
func (x *PhoneMetadata) GetMobile() *PhoneNumberDesc
func (*PhoneMetadata) GetMobileNumberPortableRegion ¶
func (x *PhoneMetadata) GetMobileNumberPortableRegion() bool
func (*PhoneMetadata) GetNationalPrefix ¶
func (x *PhoneMetadata) GetNationalPrefix() string
func (*PhoneMetadata) GetNationalPrefixForParsing ¶
func (x *PhoneMetadata) GetNationalPrefixForParsing() string
func (*PhoneMetadata) GetNationalPrefixTransformRule ¶
func (x *PhoneMetadata) GetNationalPrefixTransformRule() string
func (*PhoneMetadata) GetNoInternationalDialling ¶
func (x *PhoneMetadata) GetNoInternationalDialling() *PhoneNumberDesc
func (*PhoneMetadata) GetNumberFormat ¶
func (x *PhoneMetadata) GetNumberFormat() []*NumberFormat
func (*PhoneMetadata) GetPager ¶
func (x *PhoneMetadata) GetPager() *PhoneNumberDesc
func (*PhoneMetadata) GetPersonalNumber ¶
func (x *PhoneMetadata) GetPersonalNumber() *PhoneNumberDesc
func (*PhoneMetadata) GetPreferredExtnPrefix ¶
func (x *PhoneMetadata) GetPreferredExtnPrefix() string
func (*PhoneMetadata) GetPreferredInternationalPrefix ¶
func (x *PhoneMetadata) GetPreferredInternationalPrefix() string
func (*PhoneMetadata) GetPremiumRate ¶
func (x *PhoneMetadata) GetPremiumRate() *PhoneNumberDesc
func (*PhoneMetadata) GetSameMobileAndFixedLinePattern ¶
func (x *PhoneMetadata) GetSameMobileAndFixedLinePattern() bool
func (*PhoneMetadata) GetSharedCost ¶
func (x *PhoneMetadata) GetSharedCost() *PhoneNumberDesc
func (*PhoneMetadata) GetShortCode ¶
func (x *PhoneMetadata) GetShortCode() *PhoneNumberDesc
func (*PhoneMetadata) GetSmsServices ¶
func (x *PhoneMetadata) GetSmsServices() *PhoneNumberDesc
func (*PhoneMetadata) GetStandardRate ¶
func (x *PhoneMetadata) GetStandardRate() *PhoneNumberDesc
func (*PhoneMetadata) GetTollFree ¶
func (x *PhoneMetadata) GetTollFree() *PhoneNumberDesc
func (*PhoneMetadata) GetUan ¶
func (x *PhoneMetadata) GetUan() *PhoneNumberDesc
func (*PhoneMetadata) GetVoicemail ¶
func (x *PhoneMetadata) GetVoicemail() *PhoneNumberDesc
func (*PhoneMetadata) GetVoip ¶
func (x *PhoneMetadata) GetVoip() *PhoneNumberDesc
func (*PhoneMetadata) ProtoMessage ¶
func (*PhoneMetadata) ProtoMessage()
func (*PhoneMetadata) ProtoReflect ¶
func (x *PhoneMetadata) ProtoReflect() protoreflect.Message
func (*PhoneMetadata) Reset ¶
func (x *PhoneMetadata) Reset()
func (*PhoneMetadata) String ¶
func (x *PhoneMetadata) String() string
type PhoneMetadataCollection ¶
type PhoneMetadataCollection struct {
Metadata []*PhoneMetadata `protobuf:"bytes,1,rep,name=metadata" json:"metadata,omitempty"`
// contains filtered or unexported fields
}
func Collection ¶
func Collection() (*PhoneMetadataCollection, error)
Collection returns the embedded territory metadata collection. The result is parsed once and cached; it always reflects the embedded data and is independent of any container swapped in via Use.
func (*PhoneMetadataCollection) Descriptor
deprecated
func (*PhoneMetadataCollection) Descriptor() ([]byte, []int)
Deprecated: Use PhoneMetadataCollection.ProtoReflect.Descriptor instead.
func (*PhoneMetadataCollection) GetMetadata ¶
func (x *PhoneMetadataCollection) GetMetadata() []*PhoneMetadata
func (*PhoneMetadataCollection) ProtoMessage ¶
func (*PhoneMetadataCollection) ProtoMessage()
func (*PhoneMetadataCollection) ProtoReflect ¶
func (x *PhoneMetadataCollection) ProtoReflect() protoreflect.Message
func (*PhoneMetadataCollection) Reset ¶
func (x *PhoneMetadataCollection) Reset()
func (*PhoneMetadataCollection) String ¶
func (x *PhoneMetadataCollection) String() string
type PhoneNumberDesc ¶
type PhoneNumberDesc struct {
// The national_number_pattern is the pattern that a valid national
// significant number would match. This specifies information such as its
// total length and leading digits.
NationalNumberPattern *string `protobuf:"bytes,2,opt,name=national_number_pattern,json=nationalNumberPattern" json:"national_number_pattern,omitempty"`
// These represent the lengths a phone number from this region can be. They
// will be sorted from smallest to biggest. Note that these lengths are for
// the full number, without country calling code or national prefix. For
// example, for the Swiss number +41789270000, in local format 0789270000,
// this would be 9.
// This could be used to highlight tokens in a text that may be a phone
// number, or to quickly prune numbers that could not possibly be a phone
// number for this locale.
PossibleLength []int32 `protobuf:"varint,9,rep,name=possible_length,json=possibleLength" json:"possible_length,omitempty"`
// These represent the lengths that only local phone numbers (without an area
// code) from this region can be. They will be sorted from smallest to
// biggest. For example, since the American number 456-1234 may be locally
// diallable, although not diallable from outside the area, 7 could be a
// possible value.
// This could be used to highlight tokens in a text that may be a phone
// number.
// To our knowledge, area codes are usually only relevant for some fixed-line
// and mobile numbers, so this field should only be set for those types of
// numbers (and the general description) - however there are exceptions for
// NANPA countries.
// This data is used to calculate whether a number could be a possible number
// for a particular type.
PossibleLengthLocalOnly []int32 `` /* 129-byte string literal not displayed */
// An example national significant number for the specific type. It should
// not contain any formatting information.
ExampleNumber *string `protobuf:"bytes,6,opt,name=example_number,json=exampleNumber" json:"example_number,omitempty"`
// contains filtered or unexported fields
}
If you add, remove, or rename fields, or change their semantics, check if you should change the excludable field sets or the behavior in MetadataFilter.
func (*PhoneNumberDesc) Descriptor
deprecated
func (*PhoneNumberDesc) Descriptor() ([]byte, []int)
Deprecated: Use PhoneNumberDesc.ProtoReflect.Descriptor instead.
func (*PhoneNumberDesc) GetExampleNumber ¶
func (x *PhoneNumberDesc) GetExampleNumber() string
func (*PhoneNumberDesc) GetNationalNumberPattern ¶
func (x *PhoneNumberDesc) GetNationalNumberPattern() string
func (*PhoneNumberDesc) GetPossibleLength ¶
func (x *PhoneNumberDesc) GetPossibleLength() []int32
func (*PhoneNumberDesc) GetPossibleLengthLocalOnly ¶
func (x *PhoneNumberDesc) GetPossibleLengthLocalOnly() []int32
func (*PhoneNumberDesc) HasPossibleLength ¶
func (pd *PhoneNumberDesc) HasPossibleLength(length int32) bool
HasPossibleLength reports whether length is one of pd's possible lengths.
func (*PhoneNumberDesc) HasPossibleLengthLocalOnly ¶
func (pd *PhoneNumberDesc) HasPossibleLengthLocalOnly(length int32) bool
HasPossibleLengthLocalOnly reports whether length is one of pd's local-only possible lengths.
func (*PhoneNumberDesc) ProtoMessage ¶
func (*PhoneNumberDesc) ProtoMessage()
func (*PhoneNumberDesc) ProtoReflect ¶
func (x *PhoneNumberDesc) ProtoReflect() protoreflect.Message
func (*PhoneNumberDesc) Reset ¶
func (x *PhoneNumberDesc) Reset()
func (*PhoneNumberDesc) String ¶
func (x *PhoneNumberDesc) String() string