Documentation
¶
Overview ¶
Package phone adapts the shared phone parser to typed validation rules. Import it as phonevalidation alongside the phone package.
Index ¶
Constants ¶
const ( // NumberRuleID identifies the default server-only phone rule in metadata. NumberRuleID validation.RuleID = "phone.number" // DiscardExtensionRuleID identifies the rule that explicitly discards extensions. DiscardExtensionRuleID validation.RuleID = "phone.number_discard_extension" )
Variables ¶
This section is empty.
Functions ¶
func For ¶
func For[T any, S ~string](region validation.Field[T, countries.Code], number validation.Field[T, S], options phone.Options) validation.Rule[T]
For validates a number against the region selected by another typed field. Rejections retain the number field's path and label. Wrap the whole contact with Optional or Nullable when absence is allowed. The region is per check; neither input nor registered rules are changed. Example: phonevalidation.For(fields.Country, fields.Number, phone.Options{}).
func MessageDefinitions ¶
func MessageDefinitions() []i18n.MessageDefinition
MessageDefinitions returns owned translation signatures for the phone rules. Register these alongside validation.MessageDefinitions when supplying catalog translations. Missing translations retain the rule's English fallback.
Types ¶
This section is empty.