Documentation ¶
Overview ¶
Package phonetype defines a custom format for phone numbers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PhoneFormat = gen.CustomFormat[ Phone, JSONPhoneEncoding, TextPhoneEncoding, ]()
PhoneFormat defines a custom format for phone numbers.
Functions ¶
This section is empty.
Types ¶
type JSONPhoneEncoding ¶
type JSONPhoneEncoding struct{}
JSONPhoneEncoding defines a custom JSON encoding for phone numbers.
func (JSONPhoneEncoding) DecodeJSON ¶
func (JSONPhoneEncoding) DecodeJSON(d *jx.Decoder) (v Phone, _ error)
DecodeJSON decodes a phone number from a JSON string.
func (JSONPhoneEncoding) EncodeJSON ¶
func (JSONPhoneEncoding) EncodeJSON(e *jx.Encoder, v Phone)
EncodeJSON encodes a phone number as a JSON string.
type TextPhoneEncoding ¶
type TextPhoneEncoding struct{}
TextPhoneEncoding defines a custom text encoding for phone numbers.
func (TextPhoneEncoding) DecodeText ¶
func (TextPhoneEncoding) DecodeText(s string) (v Phone, _ error)
DecodeText decodes a phone number from a string.
func (TextPhoneEncoding) EncodeText ¶
func (TextPhoneEncoding) EncodeText(v Phone) string
EncodeText encodes a phone number as a string.
Click to show internal directories.
Click to hide internal directories.