Package strfmt contains custom string formats
TODO: add info on how to define and register a custom format
const ( UUIDPattern = `(?i)(^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$)|(^[0-9a-f]{32}$)` UUID3Pattern = `(?i)(^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$)|(^[0-9a-f]{12}3[0-9a-f]{3}?[0-9a-f]{16}$)` UUID4Pattern = `(?i)(^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$)|(^[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}$)` UUID5Pattern = `(?i)(^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$)|(^[0-9a-f]{12}5[0-9a-f]{3}[89ab][0-9a-f]{15}$)` )View Source
const ( RFC3339Millis = "2006-01-02T15:04:05.000Z07:00" RFC3339MillisNoColon = "2006-01-02T15:04:05.000Z0700" RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00" RFC3339MicroNoColon = "2006-01-02T15:04:05.000000Z0700" ISO8601LocalTime = "2006-01-02T15:04:05" ISO8601TimeWithReducedPrecision = "2006-01-02T15:04Z" ISO8601TimeWithReducedPrecisionLocaltime = "2006-01-02T15:04" ISO8601TimeUniversalSortableDateTimePattern = "2006-01-02 15:04:05" ISO8601TimeUniversalSortableDateTimePatternShortForm = "2006-01-02" DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$` )View Source
var ( DateTimeFormats = []string{RFC3339Micro, RFC3339MicroNoColon, RFC3339Millis, RFC3339MillisNoColon, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime, ISO8601TimeWithReducedPrecision, ISO8601TimeWithReducedPrecisionLocaltime, ISO8601TimeUniversalSortableDateTimePattern, ISO8601TimeUniversalSortableDateTimePatternShortForm} MarshalFormat = RFC3339Millis NormalizeTimeForMarshal = func(t time.Time) time.Time { return t } DefaultTimeLocation = time.UTC )View Source
var ( ULIDScanDefaultFunc = func(raw interface{}) (ULID, error) { u := NewULIDZero() switch x := raw.(type) { case nil: return u, nil case string: if x == "" { return u, nil } return u, u.UnmarshalText([]byte(x)) case []byte: return u, u.UnmarshalText(x) } return u, fmt.Errorf("cannot sql.Scan() strfmt.ULID from: %#v: %w", raw, ulid.ErrScanValue) } ULIDScanOverrideFunc = ULIDScanDefaultFunc ULIDValueDefaultFunc = func(u ULID) (driver.Value, error) { return driver.Value(u.String()), nil } ULIDValueOverrideFunc = ULIDValueDefaultFunc )
Default is the default formats registry
DefaultNameNormalizer removes all dashes
IsBSONObjectID returns true when the string is a valid BSON.ObjectId
IsDate returns true when the string is a valid date
IsDateTime returns true when the string is a valid date-time
IsDuration returns true if the provided string is a valid duration
IsEmail validates an email address.
IsHostname returns true when the string is a valid hostname
IsULID checks if provided string is ULID format Be noticed that this function considers overflowed ULID as non-ulid. For more details see https://github.com/ulid/spec
IsUUID returns true is the string matches a UUID (in any version, including v6 and v7), upper case is allowed
IsUUID3 returns true is the string matches a UUID v3, upper case is allowed
IsUUID4 returns true is the string matches a UUID v4, upper case is allowed
IsUUID5 returns true is the string matches a UUID v5, upper case is allowed
ParseDuration parses a duration from a string, compatible with scala duration syntax
Base64 represents a base64 encoded string, using URLEncoding alphabet
swagger:strfmt byte
DeepCopy copies the receiver into a new Base64.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the Base64 as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the Base64 from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
CIDR represents a Classless Inter-Domain Routing notation
swagger:strfmt cidr
DeepCopy copies the receiver into a new CIDR.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the CIDR as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the CIDR from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
CreditCard represents a credit card string format
swagger:strfmt creditcard
DeepCopy copies the receiver into a new CreditCard.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the CreditCard as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the CreditCard from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Date represents a date from the API
swagger:strfmt date
DeepCopy copies the receiver into a new Date.
DeepCopyInto copies the receiver and writes its value into out.
Equal checks if two Date instances are equal
GobDecode implements the gob.GobDecoder interface.
GobEncode implements the gob.GobEncoder interface.
MarshalBinary implements the encoding.BinaryMarshaler interface.
MarshalJSON returns the Date as JSON
MarshalText serializes this date type to string
Scan scans a Date value from database driver type.
String converts this date into a string
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
UnmarshalJSON sets the Date from JSON
UnmarshalText parses a text representation into a date type
Value converts Date to a primitive value ready to written to a database.
DateTime is a time but it serializes to ISO8601 format with millis It knows how to read 3 different variations of a RFC3339 date time. Most APIs we encounter want either millisecond or second precision times. This just tries to make it worry-free.
swagger:strfmt date-time
NewDateTime is a representation of zero value for DateTime type
ParseDateTime parses a string that represents an ISO8601 time or a unix epoch
DeepCopy copies the receiver into a new DateTime.
DeepCopyInto copies the receiver and writes its value into out.
Equal checks if two DateTime instances are equal using time.Time's Equal method
GobDecode implements the gob.GobDecoder interface.
GobEncode implements the gob.GobEncoder interface.
IsUnixZerom returns whether the date time is equivalent to time.Unix(0, 0).UTC().
IsZero returns whether the date time is a zero value
MarshalBSON renders the DateTime as a BSON document
MarshalBSONValue is an interface implemented by types that can marshal themselves into a BSON document represented as bytes. The bytes returned must be a valid BSON document if the error is nil. Marshals a DateTime as a bsontype.DateTime, an int64 representing milliseconds since epoch.
MarshalBinary implements the encoding.BinaryMarshaler interface.
MarshalJSON returns the DateTime as JSON
MarshalText implements the text marshaller interface
Scan scans a DateTime value from database driver type.
String converts this time to a string
UnmarshalBSON reads the DateTime from a BSON document
UnmarshalBSONValue is an interface implemented by types that can unmarshal a BSON value representation of themselves. The BSON bytes and type can be assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it wishes to retain the data after returning.
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
UnmarshalJSON sets the DateTime from JSON
UnmarshalText implements the text unmarshaller interface
Value converts DateTime to a primitive value ready to written to a database.
Duration represents a duration
Duration stores a period of time as a nanosecond count, with the largest repesentable duration being approximately 290 years.
swagger:strfmt duration
DeepCopy copies the receiver into a new Duration.
DeepCopyInto copies the receiver and writes its value into out.
MarshalJSON returns the Duration as JSON
MarshalText turns this instance into text
Scan reads a Duration value from database driver type.
String converts this duration to a string
UnmarshalJSON sets the Duration from JSON
UnmarshalText hydrates this instance from text
Value converts Duration to a primitive value ready to be written to a database.
Email represents the email string format as specified by the json schema spec
swagger:strfmt email
DeepCopy copies the receiver into a new Email.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the Email as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the Email from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Format represents a string format.
All implementations of Format provide a string representation and text marshaling/unmarshaling interface to be used by encoders (e.g. encoding/json).
HexColor represents a hex color string format
swagger:strfmt hexcolor
DeepCopy copies the receiver into a new HexColor.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the HexColor as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the HexColor from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Hostname represents the hostname string format as specified by the json schema spec
swagger:strfmt hostname
DeepCopy copies the receiver into a new Hostname.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the Hostname as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the Hostname from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
IPv4 represents an IP v4 address
swagger:strfmt ipv4
DeepCopy copies the receiver into a new IPv4.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the IPv4 as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the IPv4 from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
IPv6 represents an IP v6 address
swagger:strfmt ipv6
DeepCopy copies the receiver into a new IPv6.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the IPv6 as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the IPv6 from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
ISBN represents an isbn string format
swagger:strfmt isbn
DeepCopy copies the receiver into a new ISBN.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the ISBN as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the ISBN from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
ISBN10 represents an isbn 10 string format
swagger:strfmt isbn10
DeepCopy copies the receiver into a new ISBN10.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the ISBN10 as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the ISBN10 from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
ISBN13 represents an isbn 13 string format
swagger:strfmt isbn13
DeepCopy copies the receiver into a new ISBN13.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the ISBN13 as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the ISBN13 from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
MAC represents a 48 bit MAC address
swagger:strfmt mac
DeepCopy copies the receiver into a new MAC.
func (u *MAC) DeepCopyInto(out *MAC)
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the MAC as JSON
MarshalText turns this instance into text
func (u *MAC) Scan(raw interface{}) error
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the MAC from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
NameNormalizer is a function that normalizes a format name.
ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID)
swagger:strfmt bsonobjectid
NewObjectId creates a ObjectId from a Hex String
DeepCopy copies the receiver into a new ObjectId.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON renders the object id as a BSON document
MarshalBSONValue is an interface implemented by types that can marshal themselves into a BSON document represented as bytes. The bytes returned must be a valid BSON document if the error is nil.
MarshalJSON returns the ObjectId as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON reads the objectId from a BSON document
UnmarshalBSONValue is an interface implemented by types that can unmarshal a BSON value representation of themselves. The BSON bytes and type can be assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it wishes to retain the data after returning.
UnmarshalJSON sets the ObjectId from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Password represents a password. This has no validations and is mainly used as a marker for UI components.
swagger:strfmt password
DeepCopy copies the receiver into a new Password.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the Password as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the Password from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
RGBColor represents a RGB color string format
swagger:strfmt rgbcolor
DeepCopy copies the receiver into a new RGBColor.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the RGBColor as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the RGBColor from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Registry is a registry of string formats, with a validation method.
NewFormats creates a new formats registry seeded with the values from the default
NewSeededFormats creates a new formats registry
SSN represents a social security string format
swagger:strfmt ssn
DeepCopy copies the receiver into a new SSN.
func (u *SSN) DeepCopyInto(out *SSN)
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the SSN as JSON
MarshalText turns this instance into text
func (u *SSN) Scan(raw interface{}) error
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the SSN from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
ULID represents a ulid string format ref:
https://github.com/ulid/spec
impl:
https://github.com/oklog/ulid
swagger:strfmt ulid
NewULID generates new unique ULID value and a error if any
NewULIDZero returns a zero valued ULID type
ParseULID parses a string that represents an valid ULID
DeepCopy copies the receiver into a new ULID.
DeepCopyInto copies the receiver and writes its value into out.
Equal checks if two ULID instances are equal by their underlying type
func (u *ULID) GetULID() interface{}
GetULID returns underlying instance of ULID
GobDecode implements the gob.GobDecoder interface.
GobEncode implements the gob.GobEncoder interface.
MarshalBSON document from this value
MarshalBinary implements the encoding.BinaryMarshaler interface.
MarshalJSON returns the ULID as JSON
MarshalText returns this instance into text
Scan reads a value from a database driver
UnmarshalBSON document into this value
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
UnmarshalJSON sets the ULID from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
URI represents the uri string format as specified by the json schema spec
swagger:strfmt uri
DeepCopy copies the receiver into a new URI.
func (u *URI) DeepCopyInto(out *URI)
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the URI as JSON
MarshalText turns this instance into text
func (u *URI) Scan(raw interface{}) error
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the URI from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
UUID represents a uuid string format
swagger:strfmt uuid
DeepCopy copies the receiver into a new UUID.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the UUID as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the UUID from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
UUID3 represents a uuid3 string format
swagger:strfmt uuid3
DeepCopy copies the receiver into a new UUID3.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the UUID as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the UUID from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
UUID4 represents a uuid4 string format
swagger:strfmt uuid4
DeepCopy copies the receiver into a new UUID4.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the UUID as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the UUID from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
UUID5 represents a uuid5 string format
swagger:strfmt uuid5
DeepCopy copies the receiver into a new UUID5.
DeepCopyInto copies the receiver and writes its value into out.
MarshalBSON document from this value
MarshalJSON returns the UUID as JSON
MarshalText turns this instance into text
Scan read a value from a database driver
UnmarshalBSON document into this value
UnmarshalJSON sets the UUID from JSON
UnmarshalText hydrates this instance from text
Value converts a value to a database driver value
Validator represents a validator for a string format.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4