strfmt

package module
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 24 Imported by: 20,484

README

Strfmt Build Status codecov

Slack Status license GoDoc Go Report Card

This package exposes a registry of data types to support string formats in the go-openapi toolkit.

strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those.

Supported data formats

go-openapi/strfmt follows the swagger 2.0 specification with the following formats defined here.

It also provides convenient extensions to go-openapi users.

  • JSON-schema draft 4 formats
    • date-time
    • email
    • hostname
    • ipv4
    • ipv6
    • uri
  • swagger 2.0 format extensions
    • binary
    • byte (e.g. base64 encoded string)
    • date (e.g. "1970-01-01")
    • password
  • go-openapi custom format extensions
    • bsonobjectid (BSON objectID)
    • creditcard
    • duration (e.g. "3 weeks", "1ms")
    • hexcolor (e.g. "#FFFFFF")
    • isbn, isbn10, isbn13
    • mac (e.g "01:02:03:04:05:06")
    • rgbcolor (e.g. "rgb(100,100,100)")
    • ssn
    • uuid, uuid3, uuid4, uuid5
    • cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32")
    • ulid (e.g. "00000PP9HGSBSSDZ1JTEXBJ0PW", spec)

NOTE: as the name stands for, this package is intended to support string formatting only. It does not provide validation for numerical values with swagger format extension for JSON types "number" or "integer" (e.g. float, double, int32...).

Type conversion

All types defined here are stringers and may be converted to strings with .String(). Note that most types defined by this package may be converted directly to string like string(Email{}).

Date and DateTime may be converted directly to time.Time like time.Time(Time{}). Similarly, you can convert Duration to time.Duration as in time.Duration(Duration{})

Using pointers

The conv subpackage provides helpers to convert the types to and from pointers, just like go-openapi/swag does with primitive types.

Format types

Types defined in strfmt expose marshaling and validation capabilities.

List of defined types:

  • Base64
  • CreditCard
  • Date
  • DateTime
  • Duration
  • Email
  • HexColor
  • Hostname
  • IPv4
  • IPv6
  • CIDR
  • ISBN
  • ISBN10
  • ISBN13
  • MAC
  • ObjectId
  • Password
  • RGBColor
  • SSN
  • URI
  • UUID
  • UUID3
  • UUID4
  • UUID5
  • ULID

Documentation

Overview

Package strfmt contains custom string formats

TODO: add info on how to define and register a custom format

Index

Constants

View Source
const (
	// UUIDPattern Regex for UUID that allows uppercase
	//
	// Deprecated: strfmt no longer uses regular expressions to validate UUIDs.
	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 Regex for UUID3 that allows uppercase
	//
	// Deprecated: strfmt no longer uses regular expressions to validate UUIDs.
	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 Regex for UUID4 that allows uppercase
	//
	// Deprecated: strfmt no longer uses regular expressions to validate UUIDs.
	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 Regex for UUID5 that allows uppercase
	//
	// Deprecated: strfmt no longer uses regular expressions to validate UUIDs.
	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 represents a ISO8601 format to millis instead of to nanos
	RFC3339Millis = "2006-01-02T15:04:05.000Z07:00"
	// RFC3339MillisNoColon represents a ISO8601 format to millis instead of to nanos
	RFC3339MillisNoColon = "2006-01-02T15:04:05.000Z0700"
	// RFC3339Micro represents a ISO8601 format to micro instead of to nano
	RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
	// RFC3339MicroNoColon represents a ISO8601 format to micro instead of to nano
	RFC3339MicroNoColon = "2006-01-02T15:04:05.000000Z0700"
	// ISO8601LocalTime represents a ISO8601 format to ISO8601 in local time (no timezone)
	ISO8601LocalTime = "2006-01-02T15:04:05"
	// ISO8601TimeWithReducedPrecision represents a ISO8601 format with reduced precision (dropped secs)
	ISO8601TimeWithReducedPrecision = "2006-01-02T15:04Z"
	// ISO8601TimeWithReducedPrecisionLocaltime represents a ISO8601 format with reduced precision and no timezone (dropped seconds + no timezone)
	ISO8601TimeWithReducedPrecisionLocaltime = "2006-01-02T15:04"
	// ISO8601TimeUniversalSortableDateTimePattern represents a ISO8601 universal sortable date time pattern.
	ISO8601TimeUniversalSortableDateTimePattern = "2006-01-02 15:04:05"
	// short form of ISO8601TimeUniversalSortableDateTimePattern
	ISO8601TimeUniversalSortableDateTimePatternShortForm = "2006-01-02"
	// DateTimePattern pattern to match for the date-time format from http://tools.ietf.org/html/rfc3339#section-5.6
	DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$`
)
View Source
const (
	// HostnamePattern http://json-schema.org/latest/json-schema-validation.html#anchor114
	//  A string instance is valid against this attribute if it is a valid
	//  representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034].
	//  http://tools.ietf.org/html/rfc1034#section-3.5
	//  <digit> ::= any one of the ten digits 0 through 9
	//  var digit = /[0-9]/;
	//  <letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
	//  var letter = /[a-zA-Z]/;
	//  <let-dig> ::= <letter> | <digit>
	//  var letDig = /[0-9a-zA-Z]/;
	//  <let-dig-hyp> ::= <let-dig> | "-"
	//  var letDigHyp = /[-0-9a-zA-Z]/;
	//  <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
	//  var ldhStr = /[-0-9a-zA-Z]+/;
	//  <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
	//  var label = /[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?/;
	//  <subdomain> ::= <label> | <subdomain> "." <label>
	//  var subdomain = /^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/;
	//  <domain> ::= <subdomain> | " "
	//
	// Additional validations:
	//   - for FDQNs, top-level domain (e.g. ".com"), is at least to letters long (no special characters here)
	//   - hostnames may start with a digit [RFC1123]
	//   - special registered names with an underscore ('_') are not allowed in this context
	//   - dashes are permitted, but not at the start or the end of a segment
	//   - long top-level domain names (e.g. example.london) are permitted
	//   - symbol unicode points are permitted (e.g. emoji) (not for top-level domain)
	HostnamePattern = `` /* 166-byte string literal not displayed */

)
View Source
const (
	// RFC3339FullDate represents a full-date as specified by RFC3339
	// See: http://goo.gl/xXOvVd
	RFC3339FullDate = "2006-01-02"
)

Variables

View Source
var (

	// DateTimeFormats is the collection of formats used by ParseDateTime()
	DateTimeFormats = []string{RFC3339Micro, RFC3339MicroNoColon, RFC3339Millis, RFC3339MillisNoColon, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime, ISO8601TimeWithReducedPrecision, ISO8601TimeWithReducedPrecisionLocaltime, ISO8601TimeUniversalSortableDateTimePattern, ISO8601TimeUniversalSortableDateTimePatternShortForm}

	// MarshalFormat sets the time resolution format used for marshaling time (set to milliseconds)
	MarshalFormat = RFC3339Millis

	// NormalizeTimeForMarshal provides a normalization function on time befeore marshalling (e.g. time.UTC).
	// By default, the time value is not changed.
	NormalizeTimeForMarshal = func(t time.Time) time.Time { return t }

	// DefaultTimeLocation provides a location for a time when the time zone is not encoded in the string (ex: ISO8601 Local variants).
	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 allows you to override the Scan method of the ULID type
	ULIDScanOverrideFunc = ULIDScanDefaultFunc

	ULIDValueDefaultFunc = func(u ULID) (driver.Value, error) {
		return driver.Value(u.String()), nil
	}

	// ULIDValueOverrideFunc allows you to override the Value method of the ULID type
	ULIDValueOverrideFunc = ULIDValueDefaultFunc
)

Default is the default formats registry

View Source
var (
	// UnixZero sets the zero unix timestamp we want to compare against.
	// Unix 0 for an EST timezone is not equivalent to a UTC timezone.
	UnixZero = time.Unix(0, 0).UTC()
)

Functions

func DefaultNameNormalizer

func DefaultNameNormalizer(name string) string

DefaultNameNormalizer removes all dashes

func IsBSONObjectID

func IsBSONObjectID(str string) bool

IsBSONObjectID returns true when the string is a valid BSON.ObjectId

func IsDate

func IsDate(str string) bool

IsDate returns true when the string is a valid date

func IsDateTime

func IsDateTime(str string) bool

IsDateTime returns true when the string is a valid date-time

func IsDuration

func IsDuration(str string) bool

IsDuration returns true if the provided string is a valid duration

func IsEmail added in v0.17.1

func IsEmail(str string) bool

IsEmail validates an email address.

func IsHostname

func IsHostname(str string) bool

IsHostname returns true when the string is a valid hostname

func IsULID added in v0.20.1

func IsULID(str string) bool

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

func IsUUID

func IsUUID(str string) bool

IsUUID returns true is the string matches a UUID (in any version, including v6 and v7), upper case is allowed

func IsUUID3

func IsUUID3(str string) bool

IsUUID3 returns true is the string matches a UUID v3, upper case is allowed

func IsUUID4

func IsUUID4(str string) bool

IsUUID4 returns true is the string matches a UUID v4, upper case is allowed

func IsUUID5

func IsUUID5(str string) bool

IsUUID5 returns true is the string matches a UUID v5, upper case is allowed

func ParseDuration

func ParseDuration(cand string) (time.Duration, error)

ParseDuration parses a duration from a string, compatible with scala duration syntax

Types

type Base64

type Base64 []byte

Base64 represents a base64 encoded string, using URLEncoding alphabet

swagger:strfmt byte

func (*Base64) DeepCopy added in v0.19.0

func (b *Base64) DeepCopy() *Base64

DeepCopy copies the receiver into a new Base64.

func (*Base64) DeepCopyInto added in v0.19.0

func (b *Base64) DeepCopyInto(out *Base64)

DeepCopyInto copies the receiver and writes its value into out.

func (Base64) MarshalBSON added in v0.19.2

func (b Base64) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (Base64) MarshalJSON

func (b Base64) MarshalJSON() ([]byte, error)

MarshalJSON returns the Base64 as JSON

func (Base64) MarshalText

func (b Base64) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*Base64) Scan

func (b *Base64) Scan(raw interface{}) error

Scan read a value from a database driver

func (Base64) String

func (b Base64) String() string

func (*Base64) UnmarshalBSON added in v0.19.2

func (b *Base64) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*Base64) UnmarshalJSON

func (b *Base64) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Base64 from JSON

func (*Base64) UnmarshalText

func (b *Base64) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (Base64) Value

func (b Base64) Value() (driver.Value, error)

Value converts a value to a database driver value

type CIDR added in v0.19.0

type CIDR string

CIDR represents a Classless Inter-Domain Routing notation

swagger:strfmt cidr

func (*CIDR) DeepCopy added in v0.19.0

func (u *CIDR) DeepCopy() *CIDR

DeepCopy copies the receiver into a new CIDR.

func (*CIDR) DeepCopyInto added in v0.19.0

func (u *CIDR) DeepCopyInto(out *CIDR)

DeepCopyInto copies the receiver and writes its value into out.

func (CIDR) MarshalBSON added in v0.19.2

func (u CIDR) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (CIDR) MarshalJSON added in v0.19.0

func (u CIDR) MarshalJSON() ([]byte, error)

MarshalJSON returns the CIDR as JSON

func (CIDR) MarshalText added in v0.19.0

func (u CIDR) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*CIDR) Scan added in v0.19.0

func (u *CIDR) Scan(raw interface{}) error

Scan read a value from a database driver

func (CIDR) String added in v0.19.0

func (u CIDR) String() string

func (*CIDR) UnmarshalBSON added in v0.19.2

func (u *CIDR) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*CIDR) UnmarshalJSON added in v0.19.0

func (u *CIDR) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the CIDR from JSON

func (*CIDR) UnmarshalText added in v0.19.0

func (u *CIDR) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (CIDR) Value added in v0.19.0

func (u CIDR) Value() (driver.Value, error)

Value converts a value to a database driver value

type CreditCard

type CreditCard string

CreditCard represents a credit card string format

swagger:strfmt creditcard

func (*CreditCard) DeepCopy added in v0.19.0

func (u *CreditCard) DeepCopy() *CreditCard

DeepCopy copies the receiver into a new CreditCard.

func (*CreditCard) DeepCopyInto added in v0.19.0

func (u *CreditCard) DeepCopyInto(out *CreditCard)

DeepCopyInto copies the receiver and writes its value into out.

func (CreditCard) MarshalBSON added in v0.19.2

func (u CreditCard) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (CreditCard) MarshalJSON

func (u CreditCard) MarshalJSON() ([]byte, error)

MarshalJSON returns the CreditCard as JSON

func (CreditCard) MarshalText

func (u CreditCard) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*CreditCard) Scan

func (u *CreditCard) Scan(raw interface{}) error

Scan read a value from a database driver

func (CreditCard) String

func (u CreditCard) String() string

func (*CreditCard) UnmarshalBSON added in v0.19.2

func (u *CreditCard) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*CreditCard) UnmarshalJSON

func (u *CreditCard) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the CreditCard from JSON

func (*CreditCard) UnmarshalText

func (u *CreditCard) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (CreditCard) Value

func (u CreditCard) Value() (driver.Value, error)

Value converts a value to a database driver value

type Date

type Date time.Time

Date represents a date from the API

swagger:strfmt date

func (*Date) DeepCopy added in v0.19.0

func (d *Date) DeepCopy() *Date

DeepCopy copies the receiver into a new Date.

func (*Date) DeepCopyInto added in v0.19.0

func (d *Date) DeepCopyInto(out *Date)

DeepCopyInto copies the receiver and writes its value into out.

func (Date) Equal added in v0.19.12

func (d Date) Equal(d2 Date) bool

Equal checks if two Date instances are equal

func (*Date) GobDecode added in v0.19.4

func (d *Date) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (Date) GobEncode added in v0.19.4

func (d Date) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (Date) MarshalBSON added in v0.19.2

func (d Date) MarshalBSON() ([]byte, error)

func (Date) MarshalBinary added in v0.19.4

func (d Date) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON returns the Date as JSON

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

MarshalText serializes this date type to string

func (*Date) Scan

func (d *Date) Scan(raw interface{}) error

Scan scans a Date value from database driver type.

func (Date) String

func (d Date) String() string

String converts this date into a string

func (*Date) UnmarshalBSON added in v0.19.2

func (d *Date) UnmarshalBSON(data []byte) error

func (*Date) UnmarshalBinary added in v0.19.4

func (d *Date) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Date from JSON

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(text []byte) error

UnmarshalText parses a text representation into a date type

func (Date) Value

func (d Date) Value() (driver.Value, error)

Value converts Date to a primitive value ready to written to a database.

type DateTime

type DateTime time.Time

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

func NewDateTime

func NewDateTime() DateTime

NewDateTime is a representation of zero value for DateTime type

func ParseDateTime

func ParseDateTime(data string) (DateTime, error)

ParseDateTime parses a string that represents an ISO8601 time or a unix epoch

func (*DateTime) DeepCopy added in v0.19.0

func (t *DateTime) DeepCopy() *DateTime

DeepCopy copies the receiver into a new DateTime.

func (*DateTime) DeepCopyInto added in v0.19.0

func (t *DateTime) DeepCopyInto(out *DateTime)

DeepCopyInto copies the receiver and writes its value into out.

func (DateTime) Equal added in v0.19.12

func (t DateTime) Equal(t2 DateTime) bool

Equal checks if two DateTime instances are equal using time.Time's Equal method

func (*DateTime) GobDecode added in v0.19.4

func (t *DateTime) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (DateTime) GobEncode added in v0.19.4

func (t DateTime) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (*DateTime) IsUnixZero added in v0.21.4

func (t *DateTime) IsUnixZero() bool

IsUnixZerom returns whether the date time is equivalent to time.Unix(0, 0).UTC().

func (*DateTime) IsZero added in v0.21.4

func (t *DateTime) IsZero() bool

IsZero returns whether the date time is a zero value

func (DateTime) MarshalBSON added in v0.19.2

func (t DateTime) MarshalBSON() ([]byte, error)

MarshalBSON renders the DateTime as a BSON document

func (DateTime) MarshalBSONValue added in v0.19.4

func (t DateTime) MarshalBSONValue() (bsontype.Type, []byte, error)

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.

func (DateTime) MarshalBinary added in v0.19.4

func (t DateTime) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

MarshalJSON returns the DateTime as JSON

func (DateTime) MarshalText

func (t DateTime) MarshalText() ([]byte, error)

MarshalText implements the text marshaller interface

func (*DateTime) Scan

func (t *DateTime) Scan(raw interface{}) error

Scan scans a DateTime value from database driver type.

func (DateTime) String

func (t DateTime) String() string

String converts this time to a string

func (*DateTime) UnmarshalBSON added in v0.19.2

func (t *DateTime) UnmarshalBSON(data []byte) error

UnmarshalBSON reads the DateTime from a BSON document

func (*DateTime) UnmarshalBSONValue added in v0.19.4

func (t *DateTime) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error

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.

func (*DateTime) UnmarshalBinary added in v0.19.4

func (t *DateTime) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the DateTime from JSON

func (*DateTime) UnmarshalText

func (t *DateTime) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller interface

func (DateTime) Value

func (t DateTime) Value() (driver.Value, error)

Value converts DateTime to a primitive value ready to written to a database.

type Duration

type Duration time.Duration

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

func (*Duration) DeepCopy added in v0.19.0

func (d *Duration) DeepCopy() *Duration

DeepCopy copies the receiver into a new Duration.

func (*Duration) DeepCopyInto added in v0.19.0

func (d *Duration) DeepCopyInto(out *Duration)

DeepCopyInto copies the receiver and writes its value into out.

func (Duration) MarshalBSON added in v0.19.2

func (d Duration) MarshalBSON() ([]byte, error)

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON returns the Duration as JSON

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*Duration) Scan

func (d *Duration) Scan(raw interface{}) error

Scan reads a Duration value from database driver type.

func (Duration) String

func (d Duration) String() string

String converts this duration to a string

func (*Duration) UnmarshalBSON added in v0.19.2

func (d *Duration) UnmarshalBSON(data []byte) error

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Duration from JSON

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (Duration) Value

func (d Duration) Value() (driver.Value, error)

Value converts Duration to a primitive value ready to be written to a database.

type Email

type Email string

Email represents the email string format as specified by the json schema spec

swagger:strfmt email

func (*Email) DeepCopy added in v0.19.0

func (e *Email) DeepCopy() *Email

DeepCopy copies the receiver into a new Email.

func (*Email) DeepCopyInto added in v0.19.0

func (e *Email) DeepCopyInto(out *Email)

DeepCopyInto copies the receiver and writes its value into out.

func (Email) MarshalBSON added in v0.19.2

func (e Email) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (Email) MarshalJSON

func (e Email) MarshalJSON() ([]byte, error)

MarshalJSON returns the Email as JSON

func (Email) MarshalText

func (e Email) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*Email) Scan

func (e *Email) Scan(raw interface{}) error

Scan read a value from a database driver

func (Email) String

func (e Email) String() string

func (*Email) UnmarshalBSON added in v0.19.2

func (e *Email) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*Email) UnmarshalJSON

func (e *Email) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Email from JSON

func (*Email) UnmarshalText

func (e *Email) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (Email) Value

func (e Email) Value() (driver.Value, error)

Value converts a value to a database driver value

type Format

type Format interface {
	String() string
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

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).

type HexColor

type HexColor string

HexColor represents a hex color string format

swagger:strfmt hexcolor

func (*HexColor) DeepCopy added in v0.19.0

func (h *HexColor) DeepCopy() *HexColor

DeepCopy copies the receiver into a new HexColor.

func (*HexColor) DeepCopyInto added in v0.19.0

func (h *HexColor) DeepCopyInto(out *HexColor)

DeepCopyInto copies the receiver and writes its value into out.

func (HexColor) MarshalBSON added in v0.19.2

func (h HexColor) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (HexColor) MarshalJSON

func (h HexColor) MarshalJSON() ([]byte, error)

MarshalJSON returns the HexColor as JSON

func (HexColor) MarshalText

func (h HexColor) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*HexColor) Scan

func (h *HexColor) Scan(raw interface{}) error

Scan read a value from a database driver

func (HexColor) String

func (h HexColor) String() string

func (*HexColor) UnmarshalBSON added in v0.19.2

func (h *HexColor) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*HexColor) UnmarshalJSON

func (h *HexColor) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the HexColor from JSON

func (*HexColor) UnmarshalText

func (h *HexColor) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (HexColor) Value

func (h HexColor) Value() (driver.Value, error)

Value converts a value to a database driver value

type Hostname

type Hostname string

Hostname represents the hostname string format as specified by the json schema spec

swagger:strfmt hostname

func (*Hostname) DeepCopy added in v0.19.0

func (h *Hostname) DeepCopy() *Hostname

DeepCopy copies the receiver into a new Hostname.

func (*Hostname) DeepCopyInto added in v0.19.0

func (h *Hostname) DeepCopyInto(out *Hostname)

DeepCopyInto copies the receiver and writes its value into out.

func (Hostname) MarshalBSON added in v0.19.2

func (h Hostname) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (Hostname) MarshalJSON

func (h Hostname) MarshalJSON() ([]byte, error)

MarshalJSON returns the Hostname as JSON

func (Hostname) MarshalText

func (h Hostname) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*Hostname) Scan

func (h *Hostname) Scan(raw interface{}) error

Scan read a value from a database driver

func (Hostname) String

func (h Hostname) String() string

func (*Hostname) UnmarshalBSON added in v0.19.2

func (h *Hostname) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*Hostname) UnmarshalJSON

func (h *Hostname) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Hostname from JSON

func (*Hostname) UnmarshalText

func (h *Hostname) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (Hostname) Value

func (h Hostname) Value() (driver.Value, error)

Value converts a value to a database driver value

type IPv4

type IPv4 string

IPv4 represents an IP v4 address

swagger:strfmt ipv4

func (*IPv4) DeepCopy added in v0.19.0

func (u *IPv4) DeepCopy() *IPv4

DeepCopy copies the receiver into a new IPv4.

func (*IPv4) DeepCopyInto added in v0.19.0

func (u *IPv4) DeepCopyInto(out *IPv4)

DeepCopyInto copies the receiver and writes its value into out.

func (IPv4) MarshalBSON added in v0.19.2

func (u IPv4) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (IPv4) MarshalJSON

func (u IPv4) MarshalJSON() ([]byte, error)

MarshalJSON returns the IPv4 as JSON

func (IPv4) MarshalText

func (u IPv4) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*IPv4) Scan

func (u *IPv4) Scan(raw interface{}) error

Scan read a value from a database driver

func (IPv4) String

func (u IPv4) String() string

func (*IPv4) UnmarshalBSON added in v0.19.2

func (u *IPv4) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*IPv4) UnmarshalJSON

func (u *IPv4) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the IPv4 from JSON

func (*IPv4) UnmarshalText

func (u *IPv4) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (IPv4) Value

func (u IPv4) Value() (driver.Value, error)

Value converts a value to a database driver value

type IPv6

type IPv6 string

IPv6 represents an IP v6 address

swagger:strfmt ipv6

func (*IPv6) DeepCopy added in v0.19.0

func (u *IPv6) DeepCopy() *IPv6

DeepCopy copies the receiver into a new IPv6.

func (*IPv6) DeepCopyInto added in v0.19.0

func (u *IPv6) DeepCopyInto(out *IPv6)

DeepCopyInto copies the receiver and writes its value into out.

func (IPv6) MarshalBSON added in v0.19.2

func (u IPv6) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (IPv6) MarshalJSON

func (u IPv6) MarshalJSON() ([]byte, error)

MarshalJSON returns the IPv6 as JSON

func (IPv6) MarshalText

func (u IPv6) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*IPv6) Scan

func (u *IPv6) Scan(raw interface{}) error

Scan read a value from a database driver

func (IPv6) String

func (u IPv6) String() string

func (*IPv6) UnmarshalBSON added in v0.19.2

func (u *IPv6) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*IPv6) UnmarshalJSON

func (u *IPv6) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the IPv6 from JSON

func (*IPv6) UnmarshalText

func (u *IPv6) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (IPv6) Value

func (u IPv6) Value() (driver.Value, error)

Value converts a value to a database driver value

type ISBN

type ISBN string

ISBN represents an isbn string format

swagger:strfmt isbn

func (*ISBN) DeepCopy added in v0.19.0

func (u *ISBN) DeepCopy() *ISBN

DeepCopy copies the receiver into a new ISBN.

func (*ISBN) DeepCopyInto added in v0.19.0

func (u *ISBN) DeepCopyInto(out *ISBN)

DeepCopyInto copies the receiver and writes its value into out.

func (ISBN) MarshalBSON added in v0.19.2

func (u ISBN) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (ISBN) MarshalJSON

func (u ISBN) MarshalJSON() ([]byte, error)

MarshalJSON returns the ISBN as JSON

func (ISBN) MarshalText

func (u ISBN) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*ISBN) Scan

func (u *ISBN) Scan(raw interface{}) error

Scan read a value from a database driver

func (ISBN) String

func (u ISBN) String() string

func (*ISBN) UnmarshalBSON added in v0.19.2

func (u *ISBN) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*ISBN) UnmarshalJSON

func (u *ISBN) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the ISBN from JSON

func (*ISBN) UnmarshalText

func (u *ISBN) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (ISBN) Value

func (u ISBN) Value() (driver.Value, error)

Value converts a value to a database driver value

type ISBN10

type ISBN10 string

ISBN10 represents an isbn 10 string format

swagger:strfmt isbn10

func (*ISBN10) DeepCopy added in v0.19.0

func (u *ISBN10) DeepCopy() *ISBN10

DeepCopy copies the receiver into a new ISBN10.

func (*ISBN10) DeepCopyInto added in v0.19.0

func (u *ISBN10) DeepCopyInto(out *ISBN10)

DeepCopyInto copies the receiver and writes its value into out.

func (ISBN10) MarshalBSON added in v0.19.2

func (u ISBN10) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (ISBN10) MarshalJSON

func (u ISBN10) MarshalJSON() ([]byte, error)

MarshalJSON returns the ISBN10 as JSON

func (ISBN10) MarshalText

func (u ISBN10) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*ISBN10) Scan

func (u *ISBN10) Scan(raw interface{}) error

Scan read a value from a database driver

func (ISBN10) String

func (u ISBN10) String() string

func (*ISBN10) UnmarshalBSON added in v0.19.2

func (u *ISBN10) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*ISBN10) UnmarshalJSON

func (u *ISBN10) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the ISBN10 from JSON

func (*ISBN10) UnmarshalText

func (u *ISBN10) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (ISBN10) Value

func (u ISBN10) Value() (driver.Value, error)

Value converts a value to a database driver value

type ISBN13

type ISBN13 string

ISBN13 represents an isbn 13 string format

swagger:strfmt isbn13

func (*ISBN13) DeepCopy added in v0.19.0

func (u *ISBN13) DeepCopy() *ISBN13

DeepCopy copies the receiver into a new ISBN13.

func (*ISBN13) DeepCopyInto added in v0.19.0

func (u *ISBN13) DeepCopyInto(out *ISBN13)

DeepCopyInto copies the receiver and writes its value into out.

func (ISBN13) MarshalBSON added in v0.19.2

func (u ISBN13) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (ISBN13) MarshalJSON

func (u ISBN13) MarshalJSON() ([]byte, error)

MarshalJSON returns the ISBN13 as JSON

func (ISBN13) MarshalText

func (u ISBN13) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*ISBN13) Scan

func (u *ISBN13) Scan(raw interface{}) error

Scan read a value from a database driver

func (ISBN13) String

func (u ISBN13) String() string

func (*ISBN13) UnmarshalBSON added in v0.19.2

func (u *ISBN13) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*ISBN13) UnmarshalJSON

func (u *ISBN13) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the ISBN13 from JSON

func (*ISBN13) UnmarshalText

func (u *ISBN13) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (ISBN13) Value

func (u ISBN13) Value() (driver.Value, error)

Value converts a value to a database driver value

type MAC

type MAC string

MAC represents a 48 bit MAC address

swagger:strfmt mac

func (*MAC) DeepCopy added in v0.19.0

func (u *MAC) DeepCopy() *MAC

DeepCopy copies the receiver into a new MAC.

func (*MAC) DeepCopyInto added in v0.19.0

func (u *MAC) DeepCopyInto(out *MAC)

DeepCopyInto copies the receiver and writes its value into out.

func (MAC) MarshalBSON added in v0.19.2

func (u MAC) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (MAC) MarshalJSON

func (u MAC) MarshalJSON() ([]byte, error)

MarshalJSON returns the MAC as JSON

func (MAC) MarshalText

func (u MAC) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*MAC) Scan

func (u *MAC) Scan(raw interface{}) error

Scan read a value from a database driver

func (MAC) String

func (u MAC) String() string

func (*MAC) UnmarshalBSON added in v0.19.2

func (u *MAC) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*MAC) UnmarshalJSON

func (u *MAC) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the MAC from JSON

func (*MAC) UnmarshalText

func (u *MAC) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (MAC) Value

func (u MAC) Value() (driver.Value, error)

Value converts a value to a database driver value

type NameNormalizer

type NameNormalizer func(string) string

NameNormalizer is a function that normalizes a format name.

type ObjectId

type ObjectId bsonprim.ObjectID //nolint:revive,stylecheck

ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID)

swagger:strfmt bsonobjectid

func NewObjectId

func NewObjectId(hex string) ObjectId

NewObjectId creates a ObjectId from a Hex String

func (*ObjectId) DeepCopy added in v0.19.0

func (id *ObjectId) DeepCopy() *ObjectId

DeepCopy copies the receiver into a new ObjectId.

func (*ObjectId) DeepCopyInto added in v0.19.0

func (id *ObjectId) DeepCopyInto(out *ObjectId)

DeepCopyInto copies the receiver and writes its value into out.

func (ObjectId) MarshalBSON added in v0.19.2

func (id ObjectId) MarshalBSON() ([]byte, error)

MarshalBSON renders the object id as a BSON document

func (ObjectId) MarshalBSONValue added in v0.19.2

func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error)

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.

func (ObjectId) MarshalJSON

func (id ObjectId) MarshalJSON() ([]byte, error)

MarshalJSON returns the ObjectId as JSON

func (ObjectId) MarshalText

func (id ObjectId) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*ObjectId) Scan

func (id *ObjectId) Scan(raw interface{}) error

Scan read a value from a database driver

func (ObjectId) String

func (id ObjectId) String() string

func (*ObjectId) UnmarshalBSON added in v0.19.2

func (id *ObjectId) UnmarshalBSON(data []byte) error

UnmarshalBSON reads the objectId from a BSON document

func (*ObjectId) UnmarshalBSONValue added in v0.19.2

func (id *ObjectId) UnmarshalBSONValue(_ bsontype.Type, data []byte) error

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.

func (*ObjectId) UnmarshalJSON

func (id *ObjectId) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the ObjectId from JSON

func (*ObjectId) UnmarshalText

func (id *ObjectId) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (ObjectId) Value

func (id ObjectId) Value() (driver.Value, error)

Value converts a value to a database driver value

type Password

type Password string

Password represents a password. This has no validations and is mainly used as a marker for UI components.

swagger:strfmt password

func (*Password) DeepCopy added in v0.19.0

func (r *Password) DeepCopy() *Password

DeepCopy copies the receiver into a new Password.

func (*Password) DeepCopyInto added in v0.19.0

func (r *Password) DeepCopyInto(out *Password)

DeepCopyInto copies the receiver and writes its value into out.

func (Password) MarshalBSON added in v0.19.2

func (r Password) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (Password) MarshalJSON

func (r Password) MarshalJSON() ([]byte, error)

MarshalJSON returns the Password as JSON

func (Password) MarshalText

func (r Password) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*Password) Scan

func (r *Password) Scan(raw interface{}) error

Scan read a value from a database driver

func (Password) String

func (r Password) String() string

func (*Password) UnmarshalBSON added in v0.19.2

func (r *Password) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*Password) UnmarshalJSON

func (r *Password) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the Password from JSON

func (*Password) UnmarshalText

func (r *Password) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (Password) Value

func (r Password) Value() (driver.Value, error)

Value converts a value to a database driver value

type RGBColor

type RGBColor string

RGBColor represents a RGB color string format

swagger:strfmt rgbcolor

func (*RGBColor) DeepCopy added in v0.19.0

func (r *RGBColor) DeepCopy() *RGBColor

DeepCopy copies the receiver into a new RGBColor.

func (*RGBColor) DeepCopyInto added in v0.19.0

func (r *RGBColor) DeepCopyInto(out *RGBColor)

DeepCopyInto copies the receiver and writes its value into out.

func (RGBColor) MarshalBSON added in v0.19.2

func (r RGBColor) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (RGBColor) MarshalJSON

func (r RGBColor) MarshalJSON() ([]byte, error)

MarshalJSON returns the RGBColor as JSON

func (RGBColor) MarshalText

func (r RGBColor) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*RGBColor) Scan

func (r *RGBColor) Scan(raw interface{}) error

Scan read a value from a database driver

func (RGBColor) String

func (r RGBColor) String() string

func (*RGBColor) UnmarshalBSON added in v0.19.2

func (r *RGBColor) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*RGBColor) UnmarshalJSON

func (r *RGBColor) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the RGBColor from JSON

func (*RGBColor) UnmarshalText

func (r *RGBColor) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (RGBColor) Value

func (r RGBColor) Value() (driver.Value, error)

Value converts a value to a database driver value

type Registry

type Registry interface {
	Add(string, Format, Validator) bool
	DelByName(string) bool
	GetType(string) (reflect.Type, bool)
	ContainsName(string) bool
	Validates(string, string) bool
	Parse(string, string) (interface{}, error)
	MapStructureHookFunc() mapstructure.DecodeHookFunc
}

Registry is a registry of string formats, with a validation method.

func NewFormats

func NewFormats() Registry

NewFormats creates a new formats registry seeded with the values from the default

func NewSeededFormats

func NewSeededFormats(seeds []knownFormat, normalizer NameNormalizer) Registry

NewSeededFormats creates a new formats registry

type SSN

type SSN string

SSN represents a social security string format

swagger:strfmt ssn

func (*SSN) DeepCopy added in v0.19.0

func (u *SSN) DeepCopy() *SSN

DeepCopy copies the receiver into a new SSN.

func (*SSN) DeepCopyInto added in v0.19.0

func (u *SSN) DeepCopyInto(out *SSN)

DeepCopyInto copies the receiver and writes its value into out.

func (SSN) MarshalBSON added in v0.19.2

func (u SSN) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (SSN) MarshalJSON

func (u SSN) MarshalJSON() ([]byte, error)

MarshalJSON returns the SSN as JSON

func (SSN) MarshalText

func (u SSN) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*SSN) Scan

func (u *SSN) Scan(raw interface{}) error

Scan read a value from a database driver

func (SSN) String

func (u SSN) String() string

func (*SSN) UnmarshalBSON added in v0.19.2

func (u *SSN) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*SSN) UnmarshalJSON

func (u *SSN) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the SSN from JSON

func (*SSN) UnmarshalText

func (u *SSN) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (SSN) Value

func (u SSN) Value() (driver.Value, error)

Value converts a value to a database driver value

type ULID added in v0.20.1

type ULID struct {
	ulid.ULID
}

ULID represents a ulid string format ref:

https://github.com/ulid/spec

impl:

https://github.com/oklog/ulid

swagger:strfmt ulid

func NewULID added in v0.20.1

func NewULID() (ULID, error)

NewULID generates new unique ULID value and a error if any

func NewULIDZero added in v0.20.1

func NewULIDZero() ULID

NewULIDZero returns a zero valued ULID type

func ParseULID added in v0.20.1

func ParseULID(str string) (ULID, error)

ParseULID parses a string that represents an valid ULID

func (*ULID) DeepCopy added in v0.20.1

func (u *ULID) DeepCopy() *ULID

DeepCopy copies the receiver into a new ULID.

func (*ULID) DeepCopyInto added in v0.20.1

func (u *ULID) DeepCopyInto(out *ULID)

DeepCopyInto copies the receiver and writes its value into out.

func (ULID) Equal added in v0.20.1

func (u ULID) Equal(other ULID) bool

Equal checks if two ULID instances are equal by their underlying type

func (*ULID) GetULID added in v0.20.1

func (u *ULID) GetULID() interface{}

GetULID returns underlying instance of ULID

func (*ULID) GobDecode added in v0.20.1

func (u *ULID) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (ULID) GobEncode added in v0.20.1

func (u ULID) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (ULID) MarshalBSON added in v0.20.1

func (u ULID) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (ULID) MarshalBinary added in v0.20.1

func (u ULID) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (ULID) MarshalJSON added in v0.20.1

func (u ULID) MarshalJSON() ([]byte, error)

MarshalJSON returns the ULID as JSON

func (ULID) MarshalText added in v0.20.1

func (u ULID) MarshalText() ([]byte, error)

MarshalText returns this instance into text

func (*ULID) Scan added in v0.20.1

func (u *ULID) Scan(raw interface{}) error

Scan reads a value from a database driver

func (ULID) String added in v0.20.1

func (u ULID) String() string

func (*ULID) UnmarshalBSON added in v0.20.1

func (u *ULID) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*ULID) UnmarshalBinary added in v0.20.1

func (u *ULID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*ULID) UnmarshalJSON added in v0.20.1

func (u *ULID) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the ULID from JSON

func (*ULID) UnmarshalText added in v0.20.1

func (u *ULID) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (ULID) Value added in v0.20.1

func (u ULID) Value() (driver.Value, error)

Value converts a value to a database driver value

type URI

type URI string

URI represents the uri string format as specified by the json schema spec

swagger:strfmt uri

func (*URI) DeepCopy added in v0.19.0

func (u *URI) DeepCopy() *URI

DeepCopy copies the receiver into a new URI.

func (*URI) DeepCopyInto added in v0.19.0

func (u *URI) DeepCopyInto(out *URI)

DeepCopyInto copies the receiver and writes its value into out.

func (URI) MarshalBSON added in v0.19.2

func (u URI) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (URI) MarshalJSON

func (u URI) MarshalJSON() ([]byte, error)

MarshalJSON returns the URI as JSON

func (URI) MarshalText

func (u URI) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*URI) Scan

func (u *URI) Scan(raw interface{}) error

Scan read a value from a database driver

func (URI) String

func (u URI) String() string

func (*URI) UnmarshalBSON added in v0.19.2

func (u *URI) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*URI) UnmarshalJSON

func (u *URI) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the URI from JSON

func (*URI) UnmarshalText

func (u *URI) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (URI) Value

func (u URI) Value() (driver.Value, error)

Value converts a value to a database driver value

type UUID

type UUID string

UUID represents a uuid string format

swagger:strfmt uuid

func (*UUID) DeepCopy added in v0.19.0

func (u *UUID) DeepCopy() *UUID

DeepCopy copies the receiver into a new UUID.

func (*UUID) DeepCopyInto added in v0.19.0

func (u *UUID) DeepCopyInto(out *UUID)

DeepCopyInto copies the receiver and writes its value into out.

func (UUID) MarshalBSON added in v0.19.2

func (u UUID) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

MarshalJSON returns the UUID as JSON

func (UUID) MarshalText

func (u UUID) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*UUID) Scan

func (u *UUID) Scan(raw interface{}) error

Scan read a value from a database driver

func (UUID) String

func (u UUID) String() string

func (*UUID) UnmarshalBSON added in v0.19.2

func (u *UUID) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the UUID from JSON

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

Value converts a value to a database driver value

type UUID3

type UUID3 string

UUID3 represents a uuid3 string format

swagger:strfmt uuid3

func (*UUID3) DeepCopy added in v0.19.0

func (u *UUID3) DeepCopy() *UUID3

DeepCopy copies the receiver into a new UUID3.

func (*UUID3) DeepCopyInto added in v0.19.0

func (u *UUID3) DeepCopyInto(out *UUID3)

DeepCopyInto copies the receiver and writes its value into out.

func (UUID3) MarshalBSON added in v0.19.2

func (u UUID3) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (UUID3) MarshalJSON

func (u UUID3) MarshalJSON() ([]byte, error)

MarshalJSON returns the UUID as JSON

func (UUID3) MarshalText

func (u UUID3) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*UUID3) Scan

func (u *UUID3) Scan(raw interface{}) error

Scan read a value from a database driver

func (UUID3) String

func (u UUID3) String() string

func (*UUID3) UnmarshalBSON added in v0.19.2

func (u *UUID3) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*UUID3) UnmarshalJSON

func (u *UUID3) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the UUID from JSON

func (*UUID3) UnmarshalText

func (u *UUID3) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (UUID3) Value

func (u UUID3) Value() (driver.Value, error)

Value converts a value to a database driver value

type UUID4

type UUID4 string

UUID4 represents a uuid4 string format

swagger:strfmt uuid4

func (*UUID4) DeepCopy added in v0.19.0

func (u *UUID4) DeepCopy() *UUID4

DeepCopy copies the receiver into a new UUID4.

func (*UUID4) DeepCopyInto added in v0.19.0

func (u *UUID4) DeepCopyInto(out *UUID4)

DeepCopyInto copies the receiver and writes its value into out.

func (UUID4) MarshalBSON added in v0.19.2

func (u UUID4) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (UUID4) MarshalJSON

func (u UUID4) MarshalJSON() ([]byte, error)

MarshalJSON returns the UUID as JSON

func (UUID4) MarshalText

func (u UUID4) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*UUID4) Scan

func (u *UUID4) Scan(raw interface{}) error

Scan read a value from a database driver

func (UUID4) String

func (u UUID4) String() string

func (*UUID4) UnmarshalBSON added in v0.19.2

func (u *UUID4) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*UUID4) UnmarshalJSON

func (u *UUID4) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the UUID from JSON

func (*UUID4) UnmarshalText

func (u *UUID4) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (UUID4) Value

func (u UUID4) Value() (driver.Value, error)

Value converts a value to a database driver value

type UUID5

type UUID5 string

UUID5 represents a uuid5 string format

swagger:strfmt uuid5

func (*UUID5) DeepCopy added in v0.19.0

func (u *UUID5) DeepCopy() *UUID5

DeepCopy copies the receiver into a new UUID5.

func (*UUID5) DeepCopyInto added in v0.19.0

func (u *UUID5) DeepCopyInto(out *UUID5)

DeepCopyInto copies the receiver and writes its value into out.

func (UUID5) MarshalBSON added in v0.19.2

func (u UUID5) MarshalBSON() ([]byte, error)

MarshalBSON document from this value

func (UUID5) MarshalJSON

func (u UUID5) MarshalJSON() ([]byte, error)

MarshalJSON returns the UUID as JSON

func (UUID5) MarshalText

func (u UUID5) MarshalText() ([]byte, error)

MarshalText turns this instance into text

func (*UUID5) Scan

func (u *UUID5) Scan(raw interface{}) error

Scan read a value from a database driver

func (UUID5) String

func (u UUID5) String() string

func (*UUID5) UnmarshalBSON added in v0.19.2

func (u *UUID5) UnmarshalBSON(data []byte) error

UnmarshalBSON document into this value

func (*UUID5) UnmarshalJSON

func (u *UUID5) UnmarshalJSON(data []byte) error

UnmarshalJSON sets the UUID from JSON

func (*UUID5) UnmarshalText

func (u *UUID5) UnmarshalText(data []byte) error

UnmarshalText hydrates this instance from text

func (UUID5) Value

func (u UUID5) Value() (driver.Value, error)

Value converts a value to a database driver value

type Validator

type Validator func(string) bool

Validator represents a validator for a string format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL