Documentation ¶
Index ¶
- Variables
- func ConflictKeys[T any](a, b Map[T]) (conflicts []string)
- func DiffKeys[T any](a, b Map[T]) (added, removed []string)
- func Equal(a, b any) bool
- func Less(a, b any) bool
- func More(a, b any) bool
- func NotEqual(a, b any) bool
- type IModel
- type Kind
- type Map
- func (m Map[T]) Clear()
- func (m Map[T]) Clone() Map[T]
- func (m Map[T]) Delete(key string)
- func (m Map[T]) Get(key string) T
- func (m Map[T]) Has(key string) bool
- func (m Map[T]) IsEmpty() bool
- func (m Map[T]) Keys() (keys []string)
- func (m Map[T]) Len() int
- func (m Map[T]) Merge(maps ...Map[T]) Map[T]
- func (m Map[T]) Range(fn func(key string, value T) bool)
- func (m Map[T]) Set(key string, value T)
- func (m Map[T]) String(sep, join string) string
- func (m Map[T]) Values() (values []T)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KindNames = map[Kind]string{ KindReference: "Reference", KindBoolean: "Boolean", KindDateTime: "Datetime", KindDate: "Date", KindFloat32: "Float32", KindFloat64: "Float64", KindID: "Id", KindInet: "Inet", KindUInt8: "Uint8", KindUInt16: "Uint16", KindUInt32: "Uint32", KindUInt64: "Uint64", KindInt8: "Int8", KindInt16: "Int16", KindInt32: "Int32", KindInt64: "Int64", KindString: "String", KindTime: "Time", } // ErrKindInvalid is returned when the data kind is invalid. ErrKindInvalid = errors.New("invalid data kind") )
Functions ¶
func ConflictKeys ¶ added in v1.2.1
ConflictKeys returns a map of conflicting keys between the two maps.
func DiffKeys ¶ added in v1.2.1
DiffKeys returns a map of added and removed keys between the two maps.
Types ¶
type IModel ¶ added in v1.1.0
type IModel interface { // Validate makes `Model` validatable by implementing [validation.Validatable] interface. Validate() error }
IModel defines a model interface.
type Kind ¶
type Kind uint8
Kind defines a data kind.
const ( KindInvalid Kind = iota + 1 // KindReference // The `reference`scalar kind represents a reference to other structure Columns KindBoolean // The `boolean` scalar kind represents value `true` or `false` KindDateTime // The `datetime` scalar kind represents a date and time pairing in UTC value `2023-01-25 10:10:10` KindDate // The `date` scalar kind represents a date in UTC value `2023-01-25` KindFloat32 // The `float32` scalar kind represents an 32-bit signed double-precision floating-point value '1.2345' KindFloat64 // The `float64` scalar kind represents an 64-bit signed double-precision floating-point value '1.2345' KindID // The `id` scalar kind represents a 128-bit hexadecimal value '7f9c24e8-3b12-4fef-91e0-56a2d5a246ec' KindInet // The `inet` scalar kind represents an IPv4 or IPv6 address value '192.168.0.1' KindUInt8 // The `uint8` scalar kind represents an unsigned 8-bit integers (0 to 255) value '12345' KindUInt16 // The `uint16` scalar kind represents an unsigned 16-bit integers (0 to 65535) value '12345' KindUInt32 // The `uint32` scalar kind represents an unsigned 32-bit integers (0 to 4294967295) value '12345' KindUInt64 // The `uint64` scalar kind represents an unsigned 64-bit integers (0 to 18446744073709551615) value '12345' KindInt8 // The `int8` scalar kind represents a signed 8-bit integers (-128 to 127) value '-12' KindInt16 // The `int16` scalar kind represents a signed 16-bit integers (-32768 to 32767) value '-12' KindInt32 // The `int32` scalar kind represents a signed 32-bit integers (-2147483648 to 2147483647) value '-12' KindInt64 // The `int64` scalar kind represents a signed 64-bit integers (-9223372036854775808 to 9223372036854775807) value '-12' KindString // The `string` scalar kind represents textual data a UTF‐8 character sequence value 'a1b2c3' KindTime // The `time` scalar kind represents a time in UTC value `01:23:45.123456` )
func DetectValueKind ¶
func MustParseKind ¶
MustParseKind parses data kind string or panics.
func (*Kind) UnmarshalJSON ¶
UnmarshalJSON data kind from json
type Map ¶ added in v1.2.1
Map defines a map of key:value. It implements Map.
func ToMap ¶ added in v1.2.1
func ToMap[M ~map[K]T, K comparable, T any](m M) Map[T]
ToMap converts a map to a Map.
Click to show internal directories.
Click to hide internal directories.