Documentation
¶
Index ¶
- Variables
- func BytesSize(n uint64) string
- 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 ContentType
- func (ct ContentType) Bytes() []byte
- func (ct ContentType) Marshal(data any) (io.Reader, error)
- func (ct ContentType) MarshalJSON() ([]byte, error)
- func (ct ContentType) String() string
- func (ct ContentType) Unmarshal(r io.Reader, out any) error
- func (ct *ContentType) UnmarshalJSON(data []byte) error
- func (ct ContentType) Validate() bool
- type DateTime
- type Map
- func (m Map[T]) AsString(key string) string
- 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]) Value() (driver.Value, error)
- func (m Map[T]) Values() (values []T)
- type Type
- type URI
Constants ¶
This section is empty.
Variables ¶
var ( ContentTypeNames = map[ContentType]string{ ContentTypeJson: "application/json", ContentTypeMsgPack: "application/msgpack", ContentTypeYaml: "application/yaml", ContentTypeHtml: "text/html", ContentTypeFormUrlEncoded: "application/x-www-form-urlencoded", ContentTypePlain: "text/plain", } )
var ( TypeNames = map[Type]string{ TypeBoolean: "Boolean", TypeDateTime: "DateTime", TypeFloat: "Float", TypeID: "ID", TypeInteger: "Integer", TypeString: "String", } )
Functions ¶
func ConflictKeys ¶
ConflictKeys returns a map of conflicting keys between the two maps.
Types ¶
type ContentType ¶
type ContentType uint8
ContentType represents the event data mime type.
const ( ContentTypeInvalid ContentType = iota // ContentTypeJson ContentTypeMsgPack ContentTypeYaml ContentTypeHtml ContentTypeFormUrlEncoded ContentTypePlain )
func ParseContentType ¶
func ParseContentType(value string) ContentType
ParseContentType parses ContentType from string.
func (ContentType) Bytes ¶
func (ct ContentType) Bytes() []byte
Bytes returns the ContentType as a []byte.
func (ContentType) MarshalJSON ¶
MarshalJSON outputs the ContentType as a json.
func (ContentType) String ¶
func (ct ContentType) String() string
String outputs the ContentType as a string.
func (*ContentType) UnmarshalJSON ¶
UnmarshalJSON parses ContentType from json.
type DateTime ¶
DateTime represents the date and time using RFC3339 format.
func ParseTimestamp ¶
ParseTimestamp parses DateTime from string.
func (DateTime) MarshalJSON ¶
MarshalJSON outputs the DateTime as a json.
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON parses DateTime from json.
type Map ¶
Map defines a map of key:value. It implements Map.
type Type ¶
type Type uint8
Type represents the event type.
const ( TypeInvalid Type = iota // TypeBoolean TypeDateTime TypeFloat TypeID TypeInteger TypeString )
func (Type) MarshalJSON ¶
MarshalJSON outputs the Type as a json.
func (*Type) UnmarshalJSON ¶
UnmarshalJSON parses Type from json.
type URI ¶
URI represents the URI.
func (URI) MarshalJSON ¶
MarshalJSON outputs the URI as a json.
func (*URI) UnmarshalJSON ¶
UnmarshalJSON parses URI from json.