Documentation
¶
Index ¶
- Constants
- func BindEntity[T any](e *Entity) (result T, err error)
- func UnmarshalJSONValue(data []byte, valueData []byte, dataType jsonparser.ValueType, offset int) (any, error)
- type Entity
- func (e *Entity) Data() *orderedmap.OrderedMap[string, any]
- func (e *Entity) Delete(name string) *Entity
- func (e *Entity) Empty() bool
- func (e *Entity) First() *orderedmap.Pair[string, any]
- func (e *Entity) Get(name string, defaultValues ...any) any
- func (e *Entity) GetString(name string, defaultValues ...string) string
- func (e *Entity) GetUint64(name string, optional bool) (uint64Value uint64, err error)
- func (e *Entity) ID() uint64
- func (e *Entity) Keys() []string
- func (e *Entity) MarshalJSON() ([]byte, error)
- func (e *Entity) Set(name string, value any) *Entity
- func (e *Entity) SetID(value any) error
- func (e *Entity) String() string
- func (e *Entity) ToJSON() (string, error)
- func (e *Entity) ToMap() map[string]any
- func (e *Entity) UnmarshalJSON(data []byte) (err error)
Constants ¶
View Source
const FieldCreatedAt = "created_at"
View Source
const FieldDeletedAt = "deleted_at"
View Source
const FieldID = "id"
View Source
const FieldUpdatedAt = "updated_at"
Variables ¶
This section is empty.
Functions ¶
func BindEntity ¶
BindEntity binds the fields of the given Entity to a target struct value.
func UnmarshalJSONValue ¶
func UnmarshalJSONValue( data []byte, valueData []byte, dataType jsonparser.ValueType, offset int, ) (any, error)
UnmarshalJSONValue converts json bytes to a Go value.
Types ¶
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func NewEntityFromJSON ¶
NewEntityFromJSON creates a new entity from a JSON string.
func NewEntityFromMap ¶
NewEntityFromMap creates a new entity from a map.
func (*Entity) Data ¶
func (e *Entity) Data() *orderedmap.OrderedMap[string, any]
func (*Entity) First ¶
func (e *Entity) First() *orderedmap.Pair[string, any]
First returns the oldest key/value pair in the entity.
func (*Entity) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Entity) SetID ¶
SetID sets the ID of the entity. if the value is not a valid ID, returns the error.
func (*Entity) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
Click to show internal directories.
Click to hide internal directories.