Documentation
¶
Overview ¶
Package atom provides type-segregated atomic value storage.
Index ¶
- Variables
- type Atomize
- type Atomizer
- func (a *Atomizer[T]) Atomize(obj *T) (Atoms, error)
- func (a *Atomizer[T]) Deatomize(atoms Atoms) (*T, error)
- func (a *Atomizer[T]) Fields() []FieldDescriptor
- func (a *Atomizer[T]) FieldsIn(table TableType) []string
- func (a *Atomizer[T]) Metadata() sentinel.Metadata
- func (a *Atomizer[T]) TableFor(field string) (TableType, bool)
- type Atoms
- type Deatomize
- type FieldDescriptor
- type TableType
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDecode indicates decoding failed. ErrDecode = errors.New("atom: decoding failed") // ErrMissingID indicates the Atoms.ID field is empty. ErrMissingID = errors.New("atom: missing ID in atoms") )
Functions ¶
This section is empty.
Types ¶
type Atomizer ¶
type Atomizer[T Validator] struct { // contains filtered or unexported fields }
Atomizer provides typed bidirectional resolution for any type T. T must implement Validator to ensure data integrity before storage.
func New ¶
New creates an Atomizer for type T using the provided callbacks. Inspects T at construction time to build field metadata.
func (*Atomizer[T]) Fields ¶
func (a *Atomizer[T]) Fields() []FieldDescriptor
Fields returns all field descriptors.
type Atoms ¶
type Atoms struct {
ID string
Strings map[string]string
Ints map[string]int64
Floats map[string]float64
Bools map[string]bool
Times map[string]time.Time
}
Atoms holds decomposed atomic values by type.
type FieldDescriptor ¶
FieldDescriptor maps a field name to its storage table.
type TableType ¶
type TableType string
TableType identifies the segregated storage table for atomic values.
Click to show internal directories.
Click to hide internal directories.