Documentation
¶
Index ¶
- Constants
- type Store
- func (s Store) Bytes() []byte
- func (s Store) CreateAt() uint64
- func (s Store) Int() (int, error)
- func (s Store) JSON(dest interface{}) error
- func (s Store) Length(all ...bool) uint64
- func (s Store) MaxAge() uint64
- func (s Store) SetLength(length uint64) Store
- func (s Store) SetMaxAge(maxAge uint64) Store
- func (s Store) SetUpdateAt(date uint64) Store
- func (s Store) Text() string
- func (s Store) UpdateAt() uint64
- func (s Store) Values() []byte
Constants ¶
const ( CreateAtIndex = 0 UpdateAtIndex = 8 MaxAgeIndex = 16 LengthIndex = 24 DataStartIndex = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store []byte
Store is a compact binary blob that prefixes the payload with metadata:
[0..7] : createdAt (unix milli) [8..15] : updatedAt (unix milli) [16..23] : maxAge (user-defined units) [24..31] : payload length (bytes) [32..] : payload bytes
This format is intended for simple binary serialization of values.
func NewStore ¶
NewStore builds a Store with the given payload and optional maxAge. maxAge is a metadata field and not interpreted by Store.
func ParseStore ¶
ParseStore validates the minimum length and returns a Store view over data. Returns an empty Store if the input is invalid.
func (Store) Int ¶
Int interprets the payload as a big‑endian unsigned 64‑bit integer and returns it as int. Returns an error if the payload is too small.
func (Store) Length ¶
Length returns the payload length in bytes. If all=true, returns total store length.
func (Store) SetUpdateAt ¶
SetUpdateAt sets the last update timestamp and returns the mutated store.