Documentation
¶
Index ¶
- func DecodeScalar[T any](b []byte) (T, error)
- func EncodeScalar[T any](v T) ([]byte, error)
- type MapCodec
- type MapState
- func (s *MapState[K, V]) All() iter.Seq2[K, V]
- func (s *MapState[K, V]) Delete(key K)
- func (s *MapState[K, V]) Get(key K) (V, bool)
- func (s *MapState[K, V]) Load(entries []internal.StateEntry) error
- func (s *MapState[K, V]) Mutations() ([]internal.StateMutation, error)
- func (s *MapState[K, V]) Name() string
- func (s *MapState[K, V]) Set(key K, value V)
- func (s *MapState[K, V]) Size() int
- type ProtoScalar
- type ScalarValueCodec
- type StateSpec
- type ValueCodec
- type ValueState
- type ValueUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeScalar ¶
DecodeScalar unmarshals bytes into a ProtoScalar value using the appropriate protobuf wrapper.
func EncodeScalar ¶
EncodeScalar marshals a ProtoScalar value into bytes using protobuf wrappers.
Types ¶
type MapState ¶
type MapState[K comparable, V any] struct { // contains filtered or unexported fields }
func NewMapState ¶
func NewMapState[K comparable, V any](name string, codec MapCodec[K, V]) *MapState[K, V]
NewMapState creates a new MapState, applying any provided options.
type ProtoScalar ¶
type ProtoScalar interface {
~int | ~int32 | ~int64 |
~uint | ~uint32 | ~uint64 |
~float32 | ~float64 |
~string |
~bool |
time.Time
}
ProtoScalar represents the go types that can be wrapped by protobuf. The EncodeScaler and DecodeScaler functions use permissive `any` types so that they can work with the caller's types. They will have runtime errors if the types don't match ProtoScalar.
type ScalarValueCodec ¶
type ScalarValueCodec[T ProtoScalar] struct{}
ScalarValueCodec is a codec for simple scalar values using protobuf serialization
func (ScalarValueCodec[T]) Decode ¶
func (c ScalarValueCodec[T]) Decode(b []byte) (T, error)
func (ScalarValueCodec[T]) Encode ¶
func (c ScalarValueCodec[T]) Encode(value T) ([]byte, error)
type StateSpec ¶
type StateSpec[T any] struct { ID string Query internal.QueryType Load func([]internal.StateEntry) (*T, error) Mutations func(*T) ([]internal.StateMutation, error) }
type ValueCodec ¶
type ValueState ¶
type ValueState[T any] struct { // contains filtered or unexported fields }
func NewValueState ¶
func NewValueState[T any](name string, codec ValueCodec[T]) *ValueState[T]
func (*ValueState[T]) Drop ¶
func (s *ValueState[T]) Drop()
func (*ValueState[T]) Load ¶
func (s *ValueState[T]) Load(entries []internal.StateEntry) error
func (*ValueState[T]) Mutations ¶
func (s *ValueState[T]) Mutations() ([]internal.StateMutation, error)
func (*ValueState[T]) Name ¶
func (s *ValueState[T]) Name() string
func (*ValueState[T]) Set ¶
func (s *ValueState[T]) Set(value T)
func (*ValueState[T]) Value ¶
func (s *ValueState[T]) Value() T
type ValueUpdate ¶
Click to show internal directories.
Click to hide internal directories.