Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackendGetterV2 ¶ added in v1.0.1
func BackendGetterV2[C any, T pointerMessage[C]](f func(ctx context.Context, key string) (T, error)) galaxycache.BackendGetter
BackendGetterV2 is an adapter that implements galaxycache.BackendGetter (it wraps an unexported type because type-inference is much better on function-calls)
func GalaxyGet ¶ added in v1.0.1
func GalaxyGet[C any, T pointerMessage[C]](ctx context.Context, g *galaxycache.Galaxy, key string) (T, error)
GalaxyGet is a simple wrapper around a Galaxy.Get method-call that takes care of constructing the protocodec.CodecV2, etc. (making the interface more idiomatic for Go)
Types ¶
type CodecV2 ¶
type CodecV2[C any, T pointerMessage[C]] struct { // contains filtered or unexported fields }
CodecV2 wraps a google.golang.org/protobuf/proto.Message and implements Codec
func NewV2 ¶
NewV2 constructs a CodecV2 zero-value. It exists because type-parameter inference is nicer with function-calls than struct-literals
func (*CodecV2[C, T]) Get ¶
func (c *CodecV2[C, T]) Get() T
Get implies returns the internal protobuf message value
func (*CodecV2[C, T]) MarshalBinary ¶
MarshalBinary on a ProtoCodec returns the encoded proto message
func (*CodecV2[C, T]) Set ¶
func (c *CodecV2[C, T]) Set(v T)
Set bypasses Marshaling and lets you set the internal protobuf value
func (*CodecV2[C, T]) UnmarshalBinary ¶
UnmarshalBinary on a ProtoCodec unmarshals provided data into the proto message
type ProtoCodec ¶
ProtoCodec wraps a proto.Message and implements Codec
func (*ProtoCodec) MarshalBinary ¶
func (c *ProtoCodec) MarshalBinary() ([]byte, error)
MarshalBinary on a ProtoCodec returns the encoded proto message
func (*ProtoCodec) UnmarshalBinary ¶
func (c *ProtoCodec) UnmarshalBinary(data []byte) error
UnmarshalBinary on a ProtoCodec unmarshals provided data into the proto message