Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveSchemaID ¶
ResolveSchemaID returns the schema ID for a type. If the type implements VangoSchema, uses that; otherwise uses the fully-qualified Go type name.
func ResolveSchemaIDForValue ¶
ResolveSchemaIDForValue returns the schema ID for a value.
Types ¶
type Codec ¶
type Codec interface {
ID() CodecID
Version() CodecVersion
Encode(v any) ([]byte, error)
Decode(data []byte, v any) error
}
Codec encodes and decodes values.
func NewCBORCodec ¶
func NewCBORCodec() Codec
NewCBORCodec creates the default CBOR codec. VersionV2 preserves nil container semantics (nil != empty) and therefore intentionally changes persisted fingerprints, requiring cold deploy handling.
type CodecVersion ¶
type CodecVersion string
CodecVersion tracks format changes within a codec.
const ( VersionV1 CodecVersion = "v1" VersionV2 CodecVersion = "v2" )
type Fingerprint ¶
type Fingerprint [32]byte
Fingerprint uniquely identifies a type's serialization format. It is computed as SHA256(CodecID + ":" + CodecVersion + ":" + SchemaID).
func ComputeFingerprint ¶
func ComputeFingerprint(codecID CodecID, version CodecVersion, schemaID string) Fingerprint
ComputeFingerprint calculates a fingerprint for a type.
func ParseFingerprint ¶
func ParseFingerprint(s string) (Fingerprint, error)
ParseFingerprint parses a fingerprint string. Accepts "fp:v1:<hex>" where <hex> is 64 lowercase hex chars.
func (Fingerprint) String ¶
func (f Fingerprint) String() string
String returns the hex representation with prefix.
type VangoSchema ¶
type VangoSchema interface {
VangoSchemaID() string
}
VangoSchema allows types to provide explicit schema identifiers. This is recommended for persisted state to survive type renames.