codec

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSchemaIDOverrides

func BuildSchemaIDOverrides(files []*ast.File, info *types.Info, pkg *types.Package) map[string]string

BuildSchemaIDOverrides scans VangoSchemaID() methods that return a string literal or const and returns a map keyed by fully-qualified type name.

func CanonicalTypeString

func CanonicalTypeString(t types.Type) string

CanonicalTypeString returns the canonical type string used for schema fallback IDs.

func ParseFingerprint

func ParseFingerprint(fp string) (codecID CodecID, version CodecVersion, hash string, err error)

ParseFingerprint extracts components from a fingerprint string.

func ResolveSchemaID

func ResolveSchemaID(typeExpr string, overrides map[string]string) (schemaID string, ok bool)

ResolveSchemaID returns the schema ID for a type using a precomputed override map. If an override exists (from VangoSchemaID), return it with ok=true. Otherwise return the fully-qualified type name and ok=false.

func ResolveSchemaIDForType

func ResolveSchemaIDForType(t types.Type, overrides map[string]string) (schemaID string, ok bool)

ResolveSchemaIDForType returns the schema ID for a type using canonical formatting.

Types

type CodecID

type CodecID string

CodecID identifies the serialization codec.

const (
	CodecCBOR CodecID = "cbor"
	CodecJSON CodecID = "json"
)

type CodecVersion

type CodecVersion string

CodecVersion is the codec version string.

const (
	CodecVersionV1 CodecVersion = "v1"
	CodecVersionV2 CodecVersion = "v2"
)

type FingerprintCalculator

type FingerprintCalculator struct {
	// contains filtered or unexported fields
}

FingerprintCalculator computes codec fingerprints for types.

func NewFingerprintCalculator

func NewFingerprintCalculator() *FingerprintCalculator

NewFingerprintCalculator creates a fingerprint calculator.

func (*FingerprintCalculator) Calculate

func (c *FingerprintCalculator) Calculate(schemaID string) (string, error)

Calculate computes the codec fingerprint for a schema ID. fingerprint = hash(CodecID + CodecVersion + SchemaID)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL