model

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTypeFieldRequired = errors.New("type field path is required")
	ErrTypeFieldNotFound = errors.New("type field not found")
	ErrTypeFieldNotStr   = errors.New("type field is not a string")
	ErrNoRegistryEntry   = errors.New("no registry entry for type")
)

Functions

func DefaultCleaner

func DefaultCleaner(m map[string]any) map[string]any

func Parse

func Parse[T any](raw []byte, opts ...Option) (*T, error)

func ParseByType

func ParseByType(raw []byte, fieldPath string, registry Registry, opts ...Option) (any, error)

func ParseInto

func ParseInto(raw []byte, out any, opts ...Option) error

Types

type Cleaner

type Cleaner func(map[string]any) map[string]any

type Option

type Option func(*parser)

func WithCleaner

func WithCleaner(cleaner Cleaner) Option

type Registry

type Registry map[string]func() any

func NewRegistry

func NewRegistry() Registry

func (Registry) Register

func (r Registry) Register(name string, ctor func() any)

Jump to

Keyboard shortcuts

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