Skip to content

package structdecode

import "github.com/cloudboss/unobin/pkg/structdecode"

Package structdecode decodes UB object values into ordinary Go structs.

Functions

func Decode

func Decode(v any, inputs map[string]any) error

Decode fills v's exported fields from inputs using ub struct tags. A field's key is the tag name, or the kebab-cased field name when the tag has no name. String values like "30s" decode into time.Duration fields. v must be a non-nil pointer to a struct.