Documentation
¶
Index ¶
- Variables
- type Attribute
- func Attributes(attrs ...*Attribute) []*Attribute
- func Bool(name string, options ...Option) *Attribute
- func Float(name string, options ...Option) *Attribute
- func Int(name string, options ...Option) *Attribute
- func String(name string, options ...Option) *Attribute
- func StringSlice(name string, options ...Option) *Attribute
- type AttributeValidator
- type Engine
- type NextValidation
- type Node
- func Define(match StringMatch, attrs []*Attribute, children ...*Node) *Node
- func DefineGroup(match string, children ...*Node) *Node
- func DefineIter(attrs []*Attribute, children ...*Node) *Node
- func DefineIterGroup(attrs []*Attribute, children ...*Node) *Node
- func Root(attrs []*Attribute, children ...*Node) *Node
- type ObjectDataType
- type Option
- func Compat(path ...StringMatch) Option
- func Default[T any](val T) Option
- func InSet[T string | int | float64](elms ...T) Option
- func IsCID() Option
- func IsEmail() Option
- func IsFqdn() Option
- func IsHttpMethod() Option
- func IsVariableName() Option
- func Key() Option
- func MinInt(min int) Option
- func Path(path ...StringMatch) Option
- func Required() Option
- func Validator[T any](validator func(T) error) Option
- type Schema
- type SeerOps
- type SeerRef
- type StringMatch
- type StringMatchAll
- type StringMatcher
- type SupportedTypes
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var NodeDefaultSeerLeaf = "config"
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
Name string
Type Type
Required bool
Key bool // means the value is the key of a map
Default any
Path []StringMatch
Compat []StringMatch
Validator AttributeValidator
}
func Attributes ¶
func StringSlice ¶
type AttributeValidator ¶
type Engine ¶
type NextValidation ¶
type NextValidation struct {
Key string `json:"key"` // identifier for the validation (e.g., "domain", "fqdn")
Value any `json:"value"` // value to validate
Validator string `json:"validator"` // validator name (e.g., "dns", "cid")
Context map[string]any `json:"context"` // extra context for validation
}
NextValidation represents a validation that needs to be performed externally. The compiler emits these during compilation, and it's up to the caller to implement and process these validations.
func NewNextValidation ¶
func NewNextValidation(key string, value any, validator string, context map[string]any) NextValidation
NewNextValidation creates a new NextValidation instance.
type Node ¶
type Node struct {
Group bool
Match StringMatch
Attributes []*Attribute
Children []*Node
}
func DefineGroup ¶
func DefineIter ¶
func DefineIterGroup ¶
type ObjectDataType ¶
type Option ¶
type Option func(*Attribute)
func Compat ¶
func Compat(path ...StringMatch) Option
func IsHttpMethod ¶
func IsHttpMethod() Option
func IsVariableName ¶
func IsVariableName() Option
func Path ¶
func Path(path ...StringMatch) Option
type Schema ¶
func SchemaDefinition ¶
type StringMatch ¶
type StringMatch any // string or PathMatcher
type StringMatchAll ¶
type StringMatchAll struct{}
func (StringMatchAll) Match ¶
func (StringMatchAll) Match(string) bool
func (StringMatchAll) String ¶
func (StringMatchAll) String() string
type StringMatcher ¶
func All ¶
func All() StringMatcher
func Either ¶
func Either(values ...string) StringMatcher
Click to show internal directories.
Click to hide internal directories.