Documentation
¶
Overview ¶
Package schema the data structure definition
Index ¶
- Variables
- type Action
- type Actions
- func (a *Actions) GetElement(ctx *parser.Context, content any) (string, error)
- func (a *Actions) GetElements(ctx *parser.Context, content any) ([]string, error)
- func (a *Actions) GetString(ctx *parser.Context, content any) (string, error)
- func (a *Actions) GetStrings(ctx *parser.Context, content any) ([]string, error)
- func (a *Actions) UnmarshalYAML(value *yaml.Node) (err error)
- type Model
- type Operator
- type Property
- type Schema
- func (schema *Schema) AddInit(step ...Step) *Schema
- func (schema *Schema) AddInitOp(op Operator) *Schema
- func (schema *Schema) AddProperty(field string, s Schema) *Schema
- func (schema *Schema) AddRule(step ...Step) *Schema
- func (schema *Schema) AddRuleOp(op Operator) *Schema
- func (schema *Schema) CloneWithType(typ Type) *Schema
- func (schema *Schema) MarshalYAML() (any, error)
- func (schema *Schema) SetInit(action []Action) *Schema
- func (schema *Schema) SetProperty(m Property) *Schema
- func (schema *Schema) SetRule(action []Action) *Schema
- func (schema *Schema) UnmarshalYAML(node *yaml.Node) (err error)
- type Source
- type Step
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSchema = errors.New("invalid schema")
ErrInvalidSchema invalid schema error
var ErrInvalidStep = errors.New("invalid step")
ErrInvalidStep invalid step error
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action The Schema Action
func NewActionOp ¶
NewActionOp returns a new Action with the given Operator
func (Action) MarshalYAML ¶
MarshalYAML encodes the action to yaml
type Actions ¶
type Actions []Action
Actions slice of Action
func (*Actions) GetElement ¶
GetElement run the action returns an element string
func (*Actions) GetElements ¶
GetElements run the action returns a slice of element string
func (*Actions) GetStrings ¶
GetStrings run the action returns a slice of string
type Schema ¶
type Schema struct {
Type Type `yaml:"type"`
Format Type `yaml:"format,omitempty"`
Init Actions `yaml:"init,omitempty"`
Rule Actions `yaml:"rule,omitempty"`
Properties Property `yaml:"properties,omitempty"`
}
Schema The schema.
func NewSchema ¶
NewSchema returns a new Schema with the given Type. The first argument is the Schema.Type, second is the Schema.Format.
func (*Schema) AddProperty ¶
AddProperty append a field string with Schema to Schema.Properties.
func (*Schema) CloneWithType ¶
CloneWithType returns a copy of Schema. Schema.Format and Schema.Rule will be copied.
func (*Schema) MarshalYAML ¶
MarshalYAML encodes the Schema
func (*Schema) SetProperty ¶
SetProperty set the Property to Schema.Properties.
type Source ¶
type Source struct {
Name string `yaml:"name"`
HTTP string `yaml:"http"`
Proxy []string `yaml:"proxy"`
Timeout time.Duration `yaml:"timeout"`
}
Source the Model source
type Step ¶
type Step struct {
// contains filtered or unexported fields
}
Step The Action of step
type Type ¶
type Type string
Type The property type.
const ( // StringType The Type of string. StringType Type = "string" // NumberType The Type of number. NumberType Type = "number" // IntegerType The Type of integer. IntegerType Type = "integer" // BooleanType The Type of boolean. BooleanType Type = "boolean" // ObjectType The Type of object. ObjectType Type = "object" // ArrayType The Type of array. ArrayType Type = "array" )