cfg_valid_hdl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDefs

func LoadDefs(path string) (map[string]ConfigDefinition, error)

Types

type ConfigDefinition

type ConfigDefinition struct {
	DataType   util.Set[module.DataType]         `json:"data_type"`
	Options    map[string]ConfigDefinitionOption `json:"options"`
	Validators []ConfigDefinitionValidator       `json:"validators"`
}

type ConfigDefinitionOption

type ConfigDefinitionOption struct {
	DataType util.Set[module.DataType] `json:"data_type"`
	Inherit  bool                      `json:"inherit"`
	Required bool                      `json:"required"`
}

type ConfigDefinitionValidator

type ConfigDefinitionValidator struct {
	Name      string                                    `json:"name"`
	Parameter map[string]ConfigDefinitionValidatorParam `json:"parameter"`
}

type ConfigDefinitionValidatorParam

type ConfigDefinitionValidatorParam struct {
	Value any     `json:"value"`
	Ref   *string `json:"ref"`
}

type Handler

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

func New

func New(definitions map[string]ConfigDefinition, validators map[string]handler.Validator) (*Handler, error)

func (*Handler) ValidateBase

func (h *Handler) ValidateBase(cType string, cTypeOpts module.ConfigTypeOptions, dataType module.DataType) error

func (*Handler) ValidateTypeOptions

func (h *Handler) ValidateTypeOptions(cType string, cTypeOpts module.ConfigTypeOptions) error

func (*Handler) ValidateValInOpt

func (h *Handler) ValidateValInOpt(cOpt any, value any, isSlice bool, dataType module.DataType) (err error)

func (*Handler) ValidateValue

func (h *Handler) ValidateValue(cType string, cTypeOpts module.ConfigTypeOptions, value any, isSlice bool, dataType module.DataType) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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