constraint

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnabledFlagSelf = 1 << iota
	EnabledFlagSearch
	EnabledFlagTimeSeries
)
View Source
const (
	PropertyTypeInt    = "int"
	PropertyTypeBool   = "bool"
	PropertyTypeFloat  = "float"
	PropertyTypeDouble = "double"
	PropertyTypeString = "string"
	PropertyTypeArray  = "array"
	PropertyTypeStruct = "struct"

	DefineFieldArrayLength  = "length"
	DefineFieldArrayElemCfg = "elem_type"
	DefineFieldStructFields = "fields"
)

Variables

This section is empty.

Functions

func ExecData

func ExecData(val tdtl.Node, ct *Constraint) (tdtl.Node, error)

func Parse added in v0.4.1

func Parse(bytes []byte) (map[string]*Config, error)

Types

type BitBucket

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

func NewBitBucket

func NewBitBucket(length int) *BitBucket

func (*BitBucket) Disable

func (bb *BitBucket) Disable(n int) bool

func (*BitBucket) Enable

func (bb *BitBucket) Enable(n int) bool

func (*BitBucket) Enabled

func (bb *BitBucket) Enabled(n int) bool

type Config

type Config struct {
	ID                string                 `json:"id" mapstructure:"id"`
	Type              string                 `json:"type" mapstructure:"type"`
	Name              string                 `json:"name" mapstructure:"name"`
	Weight            int                    `json:"weight" mapstructure:"weight"`
	Enabled           bool                   `json:"enabled" mapstructure:"enabled"`
	EnabledSearch     bool                   `json:"enabled_search" mapstructure:"enabled_search"`
	EnabledTimeSeries bool                   `json:"enabled_time_series" mapstructure:"enabled_time_series"`
	Description       string                 `json:"description" mapstructure:"description"`
	Define            map[string]interface{} `json:"define" mapstructure:"define"`
	LastTime          int64                  `json:"last_time" mapstructure:"last_time"`
}

func ParseConfigFrom added in v0.4.1

func ParseConfigFrom(data interface{}) (cfg Config, err error)

func ParseFrom added in v0.4.1

func ParseFrom(bytes []byte) (*Config, error)

func (*Config) AppendField added in v0.3.0

func (cfg *Config) AppendField(c Config) error

func (*Config) GetConfig added in v0.3.0

func (cfg *Config) GetConfig(segs []string, index int) (int, *Config, error)

func (*Config) RemoveField added in v0.3.0

func (cfg *Config) RemoveField(id string) error

type Constraint

type Constraint struct {
	ID         string
	Type       string
	Operators  []Operator
	ChildNodes []*Constraint
	EnableFlag *BitBucket
}

func NewConstraintsFrom

func NewConstraintsFrom(cfg Config) *Constraint

func (*Constraint) GenEnabledIndexes added in v0.3.0

func (ct *Constraint) GenEnabledIndexes(enabledFlag int) []string

type DefineArray

type DefineArray struct {
	Length   int    `json:"length" mapstructure:"length"`
	ElemType Config `json:"elem_type" mapstructure:"elem_type"`
}

type DefineStruct

type DefineStruct struct {
	Fields map[string]Config `json:"fields" mapstructure:"fields"`
}

type Operator

type Operator struct {
	Callback  string
	Condition interface{}
}

Jump to

Keyboard shortcuts

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