conf

package
v0.0.2-0...-e8ddf8d Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRule

type AppRule struct {
	ActType int8     `json:"act_type"` // 动作类别:1-执行插件 2-跳过插件
	AppIDs  []uint64 `json:"appids"`   // 生效的 appid
}

type Condition

type Condition struct {
	Key   string `json:"key"`   // Extend["key"]
	Op    int8   `json:"op"`    // 操作符 1-等于 2-不等于 3-大于 4-大于等于 5-小于 6-小于等于 7-类似于 8-不类似于 9-开头类似于 10-结尾类似于 11-存在于集合(in) 12-不存在于集合(not in)
	Value string `json:"value"` // 当 Extend["key"] ${op} value 时,才会执行插件
}

type CustomRule

type CustomRule struct {
	ActType  int8    `json:"act_type"`  // 动作类别:1-执行插件 2-跳过插件
	RuleType int8    `json:"rule_type"` // 满足以下:1-任一规则 2-所有规则
	Rules    []*Rule `json:"rules"`     // 规则
}

type PluginConfig

type PluginConfig map[string]interface{}

func (PluginConfig) GetBool

func (f PluginConfig) GetBool(key string) (ret bool, exist bool)

GetBool 获取 bool 类型配置

func (PluginConfig) GetBytes

func (f PluginConfig) GetBytes(key string) (ret []byte, exist bool)

GetBytes 获取 bytes 类型配置

func (PluginConfig) GetEnum

func (f PluginConfig) GetEnum(key string) (ret string, exist bool)

GetEnum 获取枚举(单选)类型配置

func (PluginConfig) GetFloat

func (f PluginConfig) GetFloat(key string) (ret float64, exist bool, err error)

GetFloat 获取 float 类型配置

func (PluginConfig) GetFloatArray

func (f PluginConfig) GetFloatArray(key string) (ret []float64, exist bool, err error)

GetFloatArray 获取 float 数组配置

func (PluginConfig) GetInt

func (f PluginConfig) GetInt(key string) (ret int64, exist bool, err error)

GetInt 获取 int 类型配置

func (PluginConfig) GetIntArray

func (f PluginConfig) GetIntArray(key string) (ret []int64, exist bool, err error)

GetIntArray 获取 int 数组配置

func (PluginConfig) GetMapConf

func (f PluginConfig) GetMapConf(key string) (PluginConfig, bool, error)

GetMapConf 获取 map 类型配置

func (PluginConfig) GetMultiConf

func (f PluginConfig) GetMultiConf(key string) (ret []PluginConfig, exist bool, err error)

GetMultiConf 获取配置数组

func (PluginConfig) GetString

func (f PluginConfig) GetString(key string) (ret string, exist bool)

GetString 获取 string 类型配置

func (PluginConfig) GetStringArray

func (f PluginConfig) GetStringArray(key string) (ret []string, exist bool, err error)

GetStringArray 获取 string 数组配置

func (PluginConfig) GetTime

func (f PluginConfig) GetTime(key string, loc ...*time.Location) (ret time.Time, exist bool, err error)

GetTime 获取 date、time 类型配置

func (PluginConfig) GetTimeInterval

func (f PluginConfig) GetTimeInterval(key string, loc ...*time.Location) (start, end time.Time, exist bool, err error)

GetTimeInterval 获取 date、time 时间区间

func (PluginConfig) GetUint

func (f PluginConfig) GetUint(key string) (ret uint64, exist bool, err error)

GetUint 获取 uint 类型配置

func (PluginConfig) GetUintArray

func (f PluginConfig) GetUintArray(key string) (ret []uint64, exist bool, err error)

GetUintArray 获取 uint 数组配置

type Rule

type Rule struct {
	Name     string       `json:"name"`      // 规则名
	CondType int8         `json:"cond_type"` // 满足以下:1-任一条件 2-所有条件
	Cond     []*Condition `json:"cond"`      // 条件
}

type ScheduleConfig

type ScheduleConfig struct {
	Async         bool        `json:"async"`          // 是否异步执行,默认 false
	SkipError     bool        `json:"skip_error"`     // 是否跳过 error,默认 false(插件返回报错是返回客户端,还是继续执行)
	Timeout       int         `json:"timeout"`        // 单个插件的超时时间,默认 1000 ms
	RequestSource []string    `json:"request_source"` // 指定请求来源,API 接口、WEB 管理,默认都生效 ["api","web"]
	OpType        []string    `json:"op_type"`        // 指定操作类型,默认增删改查都生效: ["read", "mod", "del"]
	GrayScale     int         `json:"gray_scale"`     // 灰度比例,0-100,默认 100(仅针对 API 接口)
	AppRule       *AppRule    `json:"app_rule"`       // 指定 app 执行/跳过插件
	CustomRule    *CustomRule `json:"custom_rule"`    // 自定义规则
}

ScheduleConfig 插件调度配置

Jump to

Keyboard shortcuts

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