rule

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldScope      = "Scope"
	FieldDomainName = "DomainName"
	FieldRule       = "Rule"
	FieldEnabled    = "Enabled"
)
View Source
const (
	LogicalOperatorAnd = "and"
	LogicalOperatorOr  = "or"
)

Variables

View Source
var (
	ColumnScope      = domain.ColumnName(FieldScope)
	ColumnDomainName = domain.ColumnName(FieldDomainName)
	ColumnRule       = domain.ColumnName(FieldRule)
	ColumnEnabled    = domain.ColumnName(FieldEnabled)
)

Functions

func FormConditionClause

func FormConditionClause(dbSchema string, scope string, domainName string, i *infrastructure.Infrastructure, ruleParams map[string]any) (clause.Clause, error)

FormConditionClause 获取规则并返回条件语句 参数: - dbSchema: 数据库schema - scope: 范围 - domainName: 领域名称 - i: 基础设施 - ruleParams: 规则参数 返回值: - 语句接口,当错误为nil时,语句接口也可能是nil,代表该规则并没有被赋值,所以是没有条件的 - 错误

func HasRule

func HasRule(dbSchema string, scope string, domainName string, i *infrastructure.Infrastructure) (bool, error)

HasRule 检查是否存在规则 参数: - dbSchema: 数据库schema - scope: 范围 - domainName: 领域名称 - i: 基础设施 返回值: - 是否存在规则 - 错误

Types

type AddQueryRuleJsonBody

type AddQueryRuleJsonBody struct {
	Scope      string `json:"scope" binding:"required" assign:"toField:Scope"`
	DomainName string `json:"domainName" binding:"required" assign:"toField:DomainName"`
	Rule       string `json:"rule" binding:"required" assign:"toField:Rule"`
}

type DisableQueryRuleJsonBody

type DisableQueryRuleJsonBody struct {
	request.IDJsonBody
}

type EnableQueryRuleJsonBody

type EnableQueryRuleJsonBody struct {
	request.IDJsonBody
}

type Entity

type Entity struct {
	entity.Base
	Scope      string `sqlmapping:"column:scope;notUpdate;" sqlresult:"column:scope;" check:"required,lte=256,when=create"`
	DomainName string `sqlmapping:"column:domain_name;notUpdate;" sqlresult:"column:domain_name;" check:"required,lte=256,when=create"`
	Rule       string `sqlmapping:"column:rule;notUpdate;" sqlresult:"column:rule;" check:"required,when=create"`
	Enabled    bool   `sqlresult:"column:enabled;" sqlresult:"column:enabled;"`
}

func (*Entity) DomainCNName

func (e *Entity) DomainCNName() string

func (*Entity) DomainCamelName

func (e *Entity) DomainCamelName() string

func (*Entity) GetFieldMap added in v1.1.0

func (e *Entity) GetFieldMap() map[string]string

func (*Entity) LintRule added in v1.1.0

func (e *Entity) LintRule() error

type GetEnabledQueryRuleQueryParams

type GetEnabledQueryRuleQueryParams struct {
	Scope      string `json:"scope" binding:"required" assign:"toField:Scope"`
	DomainName string `json:"domainName" binding:"required" assign:"toField:DomainName"`
}

type GetQueryRulesQueryParams

type GetQueryRulesQueryParams struct {
	Scope      string `json:"scope" assign:"toField:Scope"`
	DomainName string `json:"domainName" assign:"toField:DomainName"`
	PageNo     int    `json:"pageNo"`
	PageSize   int    `json:"pageSize"`
}

type Info

type Info struct {
	application.InfoIDField
	Scope      string `json:"scope" sqlresult:"column:scope"`
	DomainName string `json:"domainName" sqlresult:"column:domain_name"`
	Rule       string `json:"rule" sqlresult:"column:rule"`
	Enabled    bool   `json:"enabled" sqlresult:"column:enabled"`
}

type RemoveQueryRuleQueryParams

type RemoveQueryRuleQueryParams struct {
	request.IDQueryParam
}

type Rule

type Rule struct {
	LogicalOperator string `json:"logicalOperator"`
	Left            *Rule  `json:"left"`
	Right           *Rule  `json:"right"`

	FieldName string `json:"fieldName"`
	FieldType string `json:"fieldType"`
	Operator  string `json:"operator"`
	Value     any    `json:"value"`
}

type Simple

type Simple struct {
	// schema
	Schema string
}

Simple Bind参数

func (*Simple) Bind

func (simple *Simple) Bind(binder *binding.Binder)

Jump to

Keyboard shortcuts

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