query_rule

package
v1.0.7-alpha3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: GPL-3.0 Imports: 20 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 Bind

func Bind(app *application.App, simple *Simple)

func GetRulesAndFormConditionClause added in v1.0.5

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

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

func HasRule

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

func IsSupportedOperator

func IsSupportedOperator(op string) bool

func Lint

func Lint(ruleStr string) error

func RegisterQueryRuleDefinitionByEntity

func RegisterQueryRuleDefinitionByEntity(items ...RegisterQueryRuleDefinitionsByEntityItem) error

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 EnableQueryRuleJsonBody added in v1.0.7

type EnableQueryRuleJsonBody struct {
	request.IDJsonBody
}

type Entity added in v1.0.7

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

func (*Entity) DomainCNName added in v1.0.7

func (e *Entity) DomainCNName() string

func (*Entity) DomainCamelName added in v1.0.7

func (e *Entity) DomainCamelName() string

func (*Entity) ForCreate added in v1.0.7

func (e *Entity) ForCreate() error

func (*Entity) ForDelete added in v1.0.7

func (e *Entity) ForDelete() error

func (*Entity) ForUpdate added in v1.0.7

func (e *Entity) ForUpdate() error

type GetEnabledQueryRuleQueryParams added in v1.0.7

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

type GetQueryRuleDefinitionQueryParams

type GetQueryRuleDefinitionQueryParams struct {
	DomainName string `form:"domainName" binding:"required" assign:"toField:DomainName"`
}

type GetQueryRulesQueryParams added in v1.0.7

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"`
}

type Operator

type Operator struct {
	Name   string `json:"name"`
	CNName string `json:"cnName"`
}

type QueryRuleDefinitionItem

type QueryRuleDefinitionItem struct {
	FieldType   string     `json:"fieldType"`
	FieldName   string     `json:"fieldName"`
	FieldCNName string     `json:"fieldCNName"`
	ColumnName  string     `json:"columnName"`
	Operators   []Operator `json:"operators"`
}

func GetQueryRuleDefinition

func GetQueryRuleDefinition(domainName string) []QueryRuleDefinitionItem

type RegisterQueryRuleDefinitionsByEntityItem

type RegisterQueryRuleDefinitionsByEntityItem struct {
	Entity   entity.Entity
	FieldMap map[string]string
}

type RemoveQueryRuleQueryParams added in v1.0.7

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"`
	ColumnName string `json:"columnName"`
	Operator   string `json:"operator"`
	Value      any    `json:"value"`
}

func (Rule) Check

func (r Rule) Check() error

type Simple

type Simple struct {
	// schema
	Schema string
}

Simple Bind参数

Jump to

Keyboard shortcuts

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