query_rule

package
v1.0.3-alpha3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldScope      = "Scope"
	FieldDomainName = "DomainName"
	FieldRule       = "Rule"
)

Variables

View Source
var (
	ColumnScope      = domain.ColumnName(FieldScope)
	ColumnDomainName = "domain_name"
	ColumnRule       = domain.ColumnName(FieldRule)
)

Functions

func Bind

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

func FormConditions

func FormConditions(rules []Rule) (*sql.Conditions, error)

func GetRulesAndFormConditions

func GetRulesAndFormConditions(dbSchema string, scope string, domainName string, i *infrastructure.Infrastructure) (*sql.Conditions, error)

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:RuleDomainName"`
	Rule       string `json:"rule" binding:"required" assign:"toField:Rule"`
}

type GetQueryRuleDefinitionQueryParams

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

type GetQueryRuleQueryParams

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

type Info

type Info struct {
	Scope          string `json:"scope" sqlresult:"column:scope"`
	RuleDomainName 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 RemoveQueryRuleJsonBody

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

type Rule

type Rule struct {
	FieldName  string `json:"fieldName"`
	FieldType  string `json:"fieldType"`
	ColumnName string `json:"columnName"`
	Operator   string `json:"operator"`
	Value      any    `json:"value"`
}

func GetRules

func GetRules(dbSchema string, scope string, domainName string, i *infrastructure.Infrastructure) ([]Rule, error)

func (Rule) Check

func (r Rule) Check() error

type Simple

type Simple struct {
	// schema
	Schema string
}

Simple Bind参数

type ValueObject

type ValueObject struct {
	value_object.Base
	Scope          string `sqlmapping:"column:scope;key;notUpdate;" sqlresult:"column:scope;" check:"required,lte=256"`
	RuleDomainName string `sqlmapping:"column:domain_name;key;notUpdate;" sqlresult:"column:domain_name;" check:"required,lte=256"`
	Rule           string `sqlmapping:"column:rule;notUpdate;" sqlresult:"column:rule;" check:"required"`
}

func (*ValueObject) CheckKeyFields

func (valueObject *ValueObject) CheckKeyFields() error

func (*ValueObject) DomainCNName

func (valueObject *ValueObject) DomainCNName() string

func (*ValueObject) DomainCamelName

func (valueObject *ValueObject) DomainCamelName() string

func (*ValueObject) ForCreate

func (valueObject *ValueObject) ForCreate() error

Jump to

Keyboard shortcuts

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