restriction

package
v0.0.0-...-28ac8a9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EQ = iota + 1
	NE
	LE
	GE
	LT
	GT
	AND
	OR
	BETWEEN
	LINK
	IN
	ISNULL
)

Operators

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And Condition

func (*And) GetType

func (a *And) GetType() int

func (*And) SetFields

func (a *And) SetFields(key string, value interface{}, operator Operator) ConditionService

func (*And) SetGroup

func (a *And) SetGroup(group bool)

func (*And) ToString

func (a *And) ToString() string

type Condition

type Condition struct {
	sync.RWMutex
	Fields []*Field
	// contains filtered or unexported fields
}

type ConditionService

type ConditionService interface {
	SetFields(key string, value interface{}, operator Operator) ConditionService
	GetType() int
	SetGroup(bool)
	ToString() string
}

func NewAnd

func NewAnd() ConditionService

func NewOr

func NewOr() ConditionService

type ConditionStack

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

type Factory

type Factory interface {
	Factory(restrictionType int) ConditionService
	AddCondition(fn func() string, operator Operator)
	Transpile() string
}

func NewRestriction

func NewRestriction() Factory

type Field

type Field struct {
	Field    query.FieldService
	Operator Operator
}

func NewField

func NewField(fields query.FieldService, operator Operator) *Field

type Operator

type Operator int

func (Operator) ToString

func (o Operator) ToString() string

type Or

type Or Condition

func (*Or) GetType

func (o *Or) GetType() int

func (*Or) SetFields

func (o *Or) SetFields(key string, value interface{}, operator Operator) ConditionService

func (*Or) SetGroup

func (o *Or) SetGroup(group bool)

func (*Or) ToString

func (o *Or) ToString() string

type Restriction

type Restriction struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Restriction) AddCondition

func (r *Restriction) AddCondition(condition func() string, operator Operator)

func (*Restriction) Factory

func (r *Restriction) Factory(restrictionType int) ConditionService

func (*Restriction) Transpile

func (r *Restriction) Transpile() string

Jump to

Keyboard shortcuts

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