treecmp

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package treecmp contains the implementation-agnostic information about all comparison operators that we support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparisonOpName

func ComparisonOpName(op ComparisonOperatorSymbol) string

ComparisonOpName returns the name of op.

Types

type ComparisonOperator

type ComparisonOperator struct {
	Symbol ComparisonOperatorSymbol
	// IsExplicitOperator is true if OPERATOR(symbol) is used.
	IsExplicitOperator bool
}

ComparisonOperator represents a binary operator which returns a bool.

func MakeComparisonOperator

func MakeComparisonOperator(symbol ComparisonOperatorSymbol) ComparisonOperator

MakeComparisonOperator creates a ComparisonOperator given a symbol.

func (ComparisonOperator) Operator

func (ComparisonOperator) Operator()

Operator implements tree.Operator.

func (ComparisonOperator) String

func (o ComparisonOperator) String() string

type ComparisonOperatorSymbol

type ComparisonOperatorSymbol int

ComparisonOperatorSymbol represents a comparison operator symbol.

const (
	EQ ComparisonOperatorSymbol = iota
	LT
	GT
	LE
	GE
	NE
	In
	NotIn
	Like
	NotLike
	ILike
	NotILike
	SimilarTo
	NotSimilarTo
	RegMatch
	NotRegMatch
	RegIMatch
	NotRegIMatch
	IsDistinctFrom
	IsNotDistinctFrom
	Contains
	ContainedBy
	JSONExists
	JSONSomeExists
	JSONAllExists
	Overlaps

	// The following operators will always be used with an associated SubOperator.
	// If Go had algebraic data types they would be defined in a self-contained
	// manner like:
	//
	// Any(ComparisonOperator)
	// Some(ComparisonOperator)
	// ...
	//
	// where the internal ComparisonOperator qualifies the behavior of the primary
	// operator. Instead, a secondary ComparisonOperator is optionally included in
	// ComparisonExpr for the cases where these operators are the primary op.
	//
	// ComparisonOperator.HasSubOperator returns true for ops in this group.
	Any
	Some
	All

	NumComparisonOperatorSymbols
)

ComparisonExpr.Operator

func (ComparisonOperatorSymbol) HasSubOperator

func (i ComparisonOperatorSymbol) HasSubOperator() bool

HasSubOperator returns if the ComparisonOperator is used with a sub-operator.

func (ComparisonOperatorSymbol) String

func (i ComparisonOperatorSymbol) String() string

Jump to

Keyboard shortcuts

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