expressions

package
v0.0.0-...-920a96b Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RowsCannotMatch = false
	RowsMightMatch  = true
)

Variables

View Source
var (
	ErrInvalidBinarySerialization = errors.New("invalid binary serialize")
)
View Source
var (
	ErrInvalidCast = errors.New("invalid literal cast")
)

Functions

func VisitBooleanExpr

func VisitBooleanExpr[T any](e BooleanExpression, visitor BooleanExpressionVisitor[T]) (result T, err error)

Types

type And

type And struct {
	Left, Right BooleanExpression
}

func (And) Invert

func (a And) Invert() BooleanExpression

type BindVisitor

type BindVisitor struct {
	Schema          *icegopher.Schema
	CaseInsensitive bool
}

func (BindVisitor) VisitAnd

func (BindVisitor) VisitAnd(left, right BooleanExpression) BooleanExpression

func (BindVisitor) VisitBoundPredicate

func (BindVisitor) VisitBoundPredicate(pred BoundPredicate) BooleanExpression

func (BindVisitor) VisitFalse

func (BindVisitor) VisitFalse() BooleanExpression

func (BindVisitor) VisitNot

func (BindVisitor) VisitOr

func (BindVisitor) VisitOr(left, right BooleanExpression) BooleanExpression

func (BindVisitor) VisitTrue

func (BindVisitor) VisitTrue() BooleanExpression

func (BindVisitor) VisitUnboundPredicate

func (b BindVisitor) VisitUnboundPredicate(pred UnboundPredicate) BooleanExpression

type BoolLiteral

type BoolLiteral bool

func (BoolLiteral) MarshalBinary

func (b BoolLiteral) MarshalBinary() (data []byte, err error)

func (BoolLiteral) To

func (b BoolLiteral) To(t icegopher.Type) (Literal, error)

func (*BoolLiteral) UnmarshalBinary

func (b *BoolLiteral) UnmarshalBinary(data []byte) error

func (BoolLiteral) Value

func (b BoolLiteral) Value() bool

type BooleanExpression

type BooleanExpression interface {
	Invert() BooleanExpression
}

func Bind

func Bind(s *icegopher.Schema, expr BooleanExpression, caseInsensitive bool) (BooleanExpression, error)

func EqualTo

func EqualTo[L LiteralType](term string, literal L) BooleanExpression

func IsNull

func IsNull(term string) BooleanExpression

func NotEqualTo

func NotEqualTo[L LiteralType](term string, literal L) BooleanExpression

func RewriteNot

func RewriteNot(expr BooleanExpression) (BooleanExpression, error)

type BooleanExpressionVisitor

type BooleanExpressionVisitor[T any] interface {
	VisitTrue() T
	VisitFalse() T
	VisitNot(child T) T
	VisitAnd(left, right T) T
	VisitOr(left, right T) T
	VisitUnboundPredicate(pred UnboundPredicate) T
	VisitBoundPredicate(pred BoundPredicate) T
}

type BoundBooleanExpressionVisitor

type BoundBooleanExpressionVisitor[T any] interface {
	BooleanExpressionVisitor[T]

	// VisitIn(BoundTerm, []Literal) T
	// VisitNotIn(BoundTerm, []Literal) T
	// VisitIsNaN(BoundTerm) T
	// VisitNotNaN(BoundTerm) T
	VisitIsNull(BoundTerm) T
	VisitNotNull(BoundTerm) T
	VisitEqual(BoundTerm, Literal) T
	VisitNotEqual(BoundTerm, Literal) T
}

type BoundLiteralPredicate

type BoundLiteralPredicate interface {
	BoundPredicate
	Literal() Literal
}

type BoundPredicate

type BoundPredicate interface {
	BooleanExpression
	fmt.Stringer
	Term() BoundTerm
}

type BoundReference

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

func (BoundReference) Eval

func (b BoundReference) Eval(row icegopher.Row) (any, error)

func (BoundReference) Ref

type BoundTerm

type BoundTerm interface {
	Ref() BoundReference
	Eval(row icegopher.Row) (any, error)
}

type BytesLiteral

type BytesLiteral []byte

func (BytesLiteral) MarshalBinary

func (b BytesLiteral) MarshalBinary() (data []byte, err error)

func (BytesLiteral) To

func (*BytesLiteral) UnmarshalBinary

func (b *BytesLiteral) UnmarshalBinary(data []byte) error

func (BytesLiteral) Value

func (b BytesLiteral) Value() []byte

type DateLiteral

type DateLiteral icegopher.Date

func (DateLiteral) MarshalBinary

func (d DateLiteral) MarshalBinary() (data []byte, err error)

func (DateLiteral) To

func (d DateLiteral) To(t icegopher.Type) (Literal, error)

func (*DateLiteral) UnmarshalBinary

func (d *DateLiteral) UnmarshalBinary(data []byte) error

func (DateLiteral) Value

func (d DateLiteral) Value() icegopher.Date

type DecimalLiteral

type DecimalLiteral decimal128.Num

func (DecimalLiteral) MarshalBinary

func (d DecimalLiteral) MarshalBinary() (data []byte, err error)

func (DecimalLiteral) To

func (*DecimalLiteral) UnmarshalBinary

func (d *DecimalLiteral) UnmarshalBinary(data []byte) error

func (DecimalLiteral) Value

func (d DecimalLiteral) Value() decimal128.Num

type DoubleAboveMax

type DoubleAboveMax struct{}

func (DoubleAboveMax) String

func (DoubleAboveMax) String() string

func (DoubleAboveMax) To

func (DoubleAboveMax) Value

func (DoubleAboveMax) Value() float64

type DoubleBelowMin

type DoubleBelowMin struct{}

func (DoubleBelowMin) String

func (DoubleBelowMin) String() string

func (DoubleBelowMin) To

func (DoubleBelowMin) Value

func (DoubleBelowMin) Value() float64

type DoubleLiteral

type DoubleLiteral float64

func (DoubleLiteral) MarshalBinary

func (d DoubleLiteral) MarshalBinary() (data []byte, err error)

func (DoubleLiteral) To

func (*DoubleLiteral) UnmarshalBinary

func (d *DoubleLiteral) UnmarshalBinary(data []byte) error

func (DoubleLiteral) Value

func (d DoubleLiteral) Value() float64

type FixedLiteral

type FixedLiteral []byte

func (FixedLiteral) MarshalBinary

func (f FixedLiteral) MarshalBinary() (data []byte, err error)

func (FixedLiteral) To

func (*FixedLiteral) UnmarshalBinary

func (f *FixedLiteral) UnmarshalBinary(data []byte) error

func (FixedLiteral) Value

func (f FixedLiteral) Value() []byte

type FloatAboveMax

type FloatAboveMax struct{}

func (FloatAboveMax) String

func (FloatAboveMax) String() string

func (FloatAboveMax) To

func (FloatAboveMax) Value

func (FloatAboveMax) Value() float32

type FloatBelowMin

type FloatBelowMin struct{}

func (FloatBelowMin) String

func (FloatBelowMin) String() string

func (FloatBelowMin) To

func (FloatBelowMin) Value

func (FloatBelowMin) Value() float32

type FloatLiteral

type FloatLiteral float32

func (FloatLiteral) MarshalBinary

func (f FloatLiteral) MarshalBinary() (data []byte, err error)

func (FloatLiteral) To

func (*FloatLiteral) UnmarshalBinary

func (f *FloatLiteral) UnmarshalBinary(data []byte) error

func (FloatLiteral) Value

func (f FloatLiteral) Value() float32

type InclusiveMetricsEvaluator

type InclusiveMetricsEvaluator interface {
	Eval(icegopher.DataFile) (bool, error)
}

func NewInclusiveMetricsEvaluator

func NewInclusiveMetricsEvaluator(s *icegopher.Schema, expr BooleanExpression, caseInsensitive bool) (InclusiveMetricsEvaluator, error)

type IntAboveMax

type IntAboveMax struct{}

func (IntAboveMax) String

func (IntAboveMax) String() string

func (IntAboveMax) To

func (IntAboveMax) Value

func (IntAboveMax) Value() int32

type IntBelowMin

type IntBelowMin struct{}

func (IntBelowMin) String

func (IntBelowMin) String() string

func (IntBelowMin) To

func (IntBelowMin) Value

func (IntBelowMin) Value() int32

type IntLiteral

type IntLiteral int32

func (IntLiteral) MarshalBinary

func (i IntLiteral) MarshalBinary() (data []byte, err error)

func (IntLiteral) To

func (i IntLiteral) To(t icegopher.Type) (Literal, error)

func (*IntLiteral) UnmarshalBinary

func (i *IntLiteral) UnmarshalBinary(data []byte) error

func (IntLiteral) Value

func (i IntLiteral) Value() int32

type Literal

type Literal interface {
	To(icegopher.Type) (Literal, error)
}

func LiteralFromBytes

func LiteralFromBytes(typ icegopher.Type, data []byte) (Literal, error)

func NewLiteral

func NewLiteral[L LiteralType](v L) Literal

type LiteralFalse

type LiteralFalse struct{}

func (LiteralFalse) Invert

type LiteralTrue

type LiteralTrue struct{}

func (LiteralTrue) Invert

func (LiteralTrue) Invert() BooleanExpression

type LiteralType

type LiteralType interface {
	string | bool | int32 | float32 | int64 |
		float64 | []byte | uuid.UUID | decimal128.Num |
		icegopher.Time | icegopher.Date | icegopher.Timestamp
}

type LongAboveMax

type LongAboveMax struct{}

func (LongAboveMax) String

func (LongAboveMax) String() string

func (LongAboveMax) To

func (LongAboveMax) Value

func (LongAboveMax) Value() int64

type LongBelowMin

type LongBelowMin struct{}

func (LongBelowMin) String

func (LongBelowMin) String() string

func (LongBelowMin) To

func (LongBelowMin) Value

func (LongBelowMin) Value() int64

type LongLiteral

type LongLiteral int64

func (LongLiteral) MarshalBinary

func (l LongLiteral) MarshalBinary() (data []byte, err error)

func (LongLiteral) To

func (l LongLiteral) To(t icegopher.Type) (Literal, error)

func (*LongLiteral) UnmarshalBinary

func (l *LongLiteral) UnmarshalBinary(data []byte) error

func (LongLiteral) Value

func (l LongLiteral) Value() int64

type Not

type Not struct {
	Child BooleanExpression
}

func (Not) Invert

func (n Not) Invert() BooleanExpression

type NumericLiteralType

type NumericLiteralType interface {
	int32 | float32 | int64 | float64 |
		icegopher.Time | icegopher.Date | icegopher.Timestamp
}

type Or

type Or struct {
	Left, Right BooleanExpression
}

func (Or) Invert

func (o Or) Invert() BooleanExpression

type OrderedNumericLiteralType

type OrderedNumericLiteralType interface {
	int32 | float32 | int64 | float64 | icegopher.Time |
		icegopher.Date | icegopher.Timestamp
}

type Reference

type Reference string

func (Reference) Bind

func (r Reference) Bind(s *icegopher.Schema, caseSensitive bool) (BoundTerm, error)

func (Reference) String

func (r Reference) String() string

type StringLiteral

type StringLiteral string

func (StringLiteral) MarshalBinary

func (s StringLiteral) MarshalBinary() (data []byte, err error)

func (StringLiteral) To

func (*StringLiteral) UnmarshalBinary

func (s *StringLiteral) UnmarshalBinary(data []byte) error

func (StringLiteral) Value

func (s StringLiteral) Value() string

type TimeLiteral

type TimeLiteral icegopher.Time

func (TimeLiteral) MarshalBinary

func (d TimeLiteral) MarshalBinary() (data []byte, err error)

func (TimeLiteral) To

func (t TimeLiteral) To(typ icegopher.Type) (Literal, error)

func (*TimeLiteral) UnmarshalBinary

func (t *TimeLiteral) UnmarshalBinary(data []byte) error

func (TimeLiteral) Value

func (t TimeLiteral) Value() icegopher.Time

type TimestampLiteral

type TimestampLiteral icegopher.Timestamp

func (TimestampLiteral) MarshalBinary

func (d TimestampLiteral) MarshalBinary() (data []byte, err error)

func (TimestampLiteral) To

func (*TimestampLiteral) UnmarshalBinary

func (t *TimestampLiteral) UnmarshalBinary(data []byte) error

func (TimestampLiteral) Value

type UUIDLiteral

type UUIDLiteral uuid.UUID

func (UUIDLiteral) MarshalBinary

func (u UUIDLiteral) MarshalBinary() (data []byte, err error)

func (UUIDLiteral) To

func (u UUIDLiteral) To(t icegopher.Type) (Literal, error)

func (*UUIDLiteral) UnmarshalBinary

func (u *UUIDLiteral) UnmarshalBinary(data []byte) error

func (UUIDLiteral) Value

func (u UUIDLiteral) Value() uuid.UUID

type UnboundLiteralPredicate

type UnboundLiteralPredicate interface {
	UnboundPredicate
	Literal() Literal
}

type UnboundPredicate

type UnboundPredicate interface {
	BooleanExpression
	fmt.Stringer
	Bind(s *icegopher.Schema, caseInsensitive bool) (BoundPredicate, error)
}

type UnboundTerm

type UnboundTerm interface {
	fmt.Stringer
	Bind(s *icegopher.Schema, caseInsensitive bool) (BoundTerm, error)
}

Jump to

Keyboard shortcuts

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