model

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUpdater

func ApplyUpdater[T any](target *T, updateOperation UpdateOperation[T])

Types

type CompoundOperand

type CompoundOperand[T any] struct {
	LHS FilterOperation[T] `json:"lhs" toml:"lhs" yaml:"lhs"`
	RHS FilterOperation[T] `json:"rhs" toml:"rhs" yaml:"rhs"`
}

func (CompoundOperand[T]) OperandDummyMethod

func (o CompoundOperand[T]) OperandDummyMethod()

type FilterOperation

type FilterOperation[T any] struct {
	Operand  Operand[T]     `json:"operand" toml:"operand" yaml:"operand"`
	Operator FilterOperator `json:"operator" toml:"operator" yaml:"operator"`
}

func ConvertFilter

func ConvertFilter[TOut any, TIn any](from FilterOperation[TIn], operandConverter func(fromOperator TIn) (TOut, error)) (FilterOperation[TOut], error)

func (*FilterOperation[T]) UnmarshalJSON added in v0.6.0

func (s *FilterOperation[T]) UnmarshalJSON(b []byte) error

type FilterOperator

type FilterOperator int
const (
	FilterEqual FilterOperator = iota + 1
	FilterNEqual
	FilterGreaterThan
	FilterGreaterThanEqual
	FilterLessThan
	FilterLessThanEqual

	FilterIn
	FilterNotIn

	FilterBetween
	FilterNotBetween

	FilterLike
	FilterNotLike

	FilterOr
	FilterAnd
)

TODO: Implement FilterContains and FilterNotContains TODO: Implement FilterEmpty and FilterNotEmpty

func FilterOperatorFromString added in v0.6.0

func FilterOperatorFromString(s string) FilterOperator

func (FilterOperator) MarshalJSON added in v0.6.0

func (s FilterOperator) MarshalJSON() ([]byte, error)

func (FilterOperator) String added in v0.6.0

func (o FilterOperator) String() string

func (*FilterOperator) UnmarshalJSON added in v0.6.0

func (s *FilterOperator) UnmarshalJSON(b []byte) error

type ListOperand

type ListOperand[T any] struct {
	Operands []T `json:"operands" toml:"operands" yaml:"operands"`
}

func (ListOperand[T]) OperandDummyMethod

func (o ListOperand[T]) OperandDummyMethod()

type Operand

type Operand[T any] interface {
	OperandDummyMethod()
}

type RangeOperand

type RangeOperand[T any] struct {
	Start T `json:"start" toml:"start" yaml:"start"`
	End   T `json:"end" toml:"end" yaml:"end"`
}

func (RangeOperand[T]) OperandDummyMethod

func (o RangeOperand[T]) OperandDummyMethod()

type ScalarOperand

type ScalarOperand[T any] struct {
	Operand T `json:"operand" toml:"operand" yaml:"operand"`
}

func (ScalarOperand[T]) OperandDummyMethod

func (o ScalarOperand[T]) OperandDummyMethod()

type UpdateOperation

type UpdateOperation[T any] struct {
	Operand  T              `json:"operand" toml:"operand" yaml:"operand"`
	Operator UpdateOperator `json:"operator" toml:"operator" yaml:"operator"`
}

type UpdateOperator

type UpdateOperator int
const (
	UpdateSet UpdateOperator = iota + 1
	UpdateClear

	UpdateAppend
	UpdatePrepend

	UpdateAdd
	UpdateSubtract
)

func UpdateOperatorFromString added in v0.6.0

func UpdateOperatorFromString(s string) UpdateOperator

func (UpdateOperator) MarshalJSON added in v0.6.0

func (s UpdateOperator) MarshalJSON() ([]byte, error)

func (UpdateOperator) String added in v0.6.0

func (o UpdateOperator) String() string

func (*UpdateOperator) UnmarshalJSON added in v0.6.0

func (s *UpdateOperator) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
fs

Jump to

Keyboard shortcuts

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