Documentation
¶
Overview ¶
Package op provides implementations for JSON Patch operations.
Index ¶
- Variables
- func DeepClone(value interface{}) (interface{}, error)
- func IsMutationOp(opType internal.OpType) bool
- func IsPredicateOp(opType internal.OpType) bool
- func IsSecondOrderPredicateOp(opType internal.OpType) bool
- func ToFloat64(val interface{}) (float64, bool)
- type AddOperation
- func (o *AddOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *AddOperation) Code() int
- func (o *AddOperation) Op() internal.OpType
- func (o *AddOperation) Path() []string
- func (o *AddOperation) ToCompact() (internal.CompactOperation, error)
- func (o *AddOperation) ToJSON() (internal.Operation, error)
- func (o *AddOperation) Validate() error
- type AndOperation
- func (o *AndOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *AndOperation) Code() int
- func (o *AndOperation) Not() bool
- func (o *AndOperation) Op() internal.OpType
- func (o *AndOperation) Ops() []internal.PredicateOp
- func (o *AndOperation) Path() []string
- func (o *AndOperation) Test(doc interface{}) (bool, error)
- func (o *AndOperation) ToCompact() (internal.CompactOperation, error)
- func (o *AndOperation) ToJSON() (internal.Operation, error)
- func (o *AndOperation) Validate() error
- type BaseOp
- type ContainsOperation
- func NewOpContainsOperation(path []string, substring string) *ContainsOperation
- func NewOpContainsOperationWithFlags(path []string, substring string, ignoreCase bool, notFlag bool) *ContainsOperation
- func NewOpContainsOperationWithIgnoreCase(path []string, substring string, ignoreCase bool) *ContainsOperation
- func (op *ContainsOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *ContainsOperation) Code() int
- func (op *ContainsOperation) Not() bool
- func (op *ContainsOperation) Op() internal.OpType
- func (op *ContainsOperation) Path() []string
- func (op *ContainsOperation) Test(doc any) (bool, error)
- func (op *ContainsOperation) ToCompact() (internal.CompactOperation, error)
- func (op *ContainsOperation) ToJSON() (internal.Operation, error)
- func (op *ContainsOperation) Validate() error
- type CopyOperation
- func (o *CopyOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *CopyOperation) Code() int
- func (o *CopyOperation) From() []string
- func (o *CopyOperation) Op() internal.OpType
- func (o *CopyOperation) ToCompact() (internal.CompactOperation, error)
- func (o *CopyOperation) ToJSON() (internal.Operation, error)
- func (o *CopyOperation) Validate() error
- type DefinedOperation
- func (o *DefinedOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *DefinedOperation) Code() int
- func (o *DefinedOperation) Not() bool
- func (o *DefinedOperation) Op() internal.OpType
- func (o *DefinedOperation) Path() []string
- func (o *DefinedOperation) Test(doc interface{}) (bool, error)
- func (o *DefinedOperation) ToCompact() (internal.CompactOperation, error)
- func (o *DefinedOperation) ToJSON() (internal.Operation, error)
- func (o *DefinedOperation) Validate() error
- type EndsOperation
- func (op *EndsOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *EndsOperation) Code() int
- func (op *EndsOperation) Not() bool
- func (op *EndsOperation) Op() internal.OpType
- func (op *EndsOperation) Path() []string
- func (op *EndsOperation) Test(doc any) (bool, error)
- func (op *EndsOperation) ToCompact() (internal.CompactOperation, error)
- func (op *EndsOperation) ToJSON() (internal.Operation, error)
- func (op *EndsOperation) Validate() error
- type ExtendOperation
- func (op *ExtendOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *ExtendOperation) Code() int
- func (op *ExtendOperation) Op() internal.OpType
- func (op *ExtendOperation) ToCompact() (internal.CompactOperation, error)
- func (op *ExtendOperation) ToJSON() (internal.Operation, error)
- func (op *ExtendOperation) Validate() error
- type FlipOperation
- func (op *FlipOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *FlipOperation) Code() int
- func (op *FlipOperation) Op() internal.OpType
- func (op *FlipOperation) ToCompact() (internal.CompactOperation, error)
- func (op *FlipOperation) ToJSON() (internal.Operation, error)
- func (op *FlipOperation) Validate() error
- type InOperation
- func (op *InOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *InOperation) Code() int
- func (op *InOperation) Not() bool
- func (op *InOperation) Op() internal.OpType
- func (op *InOperation) Path() []string
- func (op *InOperation) Test(doc any) (bool, error)
- func (op *InOperation) ToCompact() (internal.CompactOperation, error)
- func (op *InOperation) ToJSON() (internal.Operation, error)
- func (op *InOperation) Validate() error
- type IncOperation
- func (op *IncOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *IncOperation) Code() int
- func (op *IncOperation) Op() internal.OpType
- func (op *IncOperation) Path() []string
- func (op *IncOperation) ToCompact() (internal.CompactOperation, error)
- func (op *IncOperation) ToJSON() (internal.Operation, error)
- func (op *IncOperation) Validate() error
- type LessOperation
- func (op *LessOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *LessOperation) Code() int
- func (op *LessOperation) Not() bool
- func (op *LessOperation) Op() internal.OpType
- func (op *LessOperation) Path() []string
- func (op *LessOperation) Test(doc any) (bool, error)
- func (op *LessOperation) ToCompact() (internal.CompactOperation, error)
- func (op *LessOperation) ToJSON() (internal.Operation, error)
- func (op *LessOperation) Validate() error
- type MatchesOperation
- func (o *MatchesOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *MatchesOperation) Code() int
- func (o *MatchesOperation) Not() bool
- func (o *MatchesOperation) Op() internal.OpType
- func (o *MatchesOperation) Path() []string
- func (o *MatchesOperation) Test(doc interface{}) (bool, error)
- func (o *MatchesOperation) ToCompact() (internal.CompactOperation, error)
- func (o *MatchesOperation) ToJSON() (internal.Operation, error)
- func (o *MatchesOperation) Validate() error
- type MergeOperation
- func (op *MergeOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *MergeOperation) Code() int
- func (op *MergeOperation) Op() internal.OpType
- func (op *MergeOperation) Path() []string
- func (op *MergeOperation) ToCompact() (internal.CompactOperation, error)
- func (op *MergeOperation) ToJSON() (internal.Operation, error)
- func (op *MergeOperation) Validate() error
- type MoreOperation
- func (o *MoreOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *MoreOperation) Code() int
- func (o *MoreOperation) Not() bool
- func (o *MoreOperation) Op() internal.OpType
- func (o *MoreOperation) Path() []string
- func (o *MoreOperation) Test(doc interface{}) (bool, error)
- func (o *MoreOperation) ToCompact() (internal.CompactOperation, error)
- func (o *MoreOperation) ToJSON() (internal.Operation, error)
- func (o *MoreOperation) Validate() error
- type MoveOperation
- func (o *MoveOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *MoveOperation) Code() int
- func (o *MoveOperation) From() []string
- func (o *MoveOperation) Op() internal.OpType
- func (o *MoveOperation) ToCompact() (internal.CompactOperation, error)
- func (o *MoveOperation) ToJSON() (internal.Operation, error)
- func (o *MoveOperation) Validate() error
- type NotOperation
- func (o *NotOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *NotOperation) Code() int
- func (o *NotOperation) Not() bool
- func (o *NotOperation) Op() internal.OpType
- func (o *NotOperation) Ops() []internal.PredicateOp
- func (o *NotOperation) Path() []string
- func (o *NotOperation) Test(doc any) (bool, error)
- func (o *NotOperation) ToCompact() (internal.CompactOperation, error)
- func (o *NotOperation) ToJSON() (internal.Operation, error)
- func (o *NotOperation) Validate() error
- type Op
- type OpAndOperation
- type OpContainsOperation
- type OpCopyOperation
- type OpDefinedOperation
- type OpEndsOperation
- type OpExtendOperation
- type OrOperation
- func (o *OrOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *OrOperation) Code() int
- func (o *OrOperation) Not() bool
- func (o *OrOperation) Op() internal.OpType
- func (o *OrOperation) Ops() []internal.PredicateOp
- func (o *OrOperation) Path() []string
- func (o *OrOperation) Test(doc interface{}) (bool, error)
- func (o *OrOperation) ToCompact() (internal.CompactOperation, error)
- func (o *OrOperation) ToJSON() (internal.Operation, error)
- func (o *OrOperation) Validate() error
- type PredicateOp
- type PredicateOpBase
- type RemoveOperation
- func (o *RemoveOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *RemoveOperation) Code() int
- func (o *RemoveOperation) Op() internal.OpType
- func (o *RemoveOperation) Path() []string
- func (o *RemoveOperation) ToCompact() (internal.CompactOperation, error)
- func (o *RemoveOperation) ToJSON() (internal.Operation, error)
- func (o *RemoveOperation) Validate() error
- type ReplaceOperation
- func (o *ReplaceOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *ReplaceOperation) Code() int
- func (o *ReplaceOperation) Op() internal.OpType
- func (o *ReplaceOperation) Path() []string
- func (o *ReplaceOperation) ToCompact() (internal.CompactOperation, error)
- func (o *ReplaceOperation) ToJSON() (internal.Operation, error)
- func (o *ReplaceOperation) Validate() error
- type Result
- type SecondOrderPredicateOp
- type SplitOperation
- func (op *SplitOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *SplitOperation) Code() int
- func (op *SplitOperation) Op() internal.OpType
- func (op *SplitOperation) Path() []string
- func (op *SplitOperation) ToCompact() (internal.CompactOperation, error)
- func (op *SplitOperation) ToJSON() (internal.Operation, error)
- func (op *SplitOperation) Validate() error
- type StartsOperation
- func (op *StartsOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *StartsOperation) Code() int
- func (op *StartsOperation) Not() bool
- func (op *StartsOperation) Op() internal.OpType
- func (op *StartsOperation) Path() []string
- func (op *StartsOperation) Test(doc any) (bool, error)
- func (op *StartsOperation) ToCompact() (internal.CompactOperation, error)
- func (op *StartsOperation) ToJSON() (internal.Operation, error)
- func (op *StartsOperation) Validate() error
- type StrDelOperation
- func (op *StrDelOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *StrDelOperation) Code() int
- func (op *StrDelOperation) Op() internal.OpType
- func (op *StrDelOperation) ToCompact() (internal.CompactOperation, error)
- func (op *StrDelOperation) ToJSON() (internal.Operation, error)
- func (op *StrDelOperation) Validate() error
- type StrInsOperation
- func (op *StrInsOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *StrInsOperation) Code() int
- func (op *StrInsOperation) Op() internal.OpType
- func (op *StrInsOperation) ToCompact() (internal.CompactOperation, error)
- func (op *StrInsOperation) ToJSON() (internal.Operation, error)
- func (op *StrInsOperation) Validate() error
- type TestOperation
- func (o *TestOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *TestOperation) Code() int
- func (o *TestOperation) Not() bool
- func (o *TestOperation) Op() internal.OpType
- func (o *TestOperation) Path() []string
- func (o *TestOperation) Test(doc interface{}) (bool, error)
- func (o *TestOperation) ToCompact() (internal.CompactOperation, error)
- func (o *TestOperation) ToJSON() (internal.Operation, error)
- func (o *TestOperation) Validate() error
- type TestStringLenOperation
- func (op *TestStringLenOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *TestStringLenOperation) Code() int
- func (op *TestStringLenOperation) Not() bool
- func (op *TestStringLenOperation) Op() internal.OpType
- func (op *TestStringLenOperation) Path() []string
- func (op *TestStringLenOperation) Test(doc any) (bool, error)
- func (op *TestStringLenOperation) ToCompact() (internal.CompactOperation, error)
- func (op *TestStringLenOperation) ToJSON() (internal.Operation, error)
- func (op *TestStringLenOperation) Validate() error
- type TestStringOperation
- func NewOpTestStringOperation(path []string, expectedValue string) *TestStringOperation
- func NewOpTestStringOperationWithIgnoreCase(path []string, expectedValue string, pos float64, notFlag bool, ...) *TestStringOperation
- func NewOpTestStringOperationWithPos(path []string, expectedValue string, pos float64) *TestStringOperation
- func NewOpTestStringOperationWithPosAndNot(path []string, expectedValue string, pos float64, notFlag bool) *TestStringOperation
- func (op *TestStringOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *TestStringOperation) Code() int
- func (op *TestStringOperation) Not() bool
- func (op *TestStringOperation) Op() internal.OpType
- func (op *TestStringOperation) Path() []string
- func (op *TestStringOperation) Test(doc any) (bool, error)
- func (op *TestStringOperation) ToCompact() (internal.CompactOperation, error)
- func (op *TestStringOperation) ToJSON() (internal.Operation, error)
- func (op *TestStringOperation) Validate() error
- type TestTypeOperation
- func (op *TestTypeOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *TestTypeOperation) Code() int
- func (op *TestTypeOperation) Not() bool
- func (op *TestTypeOperation) Op() internal.OpType
- func (op *TestTypeOperation) Path() []string
- func (op *TestTypeOperation) Test(doc any) (bool, error)
- func (op *TestTypeOperation) ToCompact() (internal.CompactOperation, error)
- func (op *TestTypeOperation) ToJSON() (internal.Operation, error)
- func (op *TestTypeOperation) Validate() error
- type TypeOperation
- func (op *TypeOperation) Apply(doc any) (internal.OpResult[any], error)
- func (op *TypeOperation) Code() int
- func (op *TypeOperation) Not() bool
- func (op *TypeOperation) Op() internal.OpType
- func (op *TypeOperation) Path() []string
- func (op *TypeOperation) Test(doc any) (bool, error)
- func (op *TypeOperation) ToCompact() (internal.CompactOperation, error)
- func (op *TypeOperation) ToJSON() (internal.Operation, error)
- func (op *TypeOperation) Validate() error
- type UndefinedOperation
- func (o *UndefinedOperation) Apply(doc any) (internal.OpResult[any], error)
- func (o *UndefinedOperation) Code() int
- func (o *UndefinedOperation) Not() bool
- func (o *UndefinedOperation) Op() internal.OpType
- func (o *UndefinedOperation) Path() []string
- func (o *UndefinedOperation) Test(doc interface{}) (bool, error)
- func (o *UndefinedOperation) ToCompact() (internal.CompactOperation, error)
- func (o *UndefinedOperation) ToJSON() (internal.Operation, error)
- func (o *UndefinedOperation) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( // NewContains creates a new contains operation NewContains = NewOpContainsOperation // NewContainsWithIgnoreCase creates a new contains operation with ignore case NewContainsWithIgnoreCase = NewOpContainsOperationWithIgnoreCase )
Short aliases for common use
var ( // NewEnds creates a new ends operation NewEnds = NewOpEndsOperation // NewEndsWithIgnoreCase creates a new ends operation with ignore case NewEndsWithIgnoreCase = NewOpEndsOperationWithIgnoreCase )
Short aliases for common use
var ( // Core path errors ErrPathNotFound = errors.New("path not found") ErrPathDoesNotExist = errors.New("path does not exist") ErrInvalidPath = errors.New("invalid path") ErrPathEmpty = errors.New("path cannot be empty") ErrFromPathEmpty = errors.New("from path cannot be empty") ErrPathsIdentical = errors.New("cannot move into own children") // Array operation errors ErrArrayIndexOutOfBounds = errors.New("array index out of bounds") ErrIndexOutOfRange = errors.New("index out of range") ErrNotAnArray = errors.New("not an array") ErrArrayTooSmall = errors.New("array must have at least 2 elements") ErrPositionOutOfBounds = errors.New("position out of bounds") ErrPositionNegative = errors.New("position cannot be negative") ErrInvalidTarget = errors.New("invalid target") // Type validation errors ErrNotString = errors.New("value is not a string") ErrNotNumber = errors.New("value must be a number") ErrNotObject = errors.New("value is not an object") ErrInvalidType = errors.New("invalid type") ErrEmptyTypeList = errors.New("empty type list") ErrContainsValueMustBeString = errors.New("contains operation value must be a string") // Operation execution errors ErrTestFailed = errors.New("test failed") ErrDefinedTestFailed = errors.New("defined test failed") ErrUndefinedTestFailed = errors.New("undefined test failed") ErrAndTestFailed = errors.New("and test failed") ErrOrTestFailed = errors.New("or test failed") ErrNotTestFailed = errors.New("not test failed") // Value operation errors ErrCannotReplace = errors.New("NOT_FOUND") ErrCannotAddToValue = errors.New("cannot add to non-object/non-array value") ErrCannotRemoveFromValue = errors.New("cannot remove from non-object/non-array document") ErrPathMissingRecursive = errors.New("NOT_FOUND") ErrCannotMoveIntoChildren = errors.New("cannot move into own children") ErrPropertiesNil = errors.New("properties cannot be nil") ErrValuesArrayEmpty = errors.New("'in' operation 'value' must be an array") // Key type errors ErrInvalidKeyTypeMap = errors.New("invalid key type for map") ErrInvalidKeyTypeSlice = errors.New("invalid key type for slice") ErrUnsupportedParentType = errors.New("unsupported parent type") // String operation errors ErrPositionOutOfStringRange = errors.New("position out of string range") ErrSubstringTooLong = errors.New("value too long") ErrSubstringMismatch = errors.New("substring does not match") ErrStringLengthMismatch = errors.New("string length mismatch") ErrPatternEmpty = errors.New("pattern cannot be empty") ErrLengthNegative = errors.New("length cannot be negative") // Type comparison errors ErrTypeMismatch = errors.New("type mismatch") ErrContainsMismatch = errors.New("contains check failed") // Predicate operation errors ErrInvalidPredicateInAnd = errors.New("invalid predicate in and operation") ErrInvalidPredicateInNot = errors.New("invalid predicate in not operation") ErrInvalidPredicateInOr = errors.New("invalid predicate in or operation") ErrAndNoOperands = errors.New("and operation requires at least one operand") ErrNotNoOperands = errors.New("not operation requires operands") ErrOrNoOperands = errors.New("or operation requires at least one operand") // Operation modification errors ErrCannotModifyRootArray = errors.New("cannot modify root array directly") ErrCannotUpdateParent = errors.New("cannot update parent") ErrCannotUpdateGrandparent = errors.New("cannot update grandparent") ErrCannotAppendInPlace = errors.New("cannot append to slice in place - caller must handle") ErrSliceDeletionNotSupported = errors.New("slice deletion not supported in place - caller must handle") ErrKeyDoesNotExist = errors.New("key does not exist") // Value conversion errors ErrCannotConvertNilToString = errors.New("cannot convert nil to string") // Test operation errors ErrTestOperationNumberStringMismatch = errors.New("number is not equal to string") ErrTestOperationStringNotEquivalent = errors.New("string not equivalent") // Base errors for dynamic wrapping with fmt.Errorf ErrComparisonFailed = errors.New("comparison failed") ErrStringMismatch = errors.New("string mismatch") ErrTestOperationFailed = errors.New("test operation failed") ErrInvalidIndex = errors.New("invalid index") ErrRegexPattern = errors.New("regex pattern error") ErrOperationFailed = errors.New("operation failed") )
Sentinel errors for path and validation related operations
var ( // NewNot creates a new not operation NewNot = NewOpNotOperation // NewNotMultiple creates a new not operation with multiple operands NewNotMultiple = NewOpNotOperationMultiple )
Short aliases for common use
var ( // NewRemove creates a new remove operation NewRemove = NewOpRemoveOperation // NewRemoveWithOldValue creates a new remove operation with old value NewRemoveWithOldValue = NewOpRemoveOperationWithOldValue )
Short aliases for common use
var ( // NewReplace creates a new replace operation NewReplace = NewOpReplaceOperation // NewReplaceWithOldValue creates a new replace operation with old value NewReplaceWithOldValue = NewOpReplaceOperationWithOldValue )
Short aliases for common use
var ( // NewStarts creates a new starts operation NewStarts = NewOpStartsOperation // NewStartsWithIgnoreCase creates a new starts operation with ignore case NewStartsWithIgnoreCase = NewOpStartsOperationWithIgnoreCase )
Short aliases for common use
var ( // NewStrDel creates a new string delete operation NewStrDel = NewOpStrDelOperation // NewStrDelWithStr creates a new string delete operation with string NewStrDelWithStr = NewOpStrDelOperationWithStr )
Short aliases for common use
var ( // NewTestString creates a new test string operation NewTestString = NewOpTestStringOperation // NewTestStringWithPos creates a new test string operation with position NewTestStringWithPos = NewOpTestStringOperationWithPos )
Short aliases for common use
var ( // NewTestStringLen creates a new test string length operation NewTestStringLen = NewOpTestStringLenOperation // NewTestStringLenWithNot creates a new test string length operation with not flag NewTestStringLenWithNot = NewOpTestStringLenOperationWithNot )
Short aliases for common use
var ( // NewTestType creates a new test type operation NewTestType = NewOpTestTypeOperation // NewTestTypeMultiple creates a new test type operation with multiple types NewTestTypeMultiple = NewOpTestTypeOperationMultiple )
Short aliases for common use
var ( // NewAnd creates a new and operation NewAnd = NewOpAndOperation )
Short aliases for common use
var ( // NewCopy creates a new copy operation NewCopy = NewOpCopyOperation )
Short aliases for common use
var ( // NewDefined creates a new defined operation NewDefined = NewOpDefinedOperation )
Short aliases for common use
var ( // NewExtend creates a new extend operation NewExtend = NewOpExtendOperation )
Short aliases for common use
var ( // NewFlip creates a new flip operation NewFlip = NewOpFlipOperation )
Short aliases for common use
var ( // NewIn creates a new in operation NewIn = NewOpInOperation )
Short aliases for common use
var ( // NewInc creates a new inc operation NewInc = NewOpIncOperation )
Short aliases for common use
var ( // NewMatches creates a new matches operation NewMatches = NewOpMatchesOperation )
Short aliases for common use
var ( // NewMerge creates a new merge operation NewMerge = NewOpMergeOperation )
Short aliases for common use
var ( // NewMore creates a new more operation NewMore = NewOpMoreOperation )
Short aliases for common use
var ( // NewMove creates a new move operation NewMove = NewOpMoveOperation )
Short aliases for common use
var ( // NewOr creates a new or operation NewOr = NewOpOrOperation )
Short aliases for common use
var ( // NewSplit creates a new split operation NewSplit = NewOpSplitOperation )
Short aliases for common use
var ( // NewStrIns creates a new string insert operation NewStrIns = NewOpStrInsOperation )
Short aliases for common use
var ( // NewTest creates a new test operation NewTest = NewOpTestOperation )
Short aliases for common use
var ( // NewType creates a new type operation NewType = NewOpTypeOperation )
Short aliases for common use
var ( // NewUndefined creates a new undefined operation NewUndefined = NewOpUndefinedOperation )
Short aliases for common use
Functions ¶
func DeepClone ¶
func DeepClone(value interface{}) (interface{}, error)
DeepClone performs a deep clone of a value.
func IsMutationOp ¶
IsMutationOp checks if an operation type is a mutation operation.
func IsPredicateOp ¶
IsPredicateOp checks if an operation type is a predicate operation.
func IsSecondOrderPredicateOp ¶
IsSecondOrderPredicateOp checks if an operation type is a second-order predicate operation.
Types ¶
type AddOperation ¶ added in v0.4.3
type AddOperation struct {
BaseOp
Value interface{} `json:"value"` // Value to add
}
AddOperation represents an add operation that adds a value at a specified path.
func NewAdd ¶ added in v0.4.3
func NewAdd(path []string, value interface{}) *AddOperation
NewAdd creates a new AddOperation operation.
func (*AddOperation) Code ¶ added in v0.4.3
func (o *AddOperation) Code() int
Code returns the operation code.
func (*AddOperation) Op ¶ added in v0.4.3
func (o *AddOperation) Op() internal.OpType
Op returns the operation type.
func (*AddOperation) Path ¶ added in v0.4.3
func (o *AddOperation) Path() []string
Path returns the operation path.
func (*AddOperation) ToCompact ¶ added in v0.4.3
func (o *AddOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*AddOperation) ToJSON ¶ added in v0.4.3
func (o *AddOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*AddOperation) Validate ¶ added in v0.4.3
func (o *AddOperation) Validate() error
Validate validates the add operation.
type AndOperation ¶ added in v0.4.3
type AndOperation struct {
BaseOp
Operations []interface{} `json:"apply"` // Array of operations to apply
}
AndOperation represents an and operation that combines multiple predicate operations.
func NewOpAndOperation ¶
func NewOpAndOperation(path []string, ops []interface{}) *AndOperation
NewOpAndOperation creates a new AndOperation operation.
func (*AndOperation) Code ¶ added in v0.4.3
func (o *AndOperation) Code() int
Code returns the operation code.
func (*AndOperation) Not ¶ added in v0.4.3
func (o *AndOperation) Not() bool
Not returns false since this is not a NOT operation.
func (*AndOperation) Op ¶ added in v0.4.3
func (o *AndOperation) Op() internal.OpType
Op returns the operation type.
func (*AndOperation) Ops ¶ added in v0.4.3
func (o *AndOperation) Ops() []internal.PredicateOp
Ops returns the predicate operations.
func (*AndOperation) Path ¶ added in v0.4.3
func (o *AndOperation) Path() []string
Path returns the path for the AND operation.
func (*AndOperation) Test ¶ added in v0.4.3
func (o *AndOperation) Test(doc interface{}) (bool, error)
Test performs the AND operation.
func (*AndOperation) ToCompact ¶ added in v0.4.3
func (o *AndOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*AndOperation) ToJSON ¶ added in v0.4.3
func (o *AndOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*AndOperation) Validate ¶ added in v0.4.3
func (o *AndOperation) Validate() error
Validate validates the AND operation.
type BaseOp ¶
type BaseOp struct {
// contains filtered or unexported fields
}
BaseOp provides common functionality for all operations.
func NewBaseOpWithFrom ¶
NewBaseOpWithFrom creates a new BaseOp with path and from path.
type ContainsOperation ¶ added in v0.4.3
type ContainsOperation struct {
BaseOp
Value string `json:"value"` // Substring to search for
IgnoreCase bool `json:"ignore_case"` // Whether to ignore case when comparing
NotFlag bool `json:"not"` // Whether to negate the result
}
ContainsOperation represents a contains operation that tests if a string contains a substring.
func NewOpContainsOperation ¶
func NewOpContainsOperation(path []string, substring string) *ContainsOperation
NewOpContainsOperation creates a new OpContainsOperation operation.
func NewOpContainsOperationWithFlags ¶ added in v0.5.1
func NewOpContainsOperationWithFlags(path []string, substring string, ignoreCase bool, notFlag bool) *ContainsOperation
NewOpContainsOperationWithFlags creates a new OpContainsOperation operation with full options.
func NewOpContainsOperationWithIgnoreCase ¶
func NewOpContainsOperationWithIgnoreCase(path []string, substring string, ignoreCase bool) *ContainsOperation
NewOpContainsOperationWithIgnoreCase creates a new OpContainsOperation operation with ignore case option.
func (*ContainsOperation) Apply ¶ added in v0.4.3
Apply applies the contains test operation to the document.
func (*ContainsOperation) Code ¶ added in v0.4.3
func (op *ContainsOperation) Code() int
Code returns the operation code.
func (*ContainsOperation) Not ¶ added in v0.4.3
func (op *ContainsOperation) Not() bool
Not returns the negation flag.
func (*ContainsOperation) Op ¶ added in v0.4.3
func (op *ContainsOperation) Op() internal.OpType
Op returns the operation type.
func (*ContainsOperation) Path ¶ added in v0.4.3
func (op *ContainsOperation) Path() []string
Path returns the path for the contains operation.
func (*ContainsOperation) Test ¶ added in v0.4.3
func (op *ContainsOperation) Test(doc any) (bool, error)
Test performs the contains test operation.
func (*ContainsOperation) ToCompact ¶ added in v0.4.3
func (op *ContainsOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*ContainsOperation) ToJSON ¶ added in v0.4.3
func (op *ContainsOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*ContainsOperation) Validate ¶ added in v0.4.3
func (op *ContainsOperation) Validate() error
Validate validates the contains operation.
type CopyOperation ¶ added in v0.4.3
CopyOperation represents a copy operation that copies a value from one path to another.
func NewOpCopyOperation ¶
func NewOpCopyOperation(path, from []string) *CopyOperation
NewOpCopyOperation creates a new OpCopyOperation operation.
func (*CopyOperation) Code ¶ added in v0.4.3
func (o *CopyOperation) Code() int
Code returns the operation code.
func (*CopyOperation) From ¶ added in v0.4.3
func (o *CopyOperation) From() []string
From returns the source path.
func (*CopyOperation) Op ¶ added in v0.4.3
func (o *CopyOperation) Op() internal.OpType
Op returns the operation type.
func (*CopyOperation) ToCompact ¶ added in v0.4.3
func (o *CopyOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*CopyOperation) ToJSON ¶ added in v0.4.3
func (o *CopyOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*CopyOperation) Validate ¶ added in v0.4.3
func (o *CopyOperation) Validate() error
Validate validates the copy operation.
type DefinedOperation ¶ added in v0.4.3
type DefinedOperation struct {
BaseOp
}
DefinedOperation represents a test operation that checks if a path is defined.
func NewOpDefinedOperation ¶
func NewOpDefinedOperation(path []string) *DefinedOperation
NewOpDefinedOperation creates a new OpDefinedOperation operation.
func (*DefinedOperation) Code ¶ added in v0.4.3
func (o *DefinedOperation) Code() int
Code returns the operation code.
func (*DefinedOperation) Not ¶ added in v0.4.3
func (o *DefinedOperation) Not() bool
Not returns false (defined operation doesn't support not modifier).
func (*DefinedOperation) Op ¶ added in v0.4.3
func (o *DefinedOperation) Op() internal.OpType
Op returns the operation type.
func (*DefinedOperation) Path ¶ added in v0.4.3
func (o *DefinedOperation) Path() []string
Path returns the path for the defined operation.
func (*DefinedOperation) Test ¶ added in v0.4.3
func (o *DefinedOperation) Test(doc interface{}) (bool, error)
Test performs the defined operation.
func (*DefinedOperation) ToCompact ¶ added in v0.4.3
func (o *DefinedOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*DefinedOperation) ToJSON ¶ added in v0.4.3
func (o *DefinedOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*DefinedOperation) Validate ¶ added in v0.4.3
func (o *DefinedOperation) Validate() error
Validate validates the defined operation.
type EndsOperation ¶ added in v0.4.3
type EndsOperation struct {
BaseOp
Value string `json:"value"` // Expected suffix
IgnoreCase bool `json:"ignore_case"` // Whether to ignore case
NotFlag bool `json:"not"` // Whether to negate the result
}
EndsOperation represents a test operation that checks if a string value ends with a specific suffix.
func NewOpEndsOperation ¶
func NewOpEndsOperation(path []string, suffix string) *EndsOperation
NewOpEndsOperation creates a new OpEndsOperation operation.
func NewOpEndsOperationWithIgnoreCase ¶
func NewOpEndsOperationWithIgnoreCase(path []string, suffix string, ignoreCase bool) *EndsOperation
NewOpEndsOperationWithIgnoreCase creates a new OpEndsOperation operation with ignore case option.
func (*EndsOperation) Apply ¶ added in v0.4.3
Apply applies the ends test operation to the document.
func (*EndsOperation) Code ¶ added in v0.4.3
func (op *EndsOperation) Code() int
Code returns the operation code.
func (*EndsOperation) Not ¶ added in v0.5.1
func (op *EndsOperation) Not() bool
Not returns the negation flag for this operation.
func (*EndsOperation) Op ¶ added in v0.4.3
func (op *EndsOperation) Op() internal.OpType
Op returns the operation type.
func (*EndsOperation) Path ¶ added in v0.4.3
func (op *EndsOperation) Path() []string
Path returns the operation path.
func (*EndsOperation) Test ¶ added in v0.4.3
func (op *EndsOperation) Test(doc any) (bool, error)
Test evaluates the ends predicate condition.
func (*EndsOperation) ToCompact ¶ added in v0.4.3
func (op *EndsOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*EndsOperation) ToJSON ¶ added in v0.4.3
func (op *EndsOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*EndsOperation) Validate ¶ added in v0.4.3
func (op *EndsOperation) Validate() error
Validate validates the ends operation.
type ExtendOperation ¶ added in v0.4.3
type ExtendOperation struct {
BaseOp
Properties map[string]interface{} `json:"props"` // Properties to add
DeleteNull bool `json:"deleteNull"` // Whether to delete null properties
}
ExtendOperation represents an object extend operation. path: target path props: properties to add/update deleteNull: whether to delete properties with null values Only supports object type fields.
func NewOpExtendOperation ¶
func NewOpExtendOperation(path []string, properties map[string]interface{}, deleteNull bool) *ExtendOperation
NewOpExtendOperation creates a new object extend operation.
func (*ExtendOperation) Code ¶ added in v0.4.3
func (op *ExtendOperation) Code() int
Code returns the operation code.
func (*ExtendOperation) Op ¶ added in v0.4.3
func (op *ExtendOperation) Op() internal.OpType
Op returns the operation type.
func (*ExtendOperation) ToCompact ¶ added in v0.4.3
func (op *ExtendOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*ExtendOperation) ToJSON ¶ added in v0.4.3
func (op *ExtendOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*ExtendOperation) Validate ¶ added in v0.4.3
func (op *ExtendOperation) Validate() error
Validate validates the extend operation.
type FlipOperation ¶ added in v0.4.3
type FlipOperation struct {
BaseOp
}
FlipOperation represents a flip operation that inverts boolean values or converts other types to boolean and then inverts them
func NewOpFlipOperation ¶
func NewOpFlipOperation(path []string) *FlipOperation
NewOpFlipOperation creates a new flip operation
func (*FlipOperation) Code ¶ added in v0.4.3
func (op *FlipOperation) Code() int
Code returns the operation code
func (*FlipOperation) Op ¶ added in v0.4.3
func (op *FlipOperation) Op() internal.OpType
Op returns the operation type
func (*FlipOperation) ToCompact ¶ added in v0.4.3
func (op *FlipOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*FlipOperation) ToJSON ¶ added in v0.4.3
func (op *FlipOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*FlipOperation) Validate ¶ added in v0.4.3
func (op *FlipOperation) Validate() error
Validate validates the flip operation.
type InOperation ¶ added in v0.4.3
type InOperation struct {
BaseOp
Value []interface{} `json:"value"` // Array of values to check against
}
InOperation represents a test operation that checks if a value is present in a specified array.
func NewOpInOperation ¶
func NewOpInOperation(path []string, values []interface{}) *InOperation
NewOpInOperation creates a new OpInOperation operation.
func (*InOperation) Code ¶ added in v0.4.3
func (op *InOperation) Code() int
Code returns the operation code.
func (*InOperation) Not ¶ added in v0.4.3
func (op *InOperation) Not() bool
Not returns false since this is not a NOT operation.
func (*InOperation) Op ¶ added in v0.4.3
func (op *InOperation) Op() internal.OpType
Op returns the operation type.
func (*InOperation) Path ¶ added in v0.4.3
func (op *InOperation) Path() []string
Path returns the operation path.
func (*InOperation) Test ¶ added in v0.4.3
func (op *InOperation) Test(doc any) (bool, error)
Test evaluates the in predicate condition.
func (*InOperation) ToCompact ¶ added in v0.4.3
func (op *InOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*InOperation) ToJSON ¶ added in v0.4.3
func (op *InOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*InOperation) Validate ¶ added in v0.4.3
func (op *InOperation) Validate() error
Validate validates the in operation.
type IncOperation ¶ added in v0.4.3
IncOperation represents an increment operation that increments a numeric value.
func NewOpIncOperation ¶
func NewOpIncOperation(path []string, inc float64) *IncOperation
NewOpIncOperation creates a new OpIncOperation operation.
func (*IncOperation) Code ¶ added in v0.4.3
func (op *IncOperation) Code() int
Code returns the operation code.
func (*IncOperation) Op ¶ added in v0.4.3
func (op *IncOperation) Op() internal.OpType
Op returns the operation type.
func (*IncOperation) Path ¶ added in v0.4.3
func (op *IncOperation) Path() []string
Path returns the operation path.
func (*IncOperation) ToCompact ¶ added in v0.4.3
func (op *IncOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*IncOperation) ToJSON ¶ added in v0.4.3
func (op *IncOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*IncOperation) Validate ¶ added in v0.4.3
func (op *IncOperation) Validate() error
Validate validates the increment operation.
type LessOperation ¶ added in v0.4.3
LessOperation represents a test operation that checks if a numeric value is less than a specified value.
func NewOpLessOperation ¶
func NewOpLessOperation(path []string, value float64) *LessOperation
NewOpLessOperation creates a new OpLessOperation operation.
func (*LessOperation) Apply ¶ added in v0.4.3
Apply applies the less test operation to the document.
func (*LessOperation) Code ¶ added in v0.4.3
func (op *LessOperation) Code() int
Code returns the operation code.
func (*LessOperation) Not ¶ added in v0.4.3
func (op *LessOperation) Not() bool
Not returns false since this is not a NOT operation.
func (*LessOperation) Op ¶ added in v0.4.3
func (op *LessOperation) Op() internal.OpType
Op returns the operation type.
func (*LessOperation) Path ¶ added in v0.4.3
func (op *LessOperation) Path() []string
Path returns the path for the less operation.
func (*LessOperation) Test ¶ added in v0.4.3
func (op *LessOperation) Test(doc any) (bool, error)
Test evaluates the less predicate condition.
func (*LessOperation) ToCompact ¶ added in v0.4.3
func (op *LessOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*LessOperation) ToJSON ¶ added in v0.4.3
func (op *LessOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*LessOperation) Validate ¶ added in v0.4.3
func (op *LessOperation) Validate() error
Validate validates the less operation.
type MatchesOperation ¶ added in v0.4.3
type MatchesOperation struct {
BaseOp
Pattern string `json:"value"` // The regex pattern string
IgnoreCase bool `json:"ignore_case"` // Case insensitive flag
NotFlag bool `json:"not"` // Whether to negate the result
// contains filtered or unexported fields
}
MatchesOperation represents a "matches" predicate operation that checks if a string matches a regex pattern.
func NewOpMatchesOperation ¶
func NewOpMatchesOperation(path []string, pattern string, ignoreCase bool) (*MatchesOperation, error)
NewOpMatchesOperation creates a new matches operation.
func NewOpMatchesOperationWithFlags ¶ added in v0.5.1
func NewOpMatchesOperationWithFlags(path []string, pattern string, ignoreCase bool, notFlag bool) (*MatchesOperation, error)
NewOpMatchesOperationWithFlags creates a new matches operation with full options.
func (*MatchesOperation) Code ¶ added in v0.4.3
func (o *MatchesOperation) Code() int
Code returns the operation code.
func (*MatchesOperation) Not ¶ added in v0.5.1
func (o *MatchesOperation) Not() bool
Not returns the negation flag.
func (*MatchesOperation) Op ¶ added in v0.4.3
func (o *MatchesOperation) Op() internal.OpType
Op returns the operation type.
func (*MatchesOperation) Path ¶ added in v0.4.3
func (o *MatchesOperation) Path() []string
Path returns the path for the matches operation.
func (*MatchesOperation) Test ¶ added in v0.4.3
func (o *MatchesOperation) Test(doc interface{}) (bool, error)
Test evaluates the matches predicate condition.
func (*MatchesOperation) ToCompact ¶ added in v0.4.3
func (o *MatchesOperation) ToCompact() (internal.CompactOperation, error)
ToCompact converts the operation to compact array representation.
func (*MatchesOperation) ToJSON ¶ added in v0.4.3
func (o *MatchesOperation) ToJSON() (internal.Operation, error)
ToJSON converts the operation to JSON representation.
func (*MatchesOperation) Validate ¶ added in v0.4.3
func (o *MatchesOperation) Validate() error
Validate validates the matches operation.
type MergeOperation ¶ added in v0.4.3
type MergeOperation struct {
BaseOp
Pos float64 `json:"pos"` // Merge position
Props map[string]interface{} `json:"props"` // Properties to apply after merge
}
MergeOperation represents an array merge operation. path: target path pos: merge position (array index) props: properties to apply after merge (can be nil) Only supports array type fields.
func NewOpMergeOperation ¶
func NewOpMergeOperation(path []string, pos float64, props map[string]interface{}) *MergeOperation
NewOpMergeOperation creates a new array merge operation.
func (*MergeOperation) Apply ¶ added in v0.4.3
Apply applies the merge operation following TypeScript reference.
func (*MergeOperation) Code ¶ added in v0.4.3
func (op *MergeOperation) Code() int
Code returns the operation code.
func (*MergeOperation) Op ¶ added in v0.4.3
func (op *MergeOperation) Op() internal.OpType
Op returns the operation type.
func (*MergeOperation) Path ¶ added in v0.4.3
func (op *MergeOperation) Path() []string
Path returns the operation path.
func (*MergeOperation) ToCompact ¶ added in v0.4.3
func (op *MergeOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*MergeOperation) ToJSON ¶ added in v0.4.3
func (op *MergeOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*MergeOperation) Validate ¶ added in v0.4.3
func (op *MergeOperation) Validate() error
Validate validates the merge operation.
type MoreOperation ¶ added in v0.4.3
type MoreOperation struct {
BaseOp
Value float64 `json:"value"` // The number to compare against
NotFlag bool `json:"not"` // Whether to negate the result
}
MoreOperation represents a "more" predicate operation that checks if a value is greater than a specified number.
func NewOpMoreOperation ¶
func NewOpMoreOperation(path []string, value float64) *MoreOperation
NewOpMoreOperation creates a new more operation.
func NewOpMoreOperationWithFlags ¶ added in v0.5.1
func NewOpMoreOperationWithFlags(path []string, value float64, notFlag bool) *MoreOperation
NewOpMoreOperationWithFlags creates a new more operation with full options.
func (*MoreOperation) Code ¶ added in v0.4.3
func (o *MoreOperation) Code() int
Code returns the operation code.
func (*MoreOperation) Not ¶ added in v0.5.1
func (o *MoreOperation) Not() bool
Not returns the negation flag.
func (*MoreOperation) Op ¶ added in v0.4.3
func (o *MoreOperation) Op() internal.OpType
Op returns the operation type.
func (*MoreOperation) Path ¶ added in v0.4.3
func (o *MoreOperation) Path() []string
Path returns the path for the more operation.
func (*MoreOperation) Test ¶ added in v0.4.3
func (o *MoreOperation) Test(doc interface{}) (bool, error)
Test evaluates the more predicate condition.
func (*MoreOperation) ToCompact ¶ added in v0.4.3
func (o *MoreOperation) ToCompact() (internal.CompactOperation, error)
ToCompact converts the operation to compact array representation.
func (*MoreOperation) ToJSON ¶ added in v0.4.3
func (o *MoreOperation) ToJSON() (internal.Operation, error)
ToJSON converts the operation to JSON representation.
func (*MoreOperation) Validate ¶ added in v0.4.3
func (o *MoreOperation) Validate() error
Validate validates the more operation.
type MoveOperation ¶ added in v0.4.3
MoveOperation represents a move operation that moves a value from one path to another.
func NewOpMoveOperation ¶
func NewOpMoveOperation(path, from []string) *MoveOperation
NewOpMoveOperation creates a new OpMoveOperation operation.
func (*MoveOperation) Apply ¶ added in v0.4.3
Apply applies the move operation following RFC 6902: remove then add.
func (*MoveOperation) Code ¶ added in v0.4.3
func (o *MoveOperation) Code() int
Code returns the operation code.
func (*MoveOperation) From ¶ added in v0.4.3
func (o *MoveOperation) From() []string
From returns the source path.
func (*MoveOperation) Op ¶ added in v0.4.3
func (o *MoveOperation) Op() internal.OpType
Op returns the operation type.
func (*MoveOperation) ToCompact ¶ added in v0.4.3
func (o *MoveOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*MoveOperation) ToJSON ¶ added in v0.4.3
func (o *MoveOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*MoveOperation) Validate ¶ added in v0.4.3
func (o *MoveOperation) Validate() error
Validate validates the move operation.
type NotOperation ¶ added in v0.4.3
type NotOperation struct {
BaseOp
Operations []interface{} `json:"apply"` // Array of operations to apply (then negate)
}
NotOperation represents a logical NOT operation that negates predicates.
func NewOpNotOperation ¶
func NewOpNotOperation(operand internal.PredicateOp) *NotOperation
NewOpNotOperation creates a new NOT operation.
func NewOpNotOperationMultiple ¶
func NewOpNotOperationMultiple(path []string, ops []interface{}) *NotOperation
NewOpNotOperationMultiple creates a new NOT operation with multiple operands.
func (*NotOperation) Code ¶ added in v0.4.3
func (o *NotOperation) Code() int
Code returns the operation code.
func (*NotOperation) Not ¶ added in v0.4.3
func (o *NotOperation) Not() bool
Not returns true since this is a NOT operation.
func (*NotOperation) Op ¶ added in v0.4.3
func (o *NotOperation) Op() internal.OpType
Op returns the operation type.
func (*NotOperation) Ops ¶ added in v0.4.3
func (o *NotOperation) Ops() []internal.PredicateOp
Ops returns the operand operations.
func (*NotOperation) Path ¶ added in v0.4.3
func (o *NotOperation) Path() []string
Path returns the operation path.
func (*NotOperation) Test ¶ added in v0.4.3
func (o *NotOperation) Test(doc any) (bool, error)
Test evaluates the NOT predicate condition.
func (*NotOperation) ToCompact ¶ added in v0.4.3
func (o *NotOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*NotOperation) ToJSON ¶ added in v0.4.3
func (o *NotOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*NotOperation) Validate ¶ added in v0.4.3
func (o *NotOperation) Validate() error
Validate validates the NOT operation.
type OpAndOperation ¶
type OpAndOperation = AndOperation //nolint:revive // Backward compatibility alias
type OpContainsOperation ¶
type OpContainsOperation = ContainsOperation //nolint:revive // Backward compatibility alias
type OpCopyOperation ¶
type OpCopyOperation = CopyOperation //nolint:revive // Backward compatibility alias
type OpDefinedOperation ¶
type OpDefinedOperation = DefinedOperation //nolint:revive // Backward compatibility alias
type OpEndsOperation ¶
type OpEndsOperation = EndsOperation //nolint:revive // Backward compatibility alias
type OpExtendOperation ¶
type OpExtendOperation = ExtendOperation //nolint:revive // Backward compatibility alias
type OrOperation ¶ added in v0.4.3
type OrOperation struct {
BaseOp
Operations []interface{} `json:"apply"` // Array of operations to apply
}
OrOperation represents an OR operation that combines multiple predicate operations.
func NewOpOrOperation ¶
func NewOpOrOperation(path []string, ops []interface{}) *OrOperation
NewOpOrOperation creates a new OpOrOperation operation.
func (*OrOperation) Code ¶ added in v0.4.3
func (o *OrOperation) Code() int
Code returns the operation code.
func (*OrOperation) Not ¶ added in v0.4.3
func (o *OrOperation) Not() bool
Not returns false since this is not a NOT operation.
func (*OrOperation) Op ¶ added in v0.4.3
func (o *OrOperation) Op() internal.OpType
Op returns the operation type.
func (*OrOperation) Ops ¶ added in v0.4.3
func (o *OrOperation) Ops() []internal.PredicateOp
Ops returns the predicate operations.
func (*OrOperation) Path ¶ added in v0.4.3
func (o *OrOperation) Path() []string
Path returns the path for the OR operation.
func (*OrOperation) Test ¶ added in v0.4.3
func (o *OrOperation) Test(doc interface{}) (bool, error)
Test performs the OR operation.
func (*OrOperation) ToCompact ¶ added in v0.4.3
func (o *OrOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*OrOperation) ToJSON ¶ added in v0.4.3
func (o *OrOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*OrOperation) Validate ¶ added in v0.4.3
func (o *OrOperation) Validate() error
Validate validates the OR operation.
type PredicateOp ¶
type PredicateOp = internal.PredicateOp
PredicateOp represents predicate operations used for testing conditions.
type PredicateOpBase ¶
type PredicateOpBase struct {
BaseOp
// contains filtered or unexported fields
}
PredicateOpBase provides common functionality for predicate operations.
func NewPredicateOp ¶
func NewPredicateOp(path []string, not bool) PredicateOpBase
NewPredicateOp creates a new PredicateOpBase.
type RemoveOperation ¶ added in v0.4.3
type RemoveOperation struct {
BaseOp
OldValue interface{} `json:"oldValue,omitempty"` // The value that was removed (optional)
HasOldValue bool // Whether oldValue is explicitly set
}
RemoveOperation represents a remove operation that removes a value at a specified path.
func NewOpRemoveOperation ¶
func NewOpRemoveOperation(path []string) *RemoveOperation
NewOpRemoveOperation creates a new OpRemoveOperation operation.
func NewOpRemoveOperationWithOldValue ¶
func NewOpRemoveOperationWithOldValue(path []string, oldValue interface{}) *RemoveOperation
NewOpRemoveOperationWithOldValue creates a new OpRemoveOperation operation with oldValue.
func (*RemoveOperation) Code ¶ added in v0.4.3
func (o *RemoveOperation) Code() int
Code returns the operation code.
func (*RemoveOperation) Op ¶ added in v0.4.3
func (o *RemoveOperation) Op() internal.OpType
Op returns the operation type.
func (*RemoveOperation) Path ¶ added in v0.4.3
func (o *RemoveOperation) Path() []string
Path returns the operation path.
func (*RemoveOperation) ToCompact ¶ added in v0.4.3
func (o *RemoveOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*RemoveOperation) ToJSON ¶ added in v0.4.3
func (o *RemoveOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*RemoveOperation) Validate ¶ added in v0.4.3
func (o *RemoveOperation) Validate() error
Validate validates the remove operation.
type ReplaceOperation ¶ added in v0.4.3
type ReplaceOperation struct {
BaseOp
Value interface{} `json:"value"` // New value
OldValue interface{} `json:"oldValue,omitempty"` // The value that was replaced (optional)
}
ReplaceOperation represents a replace operation that replaces a value at a specified path.
func NewOpReplaceOperation ¶
func NewOpReplaceOperation(path []string, value interface{}) *ReplaceOperation
NewOpReplaceOperation creates a new OpReplaceOperation operation.
func NewOpReplaceOperationWithOldValue ¶
func NewOpReplaceOperationWithOldValue(path []string, value interface{}, oldValue interface{}) *ReplaceOperation
NewOpReplaceOperationWithOldValue creates a new OpReplaceOperation operation with oldValue.
func (*ReplaceOperation) Apply ¶ added in v0.4.3
Apply applies the replace operation to the document.
func (*ReplaceOperation) Code ¶ added in v0.4.3
func (o *ReplaceOperation) Code() int
Code returns the operation code.
func (*ReplaceOperation) Op ¶ added in v0.4.3
func (o *ReplaceOperation) Op() internal.OpType
Op returns the operation type.
func (*ReplaceOperation) Path ¶ added in v0.4.3
func (o *ReplaceOperation) Path() []string
Path returns the operation path.
func (*ReplaceOperation) ToCompact ¶ added in v0.4.3
func (o *ReplaceOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*ReplaceOperation) ToJSON ¶ added in v0.4.3
func (o *ReplaceOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*ReplaceOperation) Validate ¶ added in v0.4.3
func (o *ReplaceOperation) Validate() error
Validate validates the replace operation.
type SecondOrderPredicateOp ¶
type SecondOrderPredicateOp = internal.SecondOrderPredicateOp
SecondOrderPredicateOp represents operations that combine multiple predicate operations.
type SplitOperation ¶ added in v0.4.3
type SplitOperation struct {
BaseOp
Pos float64 `json:"pos"` // Split position
Props interface{} `json:"props"` // Properties to apply after split
}
SplitOperation represents a string split operation. path: target path pos: split position (rune index) props: properties to apply after split (can be nil) Only supports string type fields.
func NewOpSplitOperation ¶
func NewOpSplitOperation(path []string, pos float64, props interface{}) *SplitOperation
NewOpSplitOperation creates a new string split operation.
func (*SplitOperation) Apply ¶ added in v0.4.3
Apply applies the split operation following TypeScript reference.
func (*SplitOperation) Code ¶ added in v0.4.3
func (op *SplitOperation) Code() int
Code returns the operation code.
func (*SplitOperation) Op ¶ added in v0.4.3
func (op *SplitOperation) Op() internal.OpType
Op returns the operation type.
func (*SplitOperation) Path ¶ added in v0.4.3
func (op *SplitOperation) Path() []string
Path returns the operation path.
func (*SplitOperation) ToCompact ¶ added in v0.4.3
func (op *SplitOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*SplitOperation) ToJSON ¶ added in v0.4.3
func (op *SplitOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*SplitOperation) Validate ¶ added in v0.4.3
func (op *SplitOperation) Validate() error
Validate validates the split operation.
type StartsOperation ¶ added in v0.4.3
type StartsOperation struct {
BaseOp
Value string `json:"value"` // Expected prefix
IgnoreCase bool `json:"ignore_case"` // Whether to ignore case
NotFlag bool `json:"not"` // Whether to negate the result
}
StartsOperation represents a test operation that checks if a string value starts with a specific prefix.
func NewOpStartsOperation ¶
func NewOpStartsOperation(path []string, prefix string) *StartsOperation
NewOpStartsOperation creates a new OpStartsOperation operation.
func NewOpStartsOperationWithIgnoreCase ¶
func NewOpStartsOperationWithIgnoreCase(path []string, prefix string, ignoreCase bool) *StartsOperation
NewOpStartsOperationWithIgnoreCase creates a new OpStartsOperation operation with ignore case option.
func NewOpStartsOperationWithNot ¶ added in v0.5.1
func NewOpStartsOperationWithNot(path []string, prefix string, not bool) *StartsOperation
NewOpStartsOperationWithNot creates a new OpStartsOperation operation with negation.
func (*StartsOperation) Apply ¶ added in v0.4.3
Apply applies the starts test operation to the document.
func (*StartsOperation) Code ¶ added in v0.4.3
func (op *StartsOperation) Code() int
Code returns the operation code.
func (*StartsOperation) Not ¶ added in v0.5.1
func (op *StartsOperation) Not() bool
Not returns the negation flag for this operation.
func (*StartsOperation) Op ¶ added in v0.4.3
func (op *StartsOperation) Op() internal.OpType
Op returns the operation type.
func (*StartsOperation) Path ¶ added in v0.4.3
func (op *StartsOperation) Path() []string
Path returns the operation path.
func (*StartsOperation) Test ¶ added in v0.4.3
func (op *StartsOperation) Test(doc any) (bool, error)
Test evaluates the starts predicate condition.
func (*StartsOperation) ToCompact ¶ added in v0.4.3
func (op *StartsOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*StartsOperation) ToJSON ¶ added in v0.4.3
func (op *StartsOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*StartsOperation) Validate ¶ added in v0.4.3
func (op *StartsOperation) Validate() error
Validate validates the starts operation.
type StrDelOperation ¶ added in v0.4.3
type StrDelOperation struct {
BaseOp
Pos float64 `json:"pos"` // Delete position
Len float64 `json:"len"` // Number of characters to delete
Str string `json:"str"` // Specific string to delete (optional)
}
StrDelOperation represents a string delete operation. path: target path pos: start position (rune index) len: number of runes to delete (when Str is empty) str: specific string to delete (when not empty, takes precedence) Only supports string type fields.
func NewOpStrDelOperation ¶
func NewOpStrDelOperation(path []string, pos, length float64) *StrDelOperation
NewOpStrDelOperation creates a new string delete operation with length.
func NewOpStrDelOperationWithStr ¶
func NewOpStrDelOperationWithStr(path []string, pos float64, str string) *StrDelOperation
NewOpStrDelOperationWithStr creates a new string delete operation with specific string.
func (*StrDelOperation) Code ¶ added in v0.4.3
func (op *StrDelOperation) Code() int
Code returns the operation code.
func (*StrDelOperation) Op ¶ added in v0.4.3
func (op *StrDelOperation) Op() internal.OpType
Op returns the operation type.
func (*StrDelOperation) ToCompact ¶ added in v0.4.3
func (op *StrDelOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*StrDelOperation) ToJSON ¶ added in v0.4.3
func (op *StrDelOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*StrDelOperation) Validate ¶ added in v0.4.3
func (op *StrDelOperation) Validate() error
Validate validates the string delete operation.
type StrInsOperation ¶ added in v0.4.3
type StrInsOperation struct {
BaseOp
Pos float64 `json:"pos"` // Insert position
Str string `json:"str"` // String to insert
}
StrInsOperation represents a string insert operation. path: target path pos: insert position (rune index) str: string to insert Only supports string type fields.
func NewOpStrInsOperation ¶
func NewOpStrInsOperation(path []string, pos float64, str string) *StrInsOperation
NewOpStrInsOperation creates a new string insert operation.
func (*StrInsOperation) Code ¶ added in v0.4.3
func (op *StrInsOperation) Code() int
Code returns the operation code.
func (*StrInsOperation) Op ¶ added in v0.4.3
func (op *StrInsOperation) Op() internal.OpType
Op returns the operation type.
func (*StrInsOperation) ToCompact ¶ added in v0.4.3
func (op *StrInsOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*StrInsOperation) ToJSON ¶ added in v0.4.3
func (op *StrInsOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*StrInsOperation) Validate ¶ added in v0.4.3
func (op *StrInsOperation) Validate() error
Validate validates the string insert operation.
type TestOperation ¶ added in v0.4.3
type TestOperation struct {
BaseOp
Value interface{} `json:"value"` // Expected value
NotFlag bool `json:"not,omitempty"` // Whether to negate the test
}
TestOperation represents a test operation that checks if a value equals a specified value.
func NewOpTestOperation ¶
func NewOpTestOperation(path []string, value interface{}) *TestOperation
NewOpTestOperation creates a new OpTestOperation operation.
func (*TestOperation) Code ¶ added in v0.4.3
func (o *TestOperation) Code() int
Code returns the operation code.
func (*TestOperation) Not ¶ added in v0.4.3
func (o *TestOperation) Not() bool
Not returns whether this operation is negated.
func (*TestOperation) Op ¶ added in v0.4.3
func (o *TestOperation) Op() internal.OpType
Op returns the operation type.
func (*TestOperation) Path ¶ added in v0.4.3
func (o *TestOperation) Path() []string
Path returns the operation path.
func (*TestOperation) Test ¶ added in v0.4.3
func (o *TestOperation) Test(doc interface{}) (bool, error)
Test performs the test operation.
func (*TestOperation) ToCompact ¶ added in v0.4.3
func (o *TestOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*TestOperation) ToJSON ¶ added in v0.4.3
func (o *TestOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*TestOperation) Validate ¶ added in v0.4.3
func (o *TestOperation) Validate() error
Validate validates the test operation.
type TestStringLenOperation ¶ added in v0.4.3
type TestStringLenOperation struct {
BaseOp
Length float64 `json:"len"` // Expected string length
NotFlag bool `json:"not"` // Whether to negate the result
}
TestStringLenOperation represents a test operation that checks if a string value has a specific length.
func NewOpTestStringLenOperation ¶
func NewOpTestStringLenOperation(path []string, expectedLength float64) *TestStringLenOperation
NewOpTestStringLenOperation creates a new OpTestStringLenOperation operation.
func NewOpTestStringLenOperationWithNot ¶
func NewOpTestStringLenOperationWithNot(path []string, expectedLength float64, not bool) *TestStringLenOperation
NewOpTestStringLenOperationWithNot creates a new OpTestStringLenOperation operation with not flag.
func (*TestStringLenOperation) Apply ¶ added in v0.4.3
Apply applies the test string length operation to the document.
func (*TestStringLenOperation) Code ¶ added in v0.4.3
func (op *TestStringLenOperation) Code() int
Code returns the operation code.
func (*TestStringLenOperation) Not ¶ added in v0.4.3
func (op *TestStringLenOperation) Not() bool
Not returns whether this is a negation predicate.
func (*TestStringLenOperation) Op ¶ added in v0.4.3
func (op *TestStringLenOperation) Op() internal.OpType
Op returns the operation type.
func (*TestStringLenOperation) Path ¶ added in v0.4.3
func (op *TestStringLenOperation) Path() []string
Path returns the operation path.
func (*TestStringLenOperation) Test ¶ added in v0.5.1
func (op *TestStringLenOperation) Test(doc any) (bool, error)
Test tests the string length condition on the document.
func (*TestStringLenOperation) ToCompact ¶ added in v0.4.3
func (op *TestStringLenOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*TestStringLenOperation) ToJSON ¶ added in v0.4.3
func (op *TestStringLenOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*TestStringLenOperation) Validate ¶ added in v0.4.3
func (op *TestStringLenOperation) Validate() error
Validate validates the test string length operation.
type TestStringOperation ¶ added in v0.4.3
type TestStringOperation struct {
BaseOp
Str string `json:"str"` // Expected string value
Pos int `json:"pos"` // Position within string
NotFlag bool `json:"not,omitempty"` // Whether to negate the result
IgnoreCase bool `json:"ignore_case,omitempty"` // Whether to ignore case
}
TestStringOperation represents a test operation that checks if a value is a string and matches a pattern.
func NewOpTestStringOperation ¶
func NewOpTestStringOperation(path []string, expectedValue string) *TestStringOperation
NewOpTestStringOperation creates a new OpTestStringOperation operation.
func NewOpTestStringOperationWithIgnoreCase ¶ added in v0.5.1
func NewOpTestStringOperationWithIgnoreCase(path []string, expectedValue string, pos float64, notFlag bool, ignoreCase bool) *TestStringOperation
NewOpTestStringOperationWithIgnoreCase creates a new OpTestStringOperation operation with ignore case flag.
func NewOpTestStringOperationWithPos ¶
func NewOpTestStringOperationWithPos(path []string, expectedValue string, pos float64) *TestStringOperation
NewOpTestStringOperationWithPos creates a new OpTestStringOperation operation with position.
func NewOpTestStringOperationWithPosAndNot ¶ added in v0.5.1
func NewOpTestStringOperationWithPosAndNot(path []string, expectedValue string, pos float64, notFlag bool) *TestStringOperation
NewOpTestStringOperationWithPosAndNot creates a new OpTestStringOperation operation with position and not flag.
func (*TestStringOperation) Apply ¶ added in v0.4.3
Apply applies the test string operation to the document.
func (*TestStringOperation) Code ¶ added in v0.4.3
func (op *TestStringOperation) Code() int
Code returns the operation code.
func (*TestStringOperation) Not ¶ added in v0.5.1
func (op *TestStringOperation) Not() bool
Not returns whether this operation is a negation predicate.
func (*TestStringOperation) Op ¶ added in v0.4.3
func (op *TestStringOperation) Op() internal.OpType
Op returns the operation type.
func (*TestStringOperation) Path ¶ added in v0.4.3
func (op *TestStringOperation) Path() []string
Path returns the operation path.
func (*TestStringOperation) Test ¶ added in v0.4.3
func (op *TestStringOperation) Test(doc any) (bool, error)
Test evaluates the test string predicate condition.
func (*TestStringOperation) ToCompact ¶ added in v0.4.3
func (op *TestStringOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*TestStringOperation) ToJSON ¶ added in v0.4.3
func (op *TestStringOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*TestStringOperation) Validate ¶ added in v0.4.3
func (op *TestStringOperation) Validate() error
Validate validates the test string operation.
type TestTypeOperation ¶ added in v0.4.3
TestTypeOperation represents a test operation that checks if a value is of a specific type.
func NewOpTestTypeOperation ¶
func NewOpTestTypeOperation(path []string, expectedType string) *TestTypeOperation
NewOpTestTypeOperation creates a new OpTestTypeOperation operation.
func NewOpTestTypeOperationMultiple ¶
func NewOpTestTypeOperationMultiple(path []string, expectedTypes []string) *TestTypeOperation
NewOpTestTypeOperationMultiple creates a new OpTestTypeOperation operation with multiple internal.
func (*TestTypeOperation) Apply ¶ added in v0.4.3
Apply applies the test type operation to the document.
func (*TestTypeOperation) Code ¶ added in v0.4.3
func (op *TestTypeOperation) Code() int
Code returns the operation code.
func (*TestTypeOperation) Not ¶ added in v0.4.3
func (op *TestTypeOperation) Not() bool
Not returns false (test_type operation doesn't support not modifier).
func (*TestTypeOperation) Op ¶ added in v0.4.3
func (op *TestTypeOperation) Op() internal.OpType
Op returns the operation type.
func (*TestTypeOperation) Path ¶ added in v0.4.3
func (op *TestTypeOperation) Path() []string
Path returns the operation path.
func (*TestTypeOperation) Test ¶ added in v0.4.3
func (op *TestTypeOperation) Test(doc any) (bool, error)
Test evaluates the test type predicate condition.
func (*TestTypeOperation) ToCompact ¶ added in v0.4.3
func (op *TestTypeOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*TestTypeOperation) ToJSON ¶ added in v0.4.3
func (op *TestTypeOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*TestTypeOperation) Validate ¶ added in v0.4.3
func (op *TestTypeOperation) Validate() error
Validate validates the test type operation.
type TypeOperation ¶ added in v0.4.3
TypeOperation represents a type operation that checks if a value is of a specific type.
func NewOpTypeOperation ¶
func NewOpTypeOperation(path []string, expectedType string) *TypeOperation
NewOpTypeOperation creates a new OpTypeOperation operation.
func (*TypeOperation) Code ¶ added in v0.4.3
func (op *TypeOperation) Code() int
Code returns the operation code.
func (*TypeOperation) Not ¶ added in v0.4.3
func (op *TypeOperation) Not() bool
Not returns false (type operation doesn't support not modifier).
func (*TypeOperation) Op ¶ added in v0.4.3
func (op *TypeOperation) Op() internal.OpType
Op returns the operation type.
func (*TypeOperation) Path ¶ added in v0.4.3
func (op *TypeOperation) Path() []string
Path returns the operation path.
func (*TypeOperation) Test ¶ added in v0.4.3
func (op *TypeOperation) Test(doc any) (bool, error)
Test evaluates the type predicate condition.
func (*TypeOperation) ToCompact ¶ added in v0.4.3
func (op *TypeOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*TypeOperation) ToJSON ¶ added in v0.4.3
func (op *TypeOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*TypeOperation) Validate ¶ added in v0.4.3
func (op *TypeOperation) Validate() error
Validate validates the type operation.
type UndefinedOperation ¶ added in v0.4.3
type UndefinedOperation struct {
BaseOp
}
UndefinedOperation represents an undefined operation that checks if a path doesn't exist.
func NewOpUndefinedOperation ¶
func NewOpUndefinedOperation(path []string) *UndefinedOperation
NewOpUndefinedOperation creates a new undefined operation.
func (*UndefinedOperation) Code ¶ added in v0.4.3
func (o *UndefinedOperation) Code() int
Code returns the operation code.
func (*UndefinedOperation) Not ¶ added in v0.4.3
func (o *UndefinedOperation) Not() bool
Not returns false (undefined operation doesn't support not modifier).
func (*UndefinedOperation) Op ¶ added in v0.4.3
func (o *UndefinedOperation) Op() internal.OpType
Op returns the operation type.
func (*UndefinedOperation) Path ¶ added in v0.4.3
func (o *UndefinedOperation) Path() []string
Path returns the path for the undefined operation.
func (*UndefinedOperation) Test ¶ added in v0.4.3
func (o *UndefinedOperation) Test(doc interface{}) (bool, error)
Test performs the undefined operation.
func (*UndefinedOperation) ToCompact ¶ added in v0.4.3
func (o *UndefinedOperation) ToCompact() (internal.CompactOperation, error)
ToCompact serializes the operation to compact format.
func (*UndefinedOperation) ToJSON ¶ added in v0.4.3
func (o *UndefinedOperation) ToJSON() (internal.Operation, error)
ToJSON serializes the operation to JSON format.
func (*UndefinedOperation) Validate ¶ added in v0.4.3
func (o *UndefinedOperation) Validate() error
Validate validates the undefined operation.