op

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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("path and from cannot be the same")

	// 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")

	// Type validation errors
	ErrNotString     = errors.New("value is not a string")
	ErrNotNumber     = errors.New("value is not a number")
	ErrNotObject     = errors.New("value is not an object")
	ErrInvalidType   = errors.New("invalid type")
	ErrEmptyTypeList = errors.New("types cannot be empty")

	// 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("cannot replace key in non-object")
	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("path does not exist -- missing objects are not created recursively")
	ErrCannotMoveIntoChildren = errors.New("cannot move into own children")
	ErrPropertiesNil          = errors.New("properties cannot be nil")
	ErrValuesArrayEmpty       = errors.New("values array cannot be empty")

	// 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 range")
	ErrSubstringTooLong         = errors.New("substring extends beyond string length")
	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")

	// Predicate operation errors
	ErrInvalidPredicateInAnd = errors.New("invalid predicate operation in AND")
	ErrInvalidPredicateInNot = errors.New("invalid predicate operation in NOT")
	ErrInvalidPredicateInOr  = errors.New("invalid predicate operation in OR")
	ErrAndNoOperands         = errors.New("and operation must have at least one operand")
	ErrNotNoOperands         = errors.New("not operation must have at least one operand")
	ErrOrNoOperands          = errors.New("or operation must have 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("test operation failed: number is not equal to string")
	ErrTestOperationStringNotEquivalent  = errors.New("test operation failed: 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

Functions

func DeepClone

func DeepClone(value interface{}) (interface{}, error)

DeepClone performs a deep clone of a value.

func IsMutationOp

func IsMutationOp(opType internal.OpType) bool

IsMutationOp checks if an operation type is a mutation operation.

func IsPredicateOp

func IsPredicateOp(opType internal.OpType) bool

IsPredicateOp checks if an operation type is a predicate operation.

func IsSecondOrderPredicateOp

func IsSecondOrderPredicateOp(opType internal.OpType) bool

IsSecondOrderPredicateOp checks if an operation type is a second-order predicate operation.

Types

type BaseOp

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

BaseOp provides common functionality for all operations.

func NewBaseOp

func NewBaseOp(path []string) BaseOp

NewBaseOp creates a new BaseOp with the given path.

func NewBaseOpWithFrom

func NewBaseOpWithFrom(path, from []string) BaseOp

NewBaseOpWithFrom creates a new BaseOp with path and from path.

func (*BaseOp) From

func (b *BaseOp) From() []string

From returns the from path for move/copy operations.

func (*BaseOp) HasFrom

func (b *BaseOp) HasFrom() bool

HasFrom returns true if the operation has a from path.

func (*BaseOp) Path

func (b *BaseOp) Path() []string

Path returns the operation path.

type Op

type Op = internal.Op

Op interface defines the core operation behavior.

type OpAddOperation

type OpAddOperation struct {
	BaseOp
	Value interface{} `json:"value"` // Value to add
}

OpAddOperation represents an add operation that adds a value at a specified path.

func NewOpAddOperation

func NewOpAddOperation(path []string, value interface{}) *OpAddOperation

NewOpAddOperation creates a new OpAddOperation operation.

func (*OpAddOperation) Apply

func (o *OpAddOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the add operation.

func (*OpAddOperation) Code

func (o *OpAddOperation) Code() int

Code returns the operation code.

func (*OpAddOperation) Op

func (o *OpAddOperation) Op() internal.OpType

Op returns the operation type.

func (*OpAddOperation) Path

func (o *OpAddOperation) Path() []string

Path returns the operation path.

func (*OpAddOperation) ToCompact

func (o *OpAddOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpAddOperation) ToJSON

func (o *OpAddOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpAddOperation) Validate

func (o *OpAddOperation) Validate() error

Validate validates the add operation.

type OpAndOperation

type OpAndOperation struct {
	BaseOp
	Operations []interface{} `json:"ops"` // Array of operations
}

OpAndOperation represents an AND operation that combines multiple predicate operations.

func NewOpAndOperation

func NewOpAndOperation(path []string, ops []interface{}) *OpAndOperation

NewOpAndOperation creates a new OpAndOperation operation.

func (*OpAndOperation) Apply

func (o *OpAndOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the AND operation.

func (*OpAndOperation) Code

func (o *OpAndOperation) Code() int

Code returns the operation code.

func (*OpAndOperation) Not

func (o *OpAndOperation) Not() bool

Not returns false since this is not a NOT operation.

func (*OpAndOperation) Op

func (o *OpAndOperation) Op() internal.OpType

Op returns the operation type.

func (*OpAndOperation) Ops

func (o *OpAndOperation) Ops() []internal.PredicateOp

Ops returns the predicate operations.

func (*OpAndOperation) Path

func (o *OpAndOperation) Path() []string

func (*OpAndOperation) Test

func (o *OpAndOperation) Test(doc interface{}) (bool, error)

Test performs the AND operation.

func (*OpAndOperation) ToCompact

func (o *OpAndOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpAndOperation) ToJSON

func (o *OpAndOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpAndOperation) Validate

func (o *OpAndOperation) Validate() error

Validate validates the AND operation.

type OpContainsOperation

type OpContainsOperation struct {
	BaseOp
	Value      string `json:"value"`       // Substring to search for
	IgnoreCase bool   `json:"ignore_case"` // Whether to ignore case when comparing
}

OpContainsOperation represents a test operation that checks if a string value contains a substring.

func NewOpContainsOperation

func NewOpContainsOperation(path []string, substring string) *OpContainsOperation

NewOpContainsOperation creates a new OpContainsOperation operation.

func NewOpContainsOperationWithIgnoreCase

func NewOpContainsOperationWithIgnoreCase(path []string, substring string, ignoreCase bool) *OpContainsOperation

NewOpContainsOperationWithIgnoreCase creates a new OpContainsOperation operation with ignore case option.

func (*OpContainsOperation) Apply

func (op *OpContainsOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the contains test operation to the document.

func (*OpContainsOperation) Code

func (op *OpContainsOperation) Code() int

Code returns the operation code.

func (*OpContainsOperation) Not

func (op *OpContainsOperation) Not() bool

Not returns false (contains operation doesn't support not modifier).

func (*OpContainsOperation) Op

Op returns the operation type.

func (*OpContainsOperation) Path

func (op *OpContainsOperation) Path() []string

func (*OpContainsOperation) Test

func (op *OpContainsOperation) Test(doc any) (bool, error)

Test performs the contains test operation.

func (*OpContainsOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpContainsOperation) ToJSON

func (op *OpContainsOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpContainsOperation) Validate

func (op *OpContainsOperation) Validate() error

Validate validates the contains operation.

type OpCopyOperation

type OpCopyOperation struct {
	BaseOp
	FromPath []string `json:"from"` // Source path
}

OpCopyOperation represents a copy operation that copies a value from one path to another.

func NewOpCopyOperation

func NewOpCopyOperation(path, from []string) *OpCopyOperation

NewOpCopyOperation creates a new OpCopyOperation operation.

func (*OpCopyOperation) Apply

func (o *OpCopyOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the copy operation.

func (*OpCopyOperation) Code

func (o *OpCopyOperation) Code() int

Code returns the operation code.

func (*OpCopyOperation) From

func (o *OpCopyOperation) From() []string

From returns the source path.

func (*OpCopyOperation) Op

Op returns the operation type.

func (*OpCopyOperation) ToCompact

func (o *OpCopyOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpCopyOperation) ToJSON

func (o *OpCopyOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpCopyOperation) Validate

func (o *OpCopyOperation) Validate() error

Validate validates the copy operation.

type OpDefinedOperation

type OpDefinedOperation struct {
	BaseOp
}

OpDefinedOperation represents a test operation that checks if a path is defined.

func NewOpDefinedOperation

func NewOpDefinedOperation(path []string) *OpDefinedOperation

NewOpDefinedOperation creates a new OpDefinedOperation operation.

func (*OpDefinedOperation) Apply

func (o *OpDefinedOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the defined operation.

func (*OpDefinedOperation) Code

func (o *OpDefinedOperation) Code() int

Code returns the operation code.

func (*OpDefinedOperation) Not

func (o *OpDefinedOperation) Not() bool

Not returns false (defined operation doesn't support not modifier).

func (*OpDefinedOperation) Op

Op returns the operation type.

func (*OpDefinedOperation) Path

func (op *OpDefinedOperation) Path() []string

func (*OpDefinedOperation) Test

func (o *OpDefinedOperation) Test(doc interface{}) (bool, error)

Test performs the defined operation.

func (*OpDefinedOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpDefinedOperation) ToJSON

func (o *OpDefinedOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpDefinedOperation) Validate

func (o *OpDefinedOperation) Validate() error

Validate validates the defined operation.

type OpEndsOperation

type OpEndsOperation struct {
	BaseOp
	Value      string `json:"value"`       // Expected suffix
	IgnoreCase bool   `json:"ignore_case"` // Whether to ignore case
}

OpEndsOperation represents a test operation that checks if a string value ends with a specific suffix.

func NewOpEndsOperation

func NewOpEndsOperation(path []string, suffix string) *OpEndsOperation

NewOpEndsOperation creates a new OpEndsOperation operation.

func NewOpEndsOperationWithIgnoreCase

func NewOpEndsOperationWithIgnoreCase(path []string, suffix string, ignoreCase bool) *OpEndsOperation

NewOpEndsOperationWithIgnoreCase creates a new OpEndsOperation operation with ignore case option.

func (*OpEndsOperation) Apply

func (op *OpEndsOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the ends test operation to the document.

func (*OpEndsOperation) Code

func (op *OpEndsOperation) Code() int

Code returns the operation code.

func (*OpEndsOperation) Op

func (op *OpEndsOperation) Op() internal.OpType

Op returns the operation type.

func (*OpEndsOperation) Path

func (op *OpEndsOperation) Path() []string

Path returns the operation path.

func (*OpEndsOperation) Test

func (op *OpEndsOperation) Test(doc any) (bool, error)

Test evaluates the ends predicate condition.

func (*OpEndsOperation) ToCompact

func (op *OpEndsOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpEndsOperation) ToJSON

func (op *OpEndsOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpEndsOperation) Validate

func (op *OpEndsOperation) Validate() error

Validate validates the ends operation.

type OpExtendOperation

type OpExtendOperation struct {
	BaseOp
	Properties map[string]interface{} `json:"props"`      // Properties to add
	DeleteNull bool                   `json:"deleteNull"` // Whether to delete null properties
}

OpExtendOperation 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) *OpExtendOperation

NewOpExtendOperation creates a new object extend operation.

func (*OpExtendOperation) Apply

func (o *OpExtendOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the object extend operation.

func (*OpExtendOperation) Code

func (op *OpExtendOperation) Code() int

Code returns the operation code.

func (*OpExtendOperation) Op

Op returns the operation type.

func (*OpExtendOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpExtendOperation) ToJSON

func (o *OpExtendOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpExtendOperation) Validate

func (op *OpExtendOperation) Validate() error

Validate validates the extend operation.

type OpFlipOperation

type OpFlipOperation struct {
	BaseOp
}

OpFlipOperation represents a flip operation that inverts boolean values or converts other types to boolean and then inverts them

func NewOpFlipOperation

func NewOpFlipOperation(path []string) *OpFlipOperation

NewOpFlipOperation creates a new flip operation

func (*OpFlipOperation) Apply

func (op *OpFlipOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the flip operation to the document

func (*OpFlipOperation) Code

func (op *OpFlipOperation) Code() int

Code returns the operation code

func (*OpFlipOperation) Op

func (op *OpFlipOperation) Op() internal.OpType

Op returns the operation type

func (*OpFlipOperation) ToCompact

func (op *OpFlipOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpFlipOperation) ToJSON

func (op *OpFlipOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpFlipOperation) Validate

func (op *OpFlipOperation) Validate() error

Validate validates the flip operation.

type OpInOperation

type OpInOperation struct {
	BaseOp
	Values []interface{} `json:"values"` // Array of values to check against
}

OpInOperation represents a test operation that checks if a value is present in a specified array.

func NewOpInOperation

func NewOpInOperation(path []string, values []interface{}) *OpInOperation

NewOpInOperation creates a new OpInOperation operation.

func (*OpInOperation) Apply

func (op *OpInOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the in test operation to the document.

func (*OpInOperation) Code

func (op *OpInOperation) Code() int

Code returns the operation code.

func (*OpInOperation) Not

func (op *OpInOperation) Not() bool

Not returns false since this is not a NOT operation.

func (*OpInOperation) Op

func (op *OpInOperation) Op() internal.OpType

Op returns the operation type.

func (*OpInOperation) Path

func (op *OpInOperation) Path() []string

Path returns the operation path.

func (*OpInOperation) Test

func (op *OpInOperation) Test(doc any) (bool, error)

Test evaluates the in predicate condition.

func (*OpInOperation) ToCompact

func (op *OpInOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpInOperation) ToJSON

func (op *OpInOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpInOperation) Validate

func (op *OpInOperation) Validate() error

Validate validates the in operation.

type OpIncOperation

type OpIncOperation struct {
	BaseOp
	Inc float64 `json:"inc"` // Increment value
}

OpIncOperation represents an increment operation that increments a numeric value.

func NewOpIncOperation

func NewOpIncOperation(path []string, inc float64) *OpIncOperation

NewOpIncOperation creates a new OpIncOperation operation.

func (*OpIncOperation) Apply

func (op *OpIncOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the increment operation to the document.

func (*OpIncOperation) Code

func (op *OpIncOperation) Code() int

Code returns the operation code.

func (*OpIncOperation) Op

func (op *OpIncOperation) Op() internal.OpType

Op returns the operation type.

func (*OpIncOperation) Path

func (op *OpIncOperation) Path() []string

Path returns the operation path.

func (*OpIncOperation) ToCompact

func (op *OpIncOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpIncOperation) ToJSON

func (op *OpIncOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpIncOperation) Validate

func (op *OpIncOperation) Validate() error

Validate validates the increment operation.

type OpLessOperation

type OpLessOperation struct {
	BaseOp
	Value float64 `json:"value"` // Value to compare against
}

OpLessOperation represents a test operation that checks if a numeric value is less than a specified value.

func NewOpLessOperation

func NewOpLessOperation(path []string, value float64) *OpLessOperation

NewOpLessOperation creates a new OpLessOperation operation.

func (*OpLessOperation) Apply

func (op *OpLessOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the less test operation to the document.

func (*OpLessOperation) Code

func (op *OpLessOperation) Code() int

Code returns the operation code.

func (*OpLessOperation) Not

func (op *OpLessOperation) Not() bool

Not returns false since this is not a NOT operation.

func (*OpLessOperation) Op

func (op *OpLessOperation) Op() internal.OpType

Op returns the operation type.

func (*OpLessOperation) Path

func (op *OpLessOperation) Path() []string

func (*OpLessOperation) Test

func (op *OpLessOperation) Test(doc any) (bool, error)

Test evaluates the less predicate condition.

func (*OpLessOperation) ToCompact

func (op *OpLessOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpLessOperation) ToJSON

func (op *OpLessOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpLessOperation) Validate

func (op *OpLessOperation) Validate() error

Validate validates the less operation.

type OpMatchesOperation

type OpMatchesOperation struct {
	BaseOp
	Pattern    string // The regex pattern string
	IgnoreCase bool   // Case insensitive flag
	// contains filtered or unexported fields
}

OpMatchesOperation represents a "matches" predicate operation that checks if a string matches a regex pattern.

func NewOpMatchesOperation

func NewOpMatchesOperation(path []string, pattern string, ignoreCase bool) (*OpMatchesOperation, error)

NewOpMatchesOperation creates a new matches operation.

func (*OpMatchesOperation) Apply

func (o *OpMatchesOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the matches operation.

func (*OpMatchesOperation) Code

func (o *OpMatchesOperation) Code() int

Code returns the operation code.

func (*OpMatchesOperation) Op

Op returns the operation type.

func (*OpMatchesOperation) Path

func (o *OpMatchesOperation) Path() []string

func (*OpMatchesOperation) Test

func (o *OpMatchesOperation) Test(doc interface{}) (bool, error)

Test evaluates the matches predicate condition.

func (*OpMatchesOperation) ToCompact

ToCompact converts the operation to compact array representation.

func (*OpMatchesOperation) ToJSON

func (o *OpMatchesOperation) ToJSON() (internal.Operation, error)

ToJSON converts the operation to JSON representation.

func (*OpMatchesOperation) Validate

func (o *OpMatchesOperation) Validate() error

Validate validates the matches operation.

type OpMergeOperation

type OpMergeOperation struct {
	BaseOp
	Pos   int                    `json:"pos"`   // Merge position
	Props map[string]interface{} `json:"props"` // Properties to apply after merge
}

OpMergeOperation 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 int, props map[string]interface{}) *OpMergeOperation

NewOpMergeOperation creates a new array merge operation.

func (*OpMergeOperation) Apply

func (op *OpMergeOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the array merge operation.

func (*OpMergeOperation) Code

func (op *OpMergeOperation) Code() int

Code returns the operation code.

func (*OpMergeOperation) Op

func (op *OpMergeOperation) Op() internal.OpType

Op returns the operation type.

func (*OpMergeOperation) Path

func (op *OpMergeOperation) Path() []string

Path returns the operation path.

func (*OpMergeOperation) ToCompact

func (op *OpMergeOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpMergeOperation) ToJSON

func (op *OpMergeOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpMergeOperation) Validate

func (op *OpMergeOperation) Validate() error

Validate validates the merge operation.

type OpMoreOperation

type OpMoreOperation struct {
	PredicateOpBase
	Value float64 // The number to compare against
}

OpMoreOperation represents a "more" predicate operation that checks if a value is greater than a specified number.

func NewOpMoreOperation

func NewOpMoreOperation(path []string, value float64) *OpMoreOperation

NewOpMoreOperation creates a new more operation.

func (*OpMoreOperation) Apply

func (o *OpMoreOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the more operation.

func (*OpMoreOperation) Code

func (o *OpMoreOperation) Code() int

Code returns the operation code.

func (*OpMoreOperation) Op

Op returns the operation type.

func (*OpMoreOperation) Path

func (o *OpMoreOperation) Path() []string

func (*OpMoreOperation) Test

func (o *OpMoreOperation) Test(doc interface{}) (bool, error)

Test evaluates the more predicate condition.

func (*OpMoreOperation) ToCompact

func (o *OpMoreOperation) ToCompact() (internal.CompactOperation, error)

ToCompact converts the operation to compact array representation.

func (*OpMoreOperation) ToJSON

func (o *OpMoreOperation) ToJSON() (internal.Operation, error)

ToJSON converts the operation to JSON representation.

func (*OpMoreOperation) Validate

func (o *OpMoreOperation) Validate() error

Validate validates the more operation.

type OpMoveOperation

type OpMoveOperation struct {
	BaseOp
	FromPath []string `json:"from"` // Source path
}

OpMoveOperation represents a move operation that moves a value from one path to another.

func NewOpMoveOperation

func NewOpMoveOperation(path, from []string) *OpMoveOperation

NewOpMoveOperation creates a new OpMoveOperation operation.

func (*OpMoveOperation) Apply

func (o *OpMoveOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the move operation.

func (*OpMoveOperation) Code

func (o *OpMoveOperation) Code() int

Code returns the operation code.

func (*OpMoveOperation) From

func (o *OpMoveOperation) From() []string

From returns the source path.

func (*OpMoveOperation) Op

Op returns the operation type.

func (*OpMoveOperation) ToCompact

func (o *OpMoveOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpMoveOperation) ToJSON

func (o *OpMoveOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpMoveOperation) Validate

func (o *OpMoveOperation) Validate() error

Validate validates the move operation.

type OpNotOperation

type OpNotOperation struct {
	BaseOp
	Operations []interface{} `json:"ops"` // Array of operations to negate
}

OpNotOperation represents a logical NOT operation that negates predicates.

func NewOpNotOperation

func NewOpNotOperation(operand internal.PredicateOp) *OpNotOperation

NewOpNotOperation creates a new NOT operation.

func NewOpNotOperationMultiple

func NewOpNotOperationMultiple(path []string, ops []interface{}) *OpNotOperation

NewOpNotOperationMultiple creates a new NOT operation with multiple operands.

func (*OpNotOperation) Apply

func (o *OpNotOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the NOT operation.

func (*OpNotOperation) Code

func (o *OpNotOperation) Code() int

Code returns the operation code.

func (*OpNotOperation) Not

func (o *OpNotOperation) Not() bool

Not returns true since this is a NOT operation.

func (*OpNotOperation) Op

func (o *OpNotOperation) Op() internal.OpType

Op returns the operation type.

func (*OpNotOperation) Ops

func (o *OpNotOperation) Ops() []internal.PredicateOp

Ops returns the operand operations.

func (*OpNotOperation) Path

func (o *OpNotOperation) Path() []string

Path returns the operation path.

func (*OpNotOperation) Test

func (o *OpNotOperation) Test(doc any) (bool, error)

Test evaluates the NOT predicate condition.

func (*OpNotOperation) ToCompact

func (o *OpNotOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpNotOperation) ToJSON

func (o *OpNotOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpNotOperation) Validate

func (o *OpNotOperation) Validate() error

Validate validates the NOT operation.

type OpOrOperation

type OpOrOperation struct {
	BaseOp
	Operations []interface{} `json:"ops"` // Array of operations
}

OpOrOperation represents an OR operation that combines multiple predicate operations.

func NewOpOrOperation

func NewOpOrOperation(path []string, ops []interface{}) *OpOrOperation

NewOpOrOperation creates a new OpOrOperation operation.

func (*OpOrOperation) Apply

func (o *OpOrOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the OR operation to the document.

func (*OpOrOperation) Code

func (o *OpOrOperation) Code() int

Code returns the operation code.

func (*OpOrOperation) Not

func (o *OpOrOperation) Not() bool

Not returns false since this is not a NOT operation.

func (*OpOrOperation) Op

func (o *OpOrOperation) Op() internal.OpType

Op returns the operation type.

func (*OpOrOperation) Ops

func (o *OpOrOperation) Ops() []internal.PredicateOp

Ops returns the predicate operations.

func (*OpOrOperation) Path

func (o *OpOrOperation) Path() []string

func (*OpOrOperation) Test

func (o *OpOrOperation) Test(doc interface{}) (bool, error)

Test performs the OR operation.

func (*OpOrOperation) ToCompact

func (o *OpOrOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpOrOperation) ToJSON

func (o *OpOrOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpOrOperation) Validate

func (o *OpOrOperation) Validate() error

Validate validates the OR operation.

type OpRemoveOperation

type OpRemoveOperation struct {
	BaseOp
	OldValue    interface{} `json:"oldValue,omitempty"` // The value that was removed (optional)
	HasOldValue bool        // Whether oldValue is explicitly set
}

OpRemoveOperation represents a remove operation that removes a value at a specified path.

func NewOpRemoveOperation

func NewOpRemoveOperation(path []string) *OpRemoveOperation

NewOpRemoveOperation creates a new OpRemoveOperation operation.

func NewOpRemoveOperationWithOldValue

func NewOpRemoveOperationWithOldValue(path []string, oldValue interface{}) *OpRemoveOperation

NewOpRemoveOperationWithOldValue creates a new OpRemoveOperation operation with oldValue.

func (*OpRemoveOperation) Apply

func (o *OpRemoveOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the remove operation to the document.

func (*OpRemoveOperation) Code

func (o *OpRemoveOperation) Code() int

Code returns the operation code.

func (*OpRemoveOperation) Op

Op returns the operation type.

func (*OpRemoveOperation) Path

func (o *OpRemoveOperation) Path() []string

Path returns the operation path.

func (*OpRemoveOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpRemoveOperation) ToJSON

func (o *OpRemoveOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpRemoveOperation) Validate

func (o *OpRemoveOperation) Validate() error

Validate validates the remove operation.

type OpReplaceOperation

type OpReplaceOperation struct {
	BaseOp
	Value    interface{} `json:"value"`              // New value
	OldValue interface{} `json:"oldValue,omitempty"` // The value that was replaced (optional)
}

OpReplaceOperation represents a replace operation that replaces a value at a specified path.

func NewOpReplaceOperation

func NewOpReplaceOperation(path []string, value interface{}) *OpReplaceOperation

NewOpReplaceOperation creates a new OpReplaceOperation operation.

func NewOpReplaceOperationWithOldValue

func NewOpReplaceOperationWithOldValue(path []string, value interface{}, oldValue interface{}) *OpReplaceOperation

NewOpReplaceOperationWithOldValue creates a new OpReplaceOperation operation with oldValue.

func (*OpReplaceOperation) Apply

func (o *OpReplaceOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the replace operation to the document.

func (*OpReplaceOperation) Code

func (o *OpReplaceOperation) Code() int

Code returns the operation code.

func (*OpReplaceOperation) Op

Op returns the operation type.

func (*OpReplaceOperation) Path

func (o *OpReplaceOperation) Path() []string

Path returns the operation path.

func (*OpReplaceOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpReplaceOperation) ToJSON

func (o *OpReplaceOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpReplaceOperation) Validate

func (o *OpReplaceOperation) Validate() error

Validate validates the replace operation.

type OpResult

type OpResult[T internal.Document] = internal.OpResult[T]

OpResult represents the result of applying an operation.

type OpSplitOperation

type OpSplitOperation struct {
	BaseOp
	Pos   int         `json:"pos"`   // Split position
	Props interface{} `json:"props"` // Properties to apply after split
}

OpSplitOperation 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 int, props interface{}) *OpSplitOperation

NewOpSplitOperation creates a new string split operation.

func (*OpSplitOperation) Apply

func (op *OpSplitOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the string split operation.

func (*OpSplitOperation) Code

func (op *OpSplitOperation) Code() int

Code returns the operation code.

func (*OpSplitOperation) Op

func (op *OpSplitOperation) Op() internal.OpType

Op returns the operation type.

func (*OpSplitOperation) Path

func (op *OpSplitOperation) Path() []string

Path returns the operation path.

func (*OpSplitOperation) ToCompact

func (op *OpSplitOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpSplitOperation) ToJSON

func (op *OpSplitOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpSplitOperation) Validate

func (op *OpSplitOperation) Validate() error

Validate validates the split operation.

type OpStartsOperation

type OpStartsOperation struct {
	BaseOp
	Value      string `json:"value"`       // Expected prefix
	IgnoreCase bool   `json:"ignore_case"` // Whether to ignore case
}

OpStartsOperation represents a test operation that checks if a string value starts with a specific prefix.

func NewOpStartsOperation

func NewOpStartsOperation(path []string, prefix string) *OpStartsOperation

NewOpStartsOperation creates a new OpStartsOperation operation.

func NewOpStartsOperationWithIgnoreCase

func NewOpStartsOperationWithIgnoreCase(path []string, prefix string, ignoreCase bool) *OpStartsOperation

NewOpStartsOperationWithIgnoreCase creates a new OpStartsOperation operation with ignore case option.

func (*OpStartsOperation) Apply

func (op *OpStartsOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the starts test operation to the document.

func (*OpStartsOperation) Code

func (op *OpStartsOperation) Code() int

Code returns the operation code.

func (*OpStartsOperation) Op

Op returns the operation type.

func (*OpStartsOperation) Path

func (op *OpStartsOperation) Path() []string

Path returns the operation path.

func (*OpStartsOperation) Test

func (op *OpStartsOperation) Test(doc any) (bool, error)

Test evaluates the starts predicate condition.

func (*OpStartsOperation) ToCompact

func (op *OpStartsOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpStartsOperation) ToJSON

func (op *OpStartsOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpStartsOperation) Validate

func (op *OpStartsOperation) Validate() error

Validate validates the starts operation.

type OpStrDelOperation

type OpStrDelOperation struct {
	BaseOp
	Pos int    `json:"pos"` // Delete position
	Len int    `json:"len"` // Number of characters to delete
	Str string `json:"str"` // Specific string to delete (optional)
}

OpStrDelOperation 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 int) *OpStrDelOperation

NewOpStrDelOperation creates a new string delete operation with length.

func NewOpStrDelOperationWithStr

func NewOpStrDelOperationWithStr(path []string, pos int, str string) *OpStrDelOperation

NewOpStrDelOperationWithStr creates a new string delete operation with specific string.

func (*OpStrDelOperation) Apply

func (o *OpStrDelOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the string delete operation.

func (*OpStrDelOperation) Code

func (op *OpStrDelOperation) Code() int

Code returns the operation code.

func (*OpStrDelOperation) Op

Op returns the operation type.

func (*OpStrDelOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpStrDelOperation) ToJSON

func (o *OpStrDelOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpStrDelOperation) Validate

func (op *OpStrDelOperation) Validate() error

Validate validates the string delete operation.

type OpStrInsOperation

type OpStrInsOperation struct {
	BaseOp
	Pos int    `json:"pos"` // Insert position
	Str string `json:"str"` // String to insert
}

OpStrInsOperation 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 int, str string) *OpStrInsOperation

NewOpStrInsOperation creates a new string insert operation.

func (*OpStrInsOperation) Apply

func (op *OpStrInsOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the string insert operation.

func (*OpStrInsOperation) Code

func (op *OpStrInsOperation) Code() int

Code returns the operation code.

func (*OpStrInsOperation) Op

Op returns the operation type.

func (*OpStrInsOperation) ToCompact

func (op *OpStrInsOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpStrInsOperation) ToJSON

func (op *OpStrInsOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpStrInsOperation) Validate

func (op *OpStrInsOperation) Validate() error

Validate validates the string insert operation.

type OpTestOperation

type OpTestOperation struct {
	BaseOp
	Value   interface{} `json:"value"`         // Expected value
	NotFlag bool        `json:"not,omitempty"` // Whether to negate the test
}

OpTestOperation represents a test operation that checks if a value equals a specified value.

func NewOpTestOperation

func NewOpTestOperation(path []string, value interface{}) *OpTestOperation

NewOpTestOperation creates a new OpTestOperation operation.

func (*OpTestOperation) Apply

func (o *OpTestOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the test operation.

func (*OpTestOperation) Code

func (o *OpTestOperation) Code() int

Code returns the operation code.

func (*OpTestOperation) Not

func (o *OpTestOperation) Not() bool

Not returns whether this operation is negated.

func (*OpTestOperation) Op

Op returns the operation type.

func (*OpTestOperation) Path

func (o *OpTestOperation) Path() []string

Path returns the operation path.

func (*OpTestOperation) Test

func (o *OpTestOperation) Test(doc interface{}) (bool, error)

Test performs the test operation.

func (*OpTestOperation) ToCompact

func (o *OpTestOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpTestOperation) ToJSON

func (o *OpTestOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpTestOperation) Validate

func (o *OpTestOperation) Validate() error

Validate validates the test operation.

type OpTestStringLenOperation

type OpTestStringLenOperation struct {
	BaseOp
	Length int  `json:"length"` // Expected string length
	Not    bool `json:"not"`    // Whether to negate the result
}

OpTestStringLenOperation represents a test operation that checks if a string value has a specific length.

func NewOpTestStringLenOperation

func NewOpTestStringLenOperation(path []string, expectedLength int) *OpTestStringLenOperation

NewOpTestStringLenOperation creates a new OpTestStringLenOperation operation.

func NewOpTestStringLenOperationWithNot

func NewOpTestStringLenOperationWithNot(path []string, expectedLength int, not bool) *OpTestStringLenOperation

NewOpTestStringLenOperationWithNot creates a new OpTestStringLenOperation operation with not flag.

func (*OpTestStringLenOperation) Apply

Apply applies the test string length operation to the document.

func (*OpTestStringLenOperation) Code

func (op *OpTestStringLenOperation) Code() int

Code returns the operation code.

func (*OpTestStringLenOperation) Op

Op returns the operation type.

func (*OpTestStringLenOperation) Path

func (op *OpTestStringLenOperation) Path() []string

Path returns the operation path.

func (*OpTestStringLenOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpTestStringLenOperation) ToJSON

ToJSON serializes the operation to JSON format.

func (*OpTestStringLenOperation) Validate

func (op *OpTestStringLenOperation) Validate() error

Validate validates the test string length operation.

type OpTestStringOperation

type OpTestStringOperation struct {
	BaseOp
	Str string `json:"str"` // Expected string value
	Pos int    `json:"pos"` // Position within string (optional)
}

OpTestStringOperation represents a test operation that checks if a value is a string and matches a pattern.

func NewOpTestStringOperation

func NewOpTestStringOperation(path []string, expectedValue string) *OpTestStringOperation

NewOpTestStringOperation creates a new OpTestStringOperation operation.

func NewOpTestStringOperationWithPos

func NewOpTestStringOperationWithPos(path []string, expectedValue string, pos int) *OpTestStringOperation

NewOpTestStringOperationWithPos creates a new OpTestStringOperation operation with position.

func (*OpTestStringOperation) Apply

func (op *OpTestStringOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the test string operation to the document.

func (*OpTestStringOperation) Code

func (op *OpTestStringOperation) Code() int

Code returns the operation code.

func (*OpTestStringOperation) Op

Op returns the operation type.

func (*OpTestStringOperation) Path

func (op *OpTestStringOperation) Path() []string

Path returns the operation path.

func (*OpTestStringOperation) Test

func (op *OpTestStringOperation) Test(doc any) (bool, error)

Test evaluates the test string predicate condition.

func (*OpTestStringOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpTestStringOperation) ToJSON

ToJSON serializes the operation to JSON format.

func (*OpTestStringOperation) Validate

func (op *OpTestStringOperation) Validate() error

Validate validates the test string operation.

type OpTestTypeOperation

type OpTestTypeOperation struct {
	BaseOp
	Types []string `json:"type"` // Expected type names
}

OpTestTypeOperation represents a test operation that checks if a value is of a specific type.

func NewOpTestTypeOperation

func NewOpTestTypeOperation(path []string, expectedType string) *OpTestTypeOperation

NewOpTestTypeOperation creates a new OpTestTypeOperation operation.

func NewOpTestTypeOperationMultiple

func NewOpTestTypeOperationMultiple(path []string, expectedTypes []string) *OpTestTypeOperation

NewOpTestTypeOperationMultiple creates a new OpTestTypeOperation operation with multiple internal.

func (*OpTestTypeOperation) Apply

func (op *OpTestTypeOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the test type operation to the document.

func (*OpTestTypeOperation) Code

func (op *OpTestTypeOperation) Code() int

Code returns the operation code.

func (*OpTestTypeOperation) Not

func (op *OpTestTypeOperation) Not() bool

Not returns false (test_type operation doesn't support not modifier).

func (*OpTestTypeOperation) Op

Op returns the operation type.

func (*OpTestTypeOperation) Path

func (op *OpTestTypeOperation) Path() []string

Path returns the operation path.

func (*OpTestTypeOperation) Test

func (op *OpTestTypeOperation) Test(doc any) (bool, error)

Test evaluates the test type predicate condition.

func (*OpTestTypeOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpTestTypeOperation) ToJSON

func (op *OpTestTypeOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpTestTypeOperation) Validate

func (op *OpTestTypeOperation) Validate() error

Validate validates the test type operation.

type OpTypeOperation

type OpTypeOperation struct {
	BaseOp
	TypeValue string `json:"value"` // Expected type name
}

OpTypeOperation represents a type operation that checks if a value is of a specific type.

func NewOpTypeOperation

func NewOpTypeOperation(path []string, expectedType string) *OpTypeOperation

NewOpTypeOperation creates a new OpTypeOperation operation.

func (*OpTypeOperation) Apply

func (op *OpTypeOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the type operation to the document.

func (*OpTypeOperation) Code

func (op *OpTypeOperation) Code() int

Code returns the operation code.

func (*OpTypeOperation) Not

func (op *OpTypeOperation) Not() bool

Not returns false (type operation doesn't support not modifier).

func (*OpTypeOperation) Op

func (op *OpTypeOperation) Op() internal.OpType

Op returns the operation type.

func (*OpTypeOperation) Path

func (op *OpTypeOperation) Path() []string

Path returns the operation path.

func (*OpTypeOperation) Test

func (op *OpTypeOperation) Test(doc any) (bool, error)

Test evaluates the type predicate condition.

func (*OpTypeOperation) ToCompact

func (op *OpTypeOperation) ToCompact() (internal.CompactOperation, error)

ToCompact serializes the operation to compact format.

func (*OpTypeOperation) ToJSON

func (op *OpTypeOperation) ToJSON() (internal.Operation, error)

ToJSON serializes the operation to JSON format.

func (*OpTypeOperation) Validate

func (op *OpTypeOperation) Validate() error

Validate validates the type operation.

type OpUndefinedOperation

type OpUndefinedOperation struct {
	PredicateOpBase
}

OpUndefinedOperation represents an undefined operation that checks if a path doesn't exist.

func NewOpUndefinedOperation

func NewOpUndefinedOperation(path []string, not bool) *OpUndefinedOperation

NewOpUndefinedOperation creates a new undefined operation.

func (*OpUndefinedOperation) Apply

func (o *OpUndefinedOperation) Apply(doc any) (internal.OpResult[any], error)

Apply applies the undefined operation.

func (*OpUndefinedOperation) Code

func (o *OpUndefinedOperation) Code() int

Code returns the operation code.

func (*OpUndefinedOperation) Not

func (o *OpUndefinedOperation) Not() bool

Not returns false (undefined operation doesn't support not modifier).

func (*OpUndefinedOperation) Op

Op returns the operation type.

func (*OpUndefinedOperation) Path

func (o *OpUndefinedOperation) Path() []string

func (*OpUndefinedOperation) Test

func (o *OpUndefinedOperation) Test(doc interface{}) (bool, error)

Test performs the undefined operation.

func (*OpUndefinedOperation) ToCompact

ToCompact serializes the operation to compact format.

func (*OpUndefinedOperation) ToJSON

ToJSON serializes the operation to JSON format.

func (*OpUndefinedOperation) Validate

func (o *OpUndefinedOperation) Validate() error

Validate validates the undefined 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.

func (*PredicateOpBase) Not

func (p *PredicateOpBase) Not() bool

Not returns the negation flag.

type SecondOrderPredicateOp

type SecondOrderPredicateOp = internal.SecondOrderPredicateOp

SecondOrderPredicateOp represents operations that combine multiple predicate operations.

Jump to

Keyboard shortcuts

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