operators

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OperatorIDToTableName

func OperatorIDToTableName(operatorID id.Operator) doltdb.TableName

OperatorIDToTableName returns the ID in a format that's better for user consumption.

Types

type Collection

type Collection struct {
	objinterface.RootObjectMap
}

Collection contains a collection of operators.

func LoadOperators

func LoadOperators(ctx context.Context, root objinterface.RootValue) (*Collection, error)

LoadOperators loads the operators collection from the given root.

func NewCollection

func NewCollection(rom objinterface.RootObjectMap) *Collection

NewCollection returns a new Collection.

func (*Collection) AddOperator

func (pgo *Collection) AddOperator(ctx context.Context, o Operator) error

AddOperator adds a new operator.

func (*Collection) DeserializeRootObject

func (pgo *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)

DeserializeRootObject implements the interface objinterface.Collection.

func (*Collection) DiffRootObjects

DiffRootObjects implements the interface objinterface.Collection.

func (*Collection) DropOperator

func (pgo *Collection) DropOperator(ctx context.Context, operatorIDs ...id.Operator) error

DropOperator drops an existing operator.

func (*Collection) DropRootObject

func (pgo *Collection) DropRootObject(ctx context.Context, identifier id.Id) error

DropRootObject implements the interface objinterface.Collection.

func (*Collection) GetFieldType

func (pgo *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType

GetFieldType implements the interface objinterface.Collection.

func (*Collection) GetID

func (pgo *Collection) GetID() objinterface.RootObjectID

GetID implements the interface objinterface.Collection.

func (*Collection) GetOperator

func (pgo *Collection) GetOperator(ctx context.Context, operatorID id.Operator) (Operator, error)

GetOperator returns the operator with the given ID. Returns an Operator with an invalid ID if it cannot be found (Operator.ID.IsValid() == false).

func (*Collection) GetRootObject

func (pgo *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)

GetRootObject implements the interface objinterface.Collection.

func (*Collection) HandleMerge

HandleMerge implements the interface objinterface.Collection.

func (*Collection) HasOperator

func (pgo *Collection) HasOperator(ctx context.Context, operatorID id.Operator) bool

HasOperator returns whether the given operator exists.

func (*Collection) HasRootObject

func (pgo *Collection) HasRootObject(ctx context.Context, identifier id.Id) (bool, error)

HasRootObject implements the interface objinterface.Collection.

func (*Collection) IDToTableName

func (pgo *Collection) IDToTableName(identifier id.Id) doltdb.TableName

IDToTableName implements the interface objinterface.Collection.

func (*Collection) IterAll

func (pgo *Collection) IterAll(ctx context.Context, callback func(rootObj objinterface.RootObject) (stop bool, err error)) error

IterAll implements the interface objinterface.Collection.

func (*Collection) IterIDs

func (pgo *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error

IterIDs implements the interface objinterface.Collection.

func (*Collection) IterateOperators

func (pgo *Collection) IterateOperators(ctx context.Context, callback func(o Operator) (stop bool, err error)) error

IterateOperators iterates over all operators in the collection.

func (*Collection) LoadCollection

LoadCollection implements the interface objinterface.Collection.

func (*Collection) PutRootObject

func (pgo *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error

PutRootObject implements the interface objinterface.Collection.

func (*Collection) RenameRootObject

func (pgo *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error

RenameRootObject implements the interface objinterface.Collection.

func (*Collection) ResolveName

func (pgo *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error)

ResolveName implements the interface objinterface.Collection.

func (*Collection) ResolveNameFromObjects

func (*Collection) ResolveNameFromObjects(ctx context.Context, name doltdb.TableName, rootObjects []objinterface.RootObject) (doltdb.TableName, id.Id, error)

ResolveNameFromObjects implements the interface objinterface.Collection.

func (*Collection) ResolveOperator

func (pgo *Collection) ResolveOperator(ctx context.Context, schemaNames []string, symbol string, leftType id.Type, rightType id.Type) (Operator, bool, error)

ResolveOperator returns the operator matching the given symbol and operand types, searching the given schemas in order and allowing unknown operand types to match any type. Returns false if no operator matches.

func (*Collection) Serializer

Serializer implements the interface objinterface.Collection.

func (*Collection) TableNameToID

func (pgo *Collection) TableNameToID(name doltdb.TableName) id.Id

TableNameToID implements the interface objinterface.Collection.

func (*Collection) UpdateField

func (pgo *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, newValue any) (objinterface.RootObject, error)

UpdateField implements the interface objinterface.Collection.

type Operator

type Operator struct {
	ID         id.Operator
	Function   id.Function
	ReturnType id.Type
	Commutator string
	Negator    string
	Hashes     bool
	Merges     bool
}

Operator represents a user-defined operator.

func DeserializeOperator

func DeserializeOperator(ctx context.Context, data []byte) (Operator, error)

DeserializeOperator returns the Operator that was serialized in the byte slice. Returns an empty Operator (invalid ID) if data is nil or empty.

func (Operator) GetID

func (operator Operator) GetID() id.Id

GetID implements the interface objinterface.RootObject.

func (Operator) GetRootObjectID

func (operator Operator) GetRootObjectID() objinterface.RootObjectID

GetRootObjectID implements the interface objinterface.RootObject.

func (Operator) HashOf

func (operator Operator) HashOf(ctx context.Context) (hash.Hash, error)

HashOf implements the interface objinterface.RootObject.

func (Operator) Name

func (operator Operator) Name() doltdb.TableName

Name implements the interface objinterface.RootObject.

func (Operator) Serialize

func (operator Operator) Serialize(ctx context.Context) ([]byte, error)

Serialize returns the Operator as a byte slice. If the Operator is invalid, then this returns a nil slice.

Jump to

Keyboard shortcuts

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