functions

package
v0.54.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIELD_NAME_PARAMETER_NAMES   = "parameter_names"
	FIELD_NAME_RETURN_TYPE       = "return_type"
	FIELD_NAME_NON_DETERMINISTIC = "non_deterministic"
	FIELD_NAME_STRICT            = "strict"
	FIELD_NAME_DEFINITION        = "definition"
	FIELD_NAME_EXTENSION_NAME    = "extension_name"
	FIELD_NAME_EXTENSION_SYMBOL  = "extension_symbol"
	FIELD_NAME_SQL_DEFINITION    = "sql_definition"
	FIELD_NAME_SET_OF            = "set_of"
)

Variables

This section is empty.

Functions

func FunctionIDToTableName added in v0.50.0

func FunctionIDToTableName(funcID id.Function) doltdb.TableName

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

Types

type Collection

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

Collection contains a collection of functions.

func LoadFunctions added in v0.50.0

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

LoadFunctions loads the functions collection from the given root.

func NewCollection added in v0.50.0

func NewCollection(ctx context.Context, underlyingMap prolly.AddressMap, ns tree.NodeStore) (*Collection, error)

NewCollection returns a new Collection.

func (*Collection) AddFunction

func (pgf *Collection) AddFunction(ctx context.Context, f Function) error

AddFunction adds a new function.

func (*Collection) Clone

func (pgf *Collection) Clone(ctx context.Context) *Collection

Clone returns a new *Collection with the same contents as the original.

func (*Collection) DeserializeRootObject added in v0.51.1

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

DeserializeRootObject implements the interface objinterface.Collection.

func (*Collection) DiffRootObjects added in v0.51.1

DiffRootObjects implements the interface objinterface.Collection.

func (*Collection) DiffersFrom added in v0.50.0

func (pgf *Collection) DiffersFrom(ctx context.Context, root objinterface.RootValue) bool

DiffersFrom returns true when the hash that is associated with the underlying map for this collection is different from the hash in the given root.

func (*Collection) DropFunction

func (pgf *Collection) DropFunction(ctx context.Context, funcIDs ...id.Function) error

DropFunction drops an existing function.

func (*Collection) DropRootObject added in v0.50.0

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

DropRootObject implements the interface objinterface.Collection.

func (*Collection) GetFieldType added in v0.51.1

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

GetFieldType implements the interface objinterface.Collection.

func (*Collection) GetFunction

func (pgf *Collection) GetFunction(ctx context.Context, funcID id.Function) (Function, error)

GetFunction returns the function with the given ID. Returns a function with an invalid ID if it cannot be found (Function.ID.IsValid() == false).

func (*Collection) GetFunctionOverloads

func (pgf *Collection) GetFunctionOverloads(ctx context.Context, funcID id.Function) ([]Function, error)

GetFunctionOverloads returns the overloads for the function matching the schema and the function name. The parameter types are ignored when searching for overloads.

func (*Collection) GetID added in v0.50.0

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

GetID implements the interface objinterface.Collection.

func (*Collection) GetRootObject added in v0.50.0

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

GetRootObject implements the interface objinterface.Collection.

func (*Collection) HandleMerge added in v0.50.0

HandleMerge implements the interface objinterface.Collection.

func (*Collection) HasFunction

func (pgf *Collection) HasFunction(ctx context.Context, funcID id.Function) bool

HasFunction returns whether the function is present.

func (*Collection) HasRootObject added in v0.50.0

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

HasRootObject implements the interface objinterface.Collection.

func (*Collection) IDToTableName added in v0.50.0

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

IDToTableName implements the interface objinterface.Collection.

func (*Collection) IterAll added in v0.50.0

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

IterAll implements the interface objinterface.Collection.

func (*Collection) IterIDs added in v0.50.0

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

IterIDs implements the interface objinterface.Collection.

func (*Collection) IterateFunctions

func (pgf *Collection) IterateFunctions(ctx context.Context, callback func(f Function) (stop bool, err error)) error

IterateFunctions iterates over all functions in the collection.

func (*Collection) LoadCollection added in v0.50.0

LoadCollection implements the interface objinterface.Collection.

func (*Collection) LoadCollectionHash added in v0.50.0

func (*Collection) LoadCollectionHash(ctx context.Context, root objinterface.RootValue) (hash.Hash, error)

LoadCollectionHash implements the interface objinterface.Collection.

func (*Collection) Map added in v0.50.0

func (pgf *Collection) Map(ctx context.Context) (prolly.AddressMap, error)

Map writes any cached sequences to the underlying map, and then returns the underlying map.

func (*Collection) PutRootObject added in v0.50.0

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

PutRootObject implements the interface objinterface.Collection.

func (*Collection) RenameRootObject added in v0.50.0

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

RenameRootObject implements the interface objinterface.Collection.

func (*Collection) ResolveName added in v0.50.0

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

ResolveName implements the interface objinterface.Collection.

func (*Collection) ResolveNameFromObjects added in v0.51.1

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) Serializer added in v0.50.0

Serializer implements the interface objinterface.Collection.

func (*Collection) TableNameToID added in v0.50.0

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

TableNameToID implements the interface objinterface.Collection.

func (*Collection) UpdateField added in v0.51.1

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

UpdateField implements the interface objinterface.Collection.

func (*Collection) UpdateRoot added in v0.50.0

UpdateRoot implements the interface objinterface.Collection.

type Function

type Function struct {
	ID                 id.Function
	ReturnType         id.Type
	ParameterNames     []string
	ParameterTypes     []id.Type
	Variadic           bool
	IsNonDeterministic bool
	Strict             bool
	Definition         string
	ExtensionName      string                         // Only used when this is an extension function
	ExtensionSymbol    string                         // Only used when this is an extension function
	Operations         []plpgsql.InterpreterOperation // Only used when this is a plpgsql language
	SQLDefinition      string                         // Only used when this is a sql language
	SetOf              bool
}

Function represents a created function.

func DeserializeFunction added in v0.50.0

func DeserializeFunction(ctx context.Context, data []byte) (Function, error)

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

func (Function) GetID added in v0.50.0

func (function Function) GetID() id.Id

GetID implements the interface objinterface.RootObject.

func (Function) GetInnerDefinition added in v0.51.1

func (function Function) GetInnerDefinition() string

GetInnerDefinition returns the inner definition inside the CREATE FUNCTION statement.

func (Function) GetRootObjectID added in v0.51.1

func (function Function) GetRootObjectID() objinterface.RootObjectID

GetRootObjectID implements the interface objinterface.RootObject.

func (Function) HashOf added in v0.50.0

func (function Function) HashOf(ctx context.Context) (hash.Hash, error)

HashOf implements the interface objinterface.RootObject.

func (Function) Name added in v0.50.0

func (function Function) Name() doltdb.TableName

Name implements the interface objinterface.RootObject.

func (Function) ReplaceDefinition added in v0.51.1

func (function Function) ReplaceDefinition(newInner string) string

ReplaceDefinition returns a new definition with the inner portion replaced with the given string.

func (Function) Serialize added in v0.50.0

func (function Function) Serialize(ctx context.Context) ([]byte, error)

Serialize returns the Function as a byte slice. If the Function 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