procedures

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FIELD_NAME_PARAMETERS       = "parameters"
	FIELD_NAME_DEFINITION       = "definition"
	FIELD_NAME_EXTENSION_NAME   = "extension_name"
	FIELD_NAME_EXTENSION_SYMBOL = "extension_symbol"
	FIELD_NAME_SQL_DEFINITION   = "sql_definition"
)

Variables

This section is empty.

Functions

func ParameterNamesAndModesToString added in v0.57.3

func ParameterNamesAndModesToString(params []Parameter) string

ParameterNamesAndModesToString returns a string that represents the parameter names and modes. The string may be converted back to set parameter names and modes using ParameterNamesAndModesFromString.

func ProcedureIDToTableName added in v0.52.3

func ProcedureIDToTableName(procID id.Procedure) doltdb.TableName

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

Types

type Collection added in v0.52.3

type Collection struct {
	objinterface.RootObjectMap
	// contains filtered or unexported fields
}

Collection contains a collection of procedures.

func LoadProcedures added in v0.52.3

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

LoadProcedures loads the procedures collection from the given root.

func NewCollection added in v0.52.3

func NewCollection(ctx context.Context, rom objinterface.RootObjectMap) (*Collection, error)

NewCollection returns a new Collection.

func (*Collection) AddProcedure added in v0.52.3

func (pgp *Collection) AddProcedure(ctx context.Context, proc Procedure) error

AddProcedure adds a new procedure.

func (*Collection) DeserializeRootObject added in v0.52.3

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

DeserializeRootObject implements the interface objinterface.Collection.

func (*Collection) DiffRootObjects added in v0.52.3

DiffRootObjects implements the interface objinterface.Collection.

func (*Collection) DropProcedure added in v0.52.3

func (pgp *Collection) DropProcedure(ctx context.Context, procIDs ...id.Procedure) error

DropProcedure drops an existing procedure.

func (*Collection) DropRootObject added in v0.52.3

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

DropRootObject implements the interface objinterface.Collection.

func (*Collection) GetFieldType added in v0.52.3

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

GetFieldType implements the interface objinterface.Collection.

func (*Collection) GetID added in v0.52.3

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

GetID implements the interface objinterface.Collection.

func (*Collection) GetProcedure added in v0.52.3

func (pgp *Collection) GetProcedure(_ context.Context, procID id.Procedure) (Procedure, error)

GetProcedure returns the procedure with the given ID. Returns a procedure with an invalid ID if it cannot be found (Procedure.ID.IsValid() == false).

func (*Collection) GetProcedureOverloads added in v0.52.3

func (pgp *Collection) GetProcedureOverloads(_ context.Context, procID id.Procedure) ([]Procedure, error)

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

func (*Collection) GetRootObject added in v0.52.3

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

GetRootObject implements the interface objinterface.Collection.

func (*Collection) HandleMerge added in v0.52.3

HandleMerge implements the interface objinterface.Collection.

func (*Collection) HasProcedure added in v0.52.3

func (pgp *Collection) HasProcedure(_ context.Context, procID id.Procedure) bool

HasProcedure returns whether the procedure is present.

func (*Collection) HasRootObject added in v0.52.3

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

HasRootObject implements the interface objinterface.Collection.

func (*Collection) IDToTableName added in v0.52.3

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

IDToTableName implements the interface objinterface.Collection.

func (*Collection) IterAll added in v0.52.3

func (pgp *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.52.3

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

IterIDs implements the interface objinterface.Collection.

func (*Collection) IterateProcedures added in v0.52.3

func (pgp *Collection) IterateProcedures(_ context.Context, callback func(p Procedure) (stop bool, err error)) error

IterateProcedures iterates over all procedures in the collection.

func (*Collection) LoadCollection added in v0.52.3

LoadCollection implements the interface objinterface.Collection.

func (*Collection) Map added in v0.52.3

Map returns the underlying map.

func (*Collection) PutRootObject added in v0.52.3

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

PutRootObject implements the interface objinterface.Collection.

func (*Collection) RenameRootObject added in v0.52.3

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

RenameRootObject implements the interface objinterface.Collection.

func (*Collection) ResolveName added in v0.52.3

func (pgp *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.52.3

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.52.3

Serializer implements the interface objinterface.Collection.

func (*Collection) TableNameToID added in v0.52.3

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

TableNameToID implements the interface objinterface.Collection.

func (*Collection) UpdateField added in v0.52.3

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

UpdateField implements the interface objinterface.Collection.

type Parameter added in v0.57.3

type Parameter struct {
	Mode    ParameterMode
	Name    string
	Type    id.Type
	Default string
}

Parameter represents a routine parameter with mode, name, type and default value.

func ParameterNamesAndModesFromString added in v0.57.3

func ParameterNamesAndModesFromString(params []Parameter, namesAndModes string) ([]Parameter, error)

ParameterNamesAndModesFromString parses parameter names and modes from the given string and updates the given parameters slice.

type ParameterMode added in v0.52.3

type ParameterMode uint8

ParameterMode represents the mode of the given parameter (whether it's IN, OUT, INOUT, or VARIADIC).

const (
	ParameterMode_IN       ParameterMode = 0
	ParameterMode_OUT      ParameterMode = 1
	ParameterMode_INOUT    ParameterMode = 2
	ParameterMode_VARIADIC ParameterMode = 3
)

func ParameterModeFromString added in v0.57.3

func ParameterModeFromString(mode string) ParameterMode

ParameterModeFromString returns a ParameterMode from the given string.

type Procedure added in v0.52.3

type Procedure struct {
	ID              id.Procedure
	AllParams       []Parameter
	Definition      string
	ExtensionName   string                         // Only used when this is an extension procedure
	ExtensionSymbol string                         // Only used when this is an extension procedure
	Operations      []plpgsql.InterpreterOperation // Only used when this is a plpgsql language
	SQLDefinition   string                         // Only used when this is a sql language
}

Procedure represents a created procedure.

func DeserializeProcedure added in v0.52.3

func DeserializeProcedure(ctx context.Context, data []byte) (Procedure, error)

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

func (Procedure) GetID added in v0.52.3

func (procedure Procedure) GetID() id.Id

GetID implements the interface objinterface.RootObject.

func (Procedure) GetInnerDefinition added in v0.52.3

func (procedure Procedure) GetInnerDefinition() string

GetInnerDefinition returns the inner definition inside the CREATE PROCEDURE statement.

func (Procedure) GetRootObjectID added in v0.52.3

func (procedure Procedure) GetRootObjectID() objinterface.RootObjectID

GetRootObjectID implements the interface objinterface.RootObject.

func (Procedure) HashOf added in v0.52.3

func (procedure Procedure) HashOf(ctx context.Context) (hash.Hash, error)

HashOf implements the interface objinterface.RootObject.

func (Procedure) Name added in v0.52.3

func (procedure Procedure) Name() doltdb.TableName

Name implements the interface objinterface.RootObject.

func (Procedure) ReplaceDefinition added in v0.52.3

func (procedure Procedure) ReplaceDefinition(newInner string) string

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

func (Procedure) Serialize added in v0.52.3

func (procedure Procedure) Serialize(ctx context.Context) ([]byte, error)

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