extensions

package
v0.52.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExtension

func GetExtension(name string) (_ *pg_extension.ExtensionFiles, err error)

GetExtension returns the extension matching the given name. Returns an error if the extension cannot be found.

func GetExtensionFunction

func GetExtensionFunction(identifier LibraryIdentifier, funcName string) (_ pg_extension.Function, err error)

GetExtensionFunction returns the function inside the extension matching the given names. Returns an error if the extension or function cannot be found.

func GetPlatform

func GetPlatform() string

GetPlatform returns the current platform that Doltgres is being executed on. This is encoded as a three-letter string.

Types

type Collection

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

Collection contains a collection of loaded extensions.

func LoadExtensions

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

LoadExtensions loads the extensions collection from the given root.

func NewCollection

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

NewCollection returns a new Collection.

func (*Collection) AddLoadedExtension

func (pge *Collection) AddLoadedExtension(ctx context.Context, ext Extension) error

AddLoadedExtension adds a new extension, that has already been loaded, to the collection.

func (*Collection) Clone

func (pge *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 (pge *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

func (pge *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) DropLoadedExtension

func (pge *Collection) DropLoadedExtension(ctx context.Context, names ...id.Extension) error

DropLoadedExtension drops a loaded extension. This should be called when unloading an extension, but this function itself does not perform the necessary logic.

func (*Collection) DropRootObject

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

DropRootObject implements the interface objinterface.Collection.

func (*Collection) GetFieldType added in v0.51.1

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

GetFieldType implements the interface objinterface.Collection.

func (*Collection) GetID

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

GetID implements the interface objinterface.Collection.

func (*Collection) GetLoadedExtension

func (pge *Collection) GetLoadedExtension(ctx context.Context, name id.Extension) (Extension, error)

GetLoadedExtension returns the loaded extension with the given name. Returns an extension with an invalid ID if it cannot be found.

func (*Collection) GetRootObject

func (pge *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) HasLoadedExtension

func (pge *Collection) HasLoadedExtension(ctx context.Context, name id.Extension) bool

HasLoadedExtension returns whether the extension has been loaded.

func (*Collection) HasRootObject

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

HasRootObject implements the interface objinterface.Collection.

func (*Collection) IDToTableName

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

IDToTableName implements the interface objinterface.Collection.

func (*Collection) IterAll

func (pge *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 (pge *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error

IterIDs implements the interface objinterface.Collection.

func (*Collection) LoadCollection

LoadCollection implements the interface objinterface.Collection.

func (*Collection) LoadCollectionHash

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

LoadCollectionHash implements the interface objinterface.Collection.

func (*Collection) Map

func (pge *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

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

PutRootObject implements the interface objinterface.Collection.

func (*Collection) RenameRootObject

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

RenameRootObject implements the interface objinterface.Collection.

func (*Collection) ResolveName

func (pge *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

Serializer implements the interface objinterface.Collection.

func (*Collection) TableNameToID

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

TableNameToID implements the interface objinterface.Collection.

func (*Collection) UpdateField added in v0.51.1

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

UpdateField implements the interface objinterface.Collection.

func (*Collection) UpdateRoot

UpdateRoot implements the interface objinterface.Collection.

type Extension

type Extension struct {
	ExtName       id.Extension
	Namespace     id.Namespace
	Relocatable   bool
	LibIdentifier LibraryIdentifier
}

Extension represents a loaded extension.

func DeserializeExtension

func DeserializeExtension(ctx context.Context, data []byte) (Extension, error)

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

func (Extension) CompareVersions

func (ext Extension) CompareVersions(other Extension) int

CompareVersions compares the major and minor version of the extension versus the given extension.

func (Extension) GetID

func (ext Extension) GetID() id.Id

GetID implements the interface objinterface.RootObject.

func (Extension) GetRootObjectID added in v0.51.1

func (ext Extension) GetRootObjectID() objinterface.RootObjectID

GetRootObjectID implements the interface objinterface.RootObject.

func (Extension) HashOf

func (ext Extension) HashOf(ctx context.Context) (hash.Hash, error)

HashOf implements the interface objinterface.RootObject.

func (Extension) Name

func (ext Extension) Name() doltdb.TableName

Name implements the interface objinterface.RootObject.

func (Extension) Serialize

func (ext Extension) Serialize(ctx context.Context) ([]byte, error)

Serialize returns the Extension as a byte slice. If the Extension is invalid (invalid ExtName), then this returns a nil slice.

type InvalidIdentifier

type InvalidIdentifier struct {
	Identifier LibraryIdentifier
	Reason     InvalidIdentifierReason
}

InvalidIdentifier represents an invalid LibraryIdentifier, providing both the LibraryIdentifier and the reason that it is invalid.

func FindInvalidIdentifiers

func FindInvalidIdentifiers(identifiers ...LibraryIdentifier) []InvalidIdentifier

FindInvalidIdentifiers returns all identifiers that are not valid for the current environment. If the return is empty, then that means all of the given identifiers are valid.

type InvalidIdentifierReason

type InvalidIdentifierReason uint8

InvalidIdentifierReason gives a reason as to why an Identifier is invalid.

const (
	InvalidIdentifierReason_MismatchedPlatform InvalidIdentifierReason = iota
	InvalidIdentifierReason_MissingLibrary
	InvalidIdentifierReason_InvalidVersion
)

type LibraryIdentifier

type LibraryIdentifier string

LibraryIdentifier points to a specific extension, as extension functions are dependent on the extension name, version, and originating platform (as different platforms may encode data differently).

func CreateLibraryIdentifier

func CreateLibraryIdentifier(name string, version pg_extension.Version) LibraryIdentifier

CreateLibraryIdentifier creates a LibraryIdentifier using the given information.

func (LibraryIdentifier) DisplayString

func (id LibraryIdentifier) DisplayString() string

DisplayString returns the identifier as a human-readable string.

func (LibraryIdentifier) ExtensionName

func (id LibraryIdentifier) ExtensionName() string

ExtensionName returns the extension referenced by this LibraryIdentifier.

func (LibraryIdentifier) Platform

func (id LibraryIdentifier) Platform() string

Platform returns the platform that this LibraryIdentifier was created on.

func (LibraryIdentifier) Version

func (id LibraryIdentifier) Version() pg_extension.Version

Version returns the library version that this LibraryIdentifier references.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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