core

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DoltgresFeatureVersion = doltdb.DoltFeatureVersion + 0

DoltgresFeatureVersion is Doltgres' feature version. We use Dolt's feature version added to our own.

Functions

func CloseContextRootFinalizer added in v0.8.0

func CloseContextRootFinalizer(ctx *sql.Context) error

CloseContextRootFinalizer finalizes any changes persisted within the context by writing them to the working root. This should ONLY be called by the ContextRootFinalizer node.

func GetCurrentSchema added in v0.7.5

func GetCurrentSchema(ctx *sql.Context) (string, error)

GetCurrentSchema returns the current schema used by the context. Defaults to "public" if the context does not specify a schema.

func GetDoltTableFromContext added in v0.12.0

func GetDoltTableFromContext(ctx *sql.Context, tableName doltdb.TableName) (*doltdb.Table, error)

GetDoltTableFromContext returns the Dolt table from the context. Returns nil if no table was found.

func GetPgCatalogCache added in v0.15.0

func GetPgCatalogCache(ctx *sql.Context) (any, error)

GetPgCatalogCache returns a cache of data for pg_catalog tables. This function should only be used by pg_catalog table handlers. The catalog cache instance stores generated pg_catalog table data so that it only has to generated table data once per query.

TODO: The return type here is currently any, to avoid a package import cycle. This could be cleaned up by introducing a new interface type, in a package that does not depend on core or pgcatalog packages.

func GetSchemaName added in v0.12.0

func GetSchemaName(ctx *sql.Context, db sql.Database, schemaName string) (string, error)

GetSchemaName returns the schema name if there is any exist. If the given schema is not empty, it's returned. If it is empty, uses given database to get schema name if it's DatabaseSchema. If it's not of DatabaseSchema type or the schema name of it is empty, it tries retrieving the current schema used by the context. Defaults to "public" if the context does not specify a schema.

func GetSequencesCollectionFromContext added in v0.14.0

func GetSequencesCollectionFromContext(ctx *sql.Context) (*sequences.Collection, error)

GetSequencesCollectionFromContext returns the given sequence collection from the context. Will always return a collection if no error is returned.

func GetSqlDatabaseFromContext added in v0.12.0

func GetSqlDatabaseFromContext(ctx *sql.Context, database string) (sql.Database, error)

GetSqlDatabaseFromContext returns the database from the context. Uses the context's current database if an empty string is provided. Returns nil if the database was not found.

func GetSqlTableFromContext added in v0.12.0

func GetSqlTableFromContext(ctx *sql.Context, databaseName string, tableName doltdb.TableName) (sql.Table, error)

GetSqlTableFromContext returns the table from the context. Uses the context's current database if an empty database name is provided. Returns nil if no table was found.

func GetTypesCollectionFromContext added in v0.14.0

func GetTypesCollectionFromContext(ctx *sql.Context) (*typecollection.TypeCollection, error)

GetTypesCollectionFromContext returns the given type collection from the context. Will always return a collection if no error is returned.

func Init

func Init()

Init initializes this package.

func SetPgCatalogCache added in v0.15.0

func SetPgCatalogCache(ctx *sql.Context, pgCatalogCache any) error

SetPgCatalogCache sets |pgCatalogCache| as the catalog cache instance for this session.

TODO: The input type here is currently any, to avoid a package import cycle. This could be cleaned up by introducing a new interface type, in a package that does not depend on core or pgcatalog packages.

Types

type RelationType added in v0.8.0

type RelationType byte

RelationType states the type of the relation.

const (
	RelationType_DoesNotExist RelationType = iota
	RelationType_Table
	RelationType_Sequence
)

func GetRelationType added in v0.8.0

func GetRelationType(ctx *sql.Context, schema string, relation string) (RelationType, error)

GetRelationType returns whether the working root has the given relation, and what type of relation it is. According to the Postgres docs, a relation may be one of: table, sequence, index, view, materialized view, foreign table. This may also include composite types and partitions, but this hasn't been confirmed.

func GetRelationTypeFromRoot added in v0.8.0

func GetRelationTypeFromRoot(ctx *sql.Context, schema string, relation string, root *RootValue) (RelationType, error)

GetRelationTypeFromRoot performs the same function as GetRelationType, except that it uses the given root rather than the working session's root.

type RootValue added in v0.7.5

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

RootValue is Doltgres' implementation of doltdb.RootValue.

func (*RootValue) CreateDatabaseSchema added in v0.7.5

func (root *RootValue) CreateDatabaseSchema(ctx context.Context, dbSchema schema.DatabaseSchema) (doltdb.RootValue, error)

CreateDatabaseSchema implements the interface doltdb.RootValue.

func (*RootValue) DebugString added in v0.7.5

func (root *RootValue) DebugString(ctx context.Context, transitive bool) string

DebugString implements the interface doltdb.RootValue.

func (*RootValue) GetCollation added in v0.7.5

func (root *RootValue) GetCollation(ctx context.Context) (schema.Collation, error)

GetCollation implements the interface doltdb.RootValue.

func (*RootValue) GetDatabaseSchemas added in v0.7.5

func (root *RootValue) GetDatabaseSchemas(ctx context.Context) ([]schema.DatabaseSchema, error)

GetDatabaseSchemas implements the interface doltdb.RootValue.

func (*RootValue) GetFeatureVersion added in v0.7.5

func (root *RootValue) GetFeatureVersion(ctx context.Context) (ver doltdb.FeatureVersion, ok bool, err error)

GetFeatureVersion implements the interface doltdb.RootValue.

func (*RootValue) GetForeignKeyCollection added in v0.7.5

func (root *RootValue) GetForeignKeyCollection(ctx context.Context) (*doltdb.ForeignKeyCollection, error)

GetForeignKeyCollection implements the interface doltdb.RootValue.

func (*RootValue) GetSequences added in v0.7.5

func (root *RootValue) GetSequences(ctx context.Context) (*sequences.Collection, error)

GetSequences returns all sequences that are on the root.

func (*RootValue) GetTable added in v0.7.5

func (root *RootValue) GetTable(ctx context.Context, tName doltdb.TableName) (*doltdb.Table, bool, error)

GetTable implements the interface doltdb.RootValue.

func (*RootValue) GetTableHash added in v0.7.5

func (root *RootValue) GetTableHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, bool, error)

GetTableHash implements the interface doltdb.RootValue.

func (*RootValue) GetTableNames added in v0.7.5

func (root *RootValue) GetTableNames(ctx context.Context, schemaName string) ([]string, error)

GetTableNames implements the interface doltdb.RootValue.

func (*RootValue) GetTableSchemaHash added in v0.11.0

func (root *RootValue) GetTableSchemaHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, error)

GetTableSchemaHash implements the interface doltdb.RootValue.

func (*RootValue) GetTypes added in v0.14.0

func (root *RootValue) GetTypes(ctx context.Context) (*typecollection.TypeCollection, error)

GetTypes returns all types that are on the root.

func (*RootValue) HandlePostMerge added in v0.7.5

func (root *RootValue) HandlePostMerge(ctx context.Context, ourRoot, theirRoot, ancRoot doltdb.RootValue) (doltdb.RootValue, error)

HandlePostMerge implements the interface doltdb.RootValue.

func (*RootValue) HasTable added in v0.7.5

func (root *RootValue) HasTable(ctx context.Context, tName doltdb.TableName) (bool, error)

HasTable implements the interface doltdb.RootValue.

func (*RootValue) HashOf added in v0.7.5

func (root *RootValue) HashOf() (hash.Hash, error)

HashOf implements the interface doltdb.RootValue.

func (*RootValue) IterTables added in v0.7.5

func (root *RootValue) IterTables(ctx context.Context, cb func(name doltdb.TableName, table *doltdb.Table, sch schema.Schema) (stop bool, err error)) error

IterTables implements the interface doltdb.RootValue.

func (*RootValue) NodeStore added in v0.7.5

func (root *RootValue) NodeStore() tree.NodeStore

NodeStore implements the interface doltdb.RootValue.

func (*RootValue) NomsValue added in v0.7.5

func (root *RootValue) NomsValue() types.Value

NomsValue implements the interface doltdb.RootValue.

func (*RootValue) PutForeignKeyCollection added in v0.7.5

func (root *RootValue) PutForeignKeyCollection(ctx context.Context, fkc *doltdb.ForeignKeyCollection) (doltdb.RootValue, error)

PutForeignKeyCollection implements the interface doltdb.RootValue.

func (*RootValue) PutSequences added in v0.7.5

func (root *RootValue) PutSequences(ctx context.Context, seq *sequences.Collection) (*RootValue, error)

PutSequences writes the given sequences to the returned root value.

func (*RootValue) PutTable added in v0.7.5

func (root *RootValue) PutTable(ctx context.Context, tName doltdb.TableName, table *doltdb.Table) (doltdb.RootValue, error)

PutTable implements the interface doltdb.RootValue.

func (*RootValue) PutTypes added in v0.14.0

func (root *RootValue) PutTypes(ctx context.Context, typ *typecollection.TypeCollection) (*RootValue, error)

PutTypes writes the given types to the returned root value.

func (*RootValue) RemoveTables added in v0.7.5

func (root *RootValue) RemoveTables(
	ctx context.Context,
	skipFKHandling bool,
	allowDroppingFKReferenced bool,
	tables ...doltdb.TableName,
) (doltdb.RootValue, error)

RemoveTables implements the interface doltdb.RootValue.

func (*RootValue) RenameTable added in v0.7.5

func (root *RootValue) RenameTable(ctx context.Context, oldName, newName doltdb.TableName) (doltdb.RootValue, error)

RenameTable implements the interface doltdb.RootValue.

func (*RootValue) ResolveRootValue added in v0.7.5

func (root *RootValue) ResolveRootValue(ctx context.Context) (doltdb.RootValue, error)

ResolveRootValue implements the interface doltdb.RootValue.

func (*RootValue) ResolveTableName added in v0.7.5

func (root *RootValue) ResolveTableName(ctx context.Context, tName doltdb.TableName) (string, bool, error)

ResolveTableName implements the interface doltdb.RootValue.

func (*RootValue) SetCollation added in v0.7.5

func (root *RootValue) SetCollation(ctx context.Context, collation schema.Collation) (doltdb.RootValue, error)

SetCollation implements the interface doltdb.RootValue.

func (*RootValue) SetFeatureVersion added in v0.7.5

func (root *RootValue) SetFeatureVersion(v doltdb.FeatureVersion) (doltdb.RootValue, error)

SetFeatureVersion implements the interface doltdb.RootValue.

func (*RootValue) SetTableHash added in v0.7.5

func (root *RootValue) SetTableHash(ctx context.Context, tName doltdb.TableName, h hash.Hash) (doltdb.RootValue, error)

SetTableHash implements the interface doltdb.RootValue.

func (*RootValue) TableListHash added in v0.11.0

func (root *RootValue) TableListHash() uint64

func (*RootValue) VRW added in v0.7.5

func (root *RootValue) VRW() types.ValueReadWriter

VRW implements the interface doltdb.RootValue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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