boltdb

package
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package boltdb contains the boltdb implementation of the Schemar interfaces.

Index

Constants

This section is empty.

Variables

View Source
var SchemarBuckets []boltdb.Bucket = []boltdb.Bucket{
	bucketSchemar,
}

SchemarBuckets defines the buckets used by this package. It can be called during setup to create the buckets ahead of time.

Functions

This section is empty.

Types

type Schemar

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

func NewSchemar

func NewSchemar(db *boltdb.DB, logger logger.Logger) *Schemar

NewSchemar returns a new instance of Schemar with default values.

func (*Schemar) CreateDatabase

func (s *Schemar) CreateDatabase(tx dax.Transaction, qdb *dax.QualifiedDatabase) error

CreateDatabase creates the database provided. If a database with the same name already exists then an error is returned. For now, we are not going to store the tables in the schemar Database struct.

func (*Schemar) CreateField

func (s *Schemar) CreateField(tx dax.Transaction, qtid dax.QualifiedTableID, fld *dax.Field) error

CreateField creates the field provided in the given table. If a field with the same name already exists then an error is returned.

func (*Schemar) CreateTable

func (s *Schemar) CreateTable(tx dax.Transaction, qtbl *dax.QualifiedTable) error

CreateTable creates the table provided. If a table with the same name already exists then an error is returned.

func (*Schemar) DatabaseByID

func (s *Schemar) DatabaseByID(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) (*dax.QualifiedDatabase, error)

func (*Schemar) DatabaseByName

func (s *Schemar) DatabaseByName(tx dax.Transaction, orgID dax.OrganizationID, dbname dax.DatabaseName) (*dax.QualifiedDatabase, error)

func (*Schemar) Databases

func (s *Schemar) Databases(tx dax.Transaction, orgID dax.OrganizationID, ids ...dax.DatabaseID) ([]*dax.QualifiedDatabase, error)

func (*Schemar) DropDatabase

func (s *Schemar) DropDatabase(tx dax.Transaction, qdbid dax.QualifiedDatabaseID) error

DropDatabase drops the given database. If the named/IDed database does not exist then an error is returned.

func (*Schemar) DropField

func (s *Schemar) DropField(tx dax.Transaction, qtid dax.QualifiedTableID, fldName dax.FieldName) error

DropField removes the field from the table.

func (*Schemar) DropTable

func (s *Schemar) DropTable(tx dax.Transaction, qtid dax.QualifiedTableID) error

DropTable drops the given table. If the named/IDed table does not exist then an error is returned.

func (*Schemar) SetDatabaseOptions

func (s *Schemar) SetDatabaseOptions(tx dax.Transaction, qdbid dax.QualifiedDatabaseID, opts dax.DatabaseOptions) error

SetDatabaseOptions overwrites the existing database options with those provided for the given database.

func (*Schemar) Table

Table returns the TableInfo for the given table. An error is returned if the table does not exist.

func (*Schemar) TableID

func (*Schemar) Tables

func (s *Schemar) Tables(tx dax.Transaction, qdbid dax.QualifiedDatabaseID, ids ...dax.TableID) ([]*dax.QualifiedTable, error)

Tables returns a list of Table for all existing tables. If one or more table IDs is provided, then only those will be included in the output.

Jump to

Keyboard shortcuts

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