schemar

package
v3.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package schemar provides the core Schemar interface.

Index

Constants

View Source
const (
	ErrCodeDatabaseIDInvalid   errors.Code = "DatabaseIDInvalid"
	ErrCodeDatabaseNameInvalid errors.Code = "DatabaseNameInvalid"

	ErrCodeTableIDInvalid    errors.Code = "TableIDInvalid"
	ErrCodeTableNameInvalid  errors.Code = "TableNameInvalid"
	ErrCodeInvalidPrimaryKey errors.Code = "InvalidPrimaryKey"

	ErrCodeFieldNameInvalid errors.Code = "FieldNameInvalid"
)

Variables

This section is empty.

Functions

func NewErrDatabaseIDInvalid

func NewErrDatabaseIDInvalid(databaseID dax.DatabaseID) error

func NewErrDatabaseNameInvalid

func NewErrDatabaseNameInvalid(databaseName dax.DatabaseName) error

func NewErrFieldNameInvalid

func NewErrFieldNameInvalid(fieldName dax.FieldName) error

func NewErrInvalidPrimaryKey

func NewErrInvalidPrimaryKey() error

func NewErrTableIDInvalid

func NewErrTableIDInvalid(tableID dax.TableID) error

func NewErrTableNameInvalid

func NewErrTableNameInvalid(tableName dax.TableName) error

Types

type NopSchemar

type NopSchemar struct{}

NopSchemar is a no-op implementation of the Schemar interface.

func NewNopSchemar

func NewNopSchemar() *NopSchemar

func (*NopSchemar) CreateDatabase

func (s *NopSchemar) CreateDatabase(tx dax.Transaction, qtbl *dax.QualifiedDatabase) error

func (*NopSchemar) CreateField

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

func (*NopSchemar) CreateTable

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

func (*NopSchemar) DatabaseByID

func (*NopSchemar) Databases

func (*NopSchemar) DropDatabase

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

func (*NopSchemar) DropField

func (s *NopSchemar) DropField(tx dax.Transaction, qtid dax.QualifiedTableID, fld dax.FieldName) error

func (*NopSchemar) DropTable

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

func (*NopSchemar) SetDatabaseOption added in v3.32.0

func (s *NopSchemar) SetDatabaseOption(tx dax.Transaction, qdbid dax.QualifiedDatabaseID, option string, value string) error

func (*NopSchemar) Table

func (*NopSchemar) Tables

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

type Schemar

type Schemar interface {
	CreateDatabase(dax.Transaction, *dax.QualifiedDatabase) error
	DropDatabase(dax.Transaction, dax.QualifiedDatabaseID) error
	DatabaseByName(tx dax.Transaction, orgID dax.OrganizationID, dbname dax.DatabaseName) (*dax.QualifiedDatabase, error)
	DatabaseByID(dax.Transaction, dax.QualifiedDatabaseID) (*dax.QualifiedDatabase, error)

	SetDatabaseOption(tx dax.Transaction, qdbid dax.QualifiedDatabaseID, option string, value string) error

	// Databases returns a list of databases. If the list of DatabaseIDs is
	// empty, all databases will be returned. If greater than zero DatabaseIDs
	// are passed in the second argument, only databases matching those IDs will
	// be returned.
	Databases(dax.Transaction, dax.OrganizationID, ...dax.DatabaseID) ([]*dax.QualifiedDatabase, error)

	CreateTable(dax.Transaction, *dax.QualifiedTable) error
	DropTable(dax.Transaction, dax.QualifiedTableID) error
	CreateField(dax.Transaction, dax.QualifiedTableID, *dax.Field) error
	DropField(dax.Transaction, dax.QualifiedTableID, dax.FieldName) error
	Table(dax.Transaction, dax.QualifiedTableID) (*dax.QualifiedTable, error)

	// Tables returns a list of tables. If the qualifiers DatabaseID is empty,
	// all tables in the org will be returned. If the OrganizationID is empty,
	// all tables will be returned. If both are populated, only tables in that
	// database will be returned. If greater than zero table IDs are passed in
	// the third argument, only tables matching those IDs will be returned.
	Tables(dax.Transaction, dax.QualifiedDatabaseID, ...dax.TableID) ([]*dax.QualifiedTable, error)

	// TableID is a reverse-lookup method to get the TableID for a given
	// qualified TableName.
	TableID(dax.Transaction, dax.QualifiedDatabaseID, dax.TableName) (dax.QualifiedTableID, error)
}

Schemar is the interface to the schema service which holds all the databases and tables stored in the system.

Jump to

Keyboard shortcuts

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