schema

package
v0.0.0-...-0236cb5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadColumns

func LoadColumns(ctx context.Context, client *spanner.Client, t Table) error

func LoadIndexes

func LoadIndexes(ctx context.Context, client *spanner.Client, t Table) error

func LoadTable

func LoadTable(ctx context.Context, client *spanner.Client, s Schema, t string) error

func LoadTables

func LoadTables(ctx context.Context, client *spanner.Client, s Schema) error

func ParseSpannerType

func ParseSpannerType(spannerType string) spansql.Type

TODO: Return an error rather than panic

Types

type Column

type Column interface {
	SetName(string)
	Name() string
	SetPosition(int64)
	Position() int64
	SetNullable(string)
	Nullable() string
	SetSpannerType(string)
	SpannerType() string
	SetIsGenerated(bool)
	IsGenerated() bool
	SetGenerationExpression(string)
	GenerationExpression() string
	SetIsStored(string)
	IsStored() string
	SetSpannerState(string)
	SpannerState() string
	SetPrimaryKey(bool)
	PrimaryKey() bool
	SetAllowCommitTimestamp(bool)
	AllowCommitTimestamp() bool
	Type() spansql.Type
}

func NewColumn

func NewColumn() Column

func NewColumnFromSchema

func NewColumnFromSchema(x information.Column) Column

type ColumnIterator

type ColumnIterator interface {
	ResetIterator()
	HasNext() bool
	GetNext() Column
}

type Columns

type Columns interface {
	ColumnIterator
	Columns() []Column
	AddColumn(Column)
	ColumnNames() []string
	PrimaryKeys() Columns
	Len() int
}

func NewColumns

func NewColumns() Columns

type Index

type Index interface {
	SetIndexName(string)
	IndexName() string
	SetIsUnique(bool)
	IsUnique() bool
	SetIsNullFiltered(bool)
	IsNullFiltered() bool
	SetIndexState(string)
	IndexState() string
}

func NewIndex

func NewIndex() Index

func NewIndexFromSchema

func NewIndexFromSchema(x information.Index) Index

type IndexIterator

type IndexIterator interface {
	ResetIterator()
	HasNext() bool
	GetNext() Index
}

type Indexes

type Indexes interface {
	IndexIterator
	Indexes() []Index
	AddIndex(Index)
}

func NewIndexes

func NewIndexes() Indexes

type Schema

type Schema interface {
	SetTable(Table) // TODO: Remove this
	Table() Table
	AddTable(Table)
	Tables() Tables
	GetTable(string) Table

	// Traverse should be called after a schema load operation to detect interleaved relationships
	Traverse() error
}

func LoadSchema

func LoadSchema(ctx context.Context, cfg *config.Config) (Schema, error)

func LoadSingleTableSchema

func LoadSingleTableSchema(ctx context.Context, cfg *config.Config, t string) (Schema, error)

TODO: Get rid of this in milestone 2 (multi-table)

func NewSchema

func NewSchema() Schema

type Table

type Table interface {
	SetName(string)
	Name() string
	SetType(string)
	Type() string
	HasParent() bool
	SetParentName(string)
	ParentName() string
	SetParent(Table)
	Parent() Table
	HasChild() bool
	SetChildName(string)
	ChildName() string
	SetChild(Table)
	Child() Table

	SetSpanenrState(string)
	SpannerState() string

	AddColumn(Column)
	AddIndex(Index)
	Columns() Columns
	ColumnNames() []string

	PrimaryKeys() Columns
	PrimaryKeyNames() []string
	PointInsertStatement() (string, error)
	PointReadStatement(...string) (string, error)
	TableSample(float64) (string, error)

	IsView() bool
	// IsInterleaved will return true if the table has a parent or child
	IsInterleaved() bool
	// IsApex will return true if the table is the apex of an interleaved relationship
	IsApex() bool
	// IsBottom will return true if table is the bottom of an interleaved relationship
	IsBottom() bool
	// GetApex will return the top level parent or nil if it does not exist
	GetApex() Table
	GetAllRelationNames() []string
}

func NewTable

func NewTable() Table

func NewTableFromSchema

func NewTableFromSchema(x information.Table) Table

type TableIterator

type TableIterator interface {
	ResetIterator()
	HasNext() bool
	GetNext() Table
}

type Tables

type Tables interface {
	TableIterator
	Len() int
	Tables() []Table
	AddTable(Table)
	GetTable(string) Table
	Traverse() error
}

func NewTables

func NewTables() Tables

Directories

Path Synopsis
package information is used for performing schema inference.
package information is used for performing schema inference.
package sample contains sample schemas to help demonstrate load testing
package sample contains sample schemas to help demonstrate load testing

Jump to

Keyboard shortcuts

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