metadata

package
v0.0.0-...-1d998db Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInconsistentMetadata = errors.New("inconsistent metadata")

ErrInconsistentMetadata indicates a value is inconsistent, such as the column being marked for clustering, but not present in the list of clustering columns

View Source
var ErrInvalidColumnName = errors.New("invalid column name")

ErrInvalidColumnName indicates a column name is invalid

View Source
var ErrInvalidTableOrViewName = errors.New("invalid table, type or view name")

ErrInvalidTableOrViewName indicates a table or view name is invalid

View Source
var ErrMismatchedColumns = errors.New("mismatched columns on object")

ErrMismatchedColumns indicates one of the columns referenced in an object is not present in the column list.

View Source
var ErrNoFields = errors.New("no fields")

ErrNoFields indicates a type has no fields defined

View Source
var ErrNoObject = errors.New("object missing or undefined")

ErrNoObject indicates an object is missing

View Source
var ErrNoPartitioningKey = errors.New("no partitioning key")

ErrNoPartitioningKey indicates we have no partitioning key

View Source
var ErrViewKeyUnsuitable = errors.New("view keys must contain all table keys, plus at most one extra")

ErrViewKeyUnsuitable indicates the view key definition was incorrect. It either is missing a base table key, or has multiple additional fields.

Functions

This section is empty.

Types

type ClusteringColumn

type ClusteringColumn struct {
	Column     *ColumnSpecification `json:"column"`     // The column we're referring to
	Order      int                  `json:"order"`      // Order of the column
	Descending bool                 `json:"descending"` // Descending order?
}

ClusteringColumn indicates a clustering key column

type ClusteringColumnLookup

type ClusteringColumnLookup struct {
	Column     string `json:"column"`     // The column we're referring to
	Order      int    `json:"order"`      // Order of the column
	Descending bool   `json:"descending"` // Descending order?
}

ClusteringColumnLookup is a clustering column definition without a reference back to the base.

type ColumnSpecification

type ColumnSpecification struct {
	Name              string `json:"name"`            // Name of the column
	CQLType           string `json:"cql_type"`        // The CQL Type string for this column
	IsPartitioningKey bool   `json:"is_partitioning"` // Partitioning key?
	IsClusteringKey   bool   `json:"is_clustering"`   // Clustering key?
}

ColumnSpecification is a specification that describes a column

func (*ColumnSpecification) Validate

func (c *ColumnSpecification) Validate() error

Validate the column specification

type DDLOperation

type DDLOperation struct {
	Description  string
	Command      string
	IgnoreErrors []string
}

DDLOperation defines the DDL operations to take place

type FieldSpecification

type FieldSpecification struct {
	Name    string `json:"name"`     // Name of the field
	CQLType string `json:"cql_type"` // The CQL Type string for this field
}

FieldSpecification is a specification that describes a field of a type

func (*FieldSpecification) Validate

func (c *FieldSpecification) Validate() error

Validate the column specification

type ParameterizedQuery

type ParameterizedQuery struct {
	Statement  string   `json:"statement"`  // CQL statement
	Parameters []string `json:"parameters"` // Parameters of the query in appearance order
}

ParameterizedQuery is a structure that describes a parameterized query

type PartitioningColumn

type PartitioningColumn struct {
	Column *ColumnSpecification `json:"column"` // The column we're referring to
	Order  int                  `json:"order"`  // Order of the column
}

PartitioningColumn indicates a partitioning key column

type PartitioningColumnLookup

type PartitioningColumnLookup struct {
	Column string `json:"column"` // The column we're referring to
	Order  int    `json:"order"`  // Order of the column
}

PartitioningColumnLookup handles a partitioning key column when querying

type TableSpecification

type TableSpecification struct {
	Name         string                          `json:"name"`         // Name of the table?
	Columns      []*ColumnSpecification          `json:"columns"`      // Columns of the table
	Partitioning []*PartitioningColumn           `json:"partitioning"` // Partitioning keys
	Clustering   []*ClusteringColumn             `json:"clustering"`   // Clustering keys
	Indexes      map[string]*ColumnSpecification `json:"indexes"`      // Indexes to create
	CustomTypes  []*TypeSpecification            `json:"custom_types"` // If any columns use a custom type, record it here so we can create it if needed
}

TableSpecification is a description of a table.

func (*TableSpecification) Canonicalize

func (t *TableSpecification) Canonicalize()

Canonicalize the form of the structure

func (*TableSpecification) Clone

func (t *TableSpecification) Clone(includeIndexes bool) *TableSpecification

Clone the table specification

func (*TableSpecification) ToCQLX

func (t *TableSpecification) ToCQLX() *table.Table

ToCQLX converts this tablespec to a go-cqlx friendly metadata object.

func (*TableSpecification) Validate

func (t *TableSpecification) Validate() error

Validate the table specification

type TypeSpecification

type TypeSpecification struct {
	Keyspace string                `json:"keyspace"` // The Keyspace the type is created in
	Name     string                `json:"name"`     // Name of the type to create.
	Fields   []*FieldSpecification `json:"fields"`   // Fields in the type
}

TypeSpecification is a specification of a type.

func (*TypeSpecification) Clone

func (*TypeSpecification) ToCQLX

func (v *TypeSpecification) ToCQLX() *gocql.TypeMetadata

ToCQLX converts this tablespec to a go-cqlx friendly metadata object.

func (*TypeSpecification) Validate

func (v *TypeSpecification) Validate() error

Validate the table specification

type Version

type Version struct {
	Major int
	Minor int
	Patch int
	Tag   string
}

Version holds software version information that typically specified in the form: z.y.z-ww

func GetScyllaVersion

func GetScyllaVersion(ctx context.Context, sess gocqlx.Session) (Version, error)

GetScyllaVersion returns the version of Scylla server that we're connected to

type ViewSpecification

type ViewSpecification struct {
	Name         string                `json:"name"`         // Name of the view to create.
	Table        *TableSpecification   `json:"table"`        // Table we are a view of
	Partitioning []*PartitioningColumn `json:"partitioning"` // Partitioning keys
	Clustering   []*ClusteringColumn   `json:"clustering"`   // Clustering keys
}

ViewSpecification is a specification of a view.

func (*ViewSpecification) ToCQLX

func (v *ViewSpecification) ToCQLX() *table.Table

ToCQLX converts this tablespec to a go-cqlx friendly metadata object.

func (*ViewSpecification) Validate

func (v *ViewSpecification) Validate() error

Validate the table specification

Jump to

Keyboard shortcuts

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