generator

package
v0.0.0-...-3c8ad4e Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MessageColumnExists is a fragment of the CQL error we see when a column already exists.
	MessageColumnExists = "conflicts with an existing column"
)

Variables

View Source
var ErrInvalidInput = errors.New("invalid input or object not specified")

ErrInvalidInput indicates an input object was not specifier

Functions

func CreateDDLFromTableSpecification

func CreateDDLFromTableSpecification(keyspace string, spec *metadata.TableSpecification, existingMetadata *tableMetadata) ([]metadata.DDLOperation, error)

CreateDDLFromTableSpecification creates the DDL to create and extend a table from its table specification

func CreateDDLFromTypeSpecification

func CreateDDLFromTypeSpecification(keyspace string, spec *metadata.TypeSpecification, existingMetadata *gocql.TypeMetadata) ([]metadata.DDLOperation, error)

CreateDDLFromTypeSpecification creates the DDL to create a type from its spec

func CreateDDLFromViewSpecification

func CreateDDLFromViewSpecification(keyspace string, spec *metadata.ViewSpecification, existing *gocql.ViewMetadata) ([]metadata.DDLOperation, error)

CreateDDLFromViewSpecification creates the DDL to create a view from its spec

func CreateKeyspace

func CreateKeyspace(ctx context.Context, sess gocqlx.Session, keyspace string, options ...KeyspaceOption) error

func DescribeKeyspaceMetadata

func DescribeKeyspaceMetadata(sess gocqlx.Session, keyspace string) (*gocql.KeyspaceMetadata, error)

DescribeKeyspaceMetadata reads the schema of a keyspace from the database

func DescribeTableMetadata

func DescribeTableMetadata(sess gocqlx.Session, keyspace string, tableName string) (*tableMetadata, error)

DescribeTableMetadata reads the schema of a table in a given keyspace schema from the database

func DescribeTypeMetadata

func DescribeTypeMetadata(sess gocqlx.Session, keyspace string, typeName string) (*gocql.TypeMetadata, error)

DescribeTypeMetadata reads the schema of a type in a given keyspace schema from the database

func DescribeViewMetadata

func DescribeViewMetadata(sess gocqlx.Session, keyspace string, viewName string) (*gocql.ViewMetadata, error)

DescribeViewMetadata reads the schema of a view in a given keyspace schema from the database

func WithAutomaticTableManagement

func WithAutomaticTableManagement(log *zap.Logger, clusterFn utils.ClusterConfigGeneratorFn) tables.ManagerOption

WithAutomaticTableManagement automatically performs management of tables and structures on startup when using a tables.TableManager, using the charybdis DDL generator.

func WithAutomaticTypeManagement

func WithAutomaticTypeManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn) tables.ManagerOption

func WithAutomaticViewManagement

func WithAutomaticViewManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn) tables.ManagerOption

WithAutomaticViewManagement automatically performs management of views and structures on startup when using a tables.ViewManager, using the charybdis DDL generator.

func WithGlobalNetworkAwareKeyspaceManagement

func WithGlobalNetworkAwareKeyspaceManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn, replicationFactor int) tables.ManagerOption

WithGlobalNetworkAwareKeyspaceManagement creates a network aware keyspace with global network aware replication. This is the equivalent of using WithNetworkAwareKeyspaceManagement with the same replication for every DC in the cluster.

func WithKeyspaceManagement

func WithKeyspaceManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn, options ...KeyspaceOption) tables.ManagerOption

WithKeyspaceManagement does a 'CREATE KEYSPACE' command at the startup, with replication factor and other options passed in as args.

func WithNetworkAwareKeyspaceManagement

func WithNetworkAwareKeyspaceManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn, replicationFactors map[string]int32) tables.ManagerOption

WithNetworkAwareKeyspaceManagement creates a network aware keyspace

func WithSimpleKeyspaceManagement

func WithSimpleKeyspaceManagement(log *zap.Logger, cluster utils.ClusterConfigGeneratorFn, replicationFactor int) tables.ManagerOption

WithSimpleKeyspaceManagement does a 'CREATE KEYSPACE' command at the startup, with a default replication factor. This should only be used for trivial scenarios.

Types

type KeyspaceOption

type KeyspaceOption func(*KeyspaceOptions)

func UsingLogger

func UsingLogger(logger *zap.Logger) KeyspaceOption

func UsingNetworkReplication

func UsingNetworkReplication(factor int) KeyspaceOption

func UsingNetworkReplicationFactors

func UsingNetworkReplicationFactors(factors map[string]int32) KeyspaceOption

func UsingOptions

func UsingOptions(from KeyspaceOptions) KeyspaceOption

func UsingReplicationFactor

func UsingReplicationFactor(factor int) KeyspaceOption

func UsingTablets

func UsingTablets(enable bool) KeyspaceOption

type KeyspaceOptions

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

func CollectKeyspaceOptions

func CollectKeyspaceOptions(opts []KeyspaceOption) KeyspaceOptions

Jump to

Keyboard shortcuts

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