Documentation ¶
Index ¶
- Constants
- func NewConfigError(msg string) error
- func ParseFile(filePath string) ([]string, error)
- func Setup(cli *cli.Context, db DB) error
- func SetupFromConfig(config *SetupConfig, db DB) error
- func Update(cli *cli.Context, db DB) error
- func VerifyCompatibleVersion(db DB, dirPath string, dbName string) error
- type ConfigError
- type DB
- type SetupConfig
- type SetupTask
- type UpdateConfig
- type UpdateTask
Constants ¶
const ( // CLIOptEndpoint is the cli option for endpoint CLIOptEndpoint = "endpoint" // CLIOptPort is the cli option for port CLIOptPort = "port" // CLIOptUser is the cli option for user CLIOptUser = "user" // CLIOptPassword is the cli option for password CLIOptPassword = "password" // CLIOptTimeout is the cli option for timeout CLIOptTimeout = "timeout" // CLIOptKeyspace is the cli option for keyspace CLIOptKeyspace = "keyspace" // CLIOptDatabase is the cli option for database CLIOptDatabase = "database" // CLIOptDriverName is the cli option for driver name CLIOptDriverName = "driver" // CLIOptVersion is the cli option for version CLIOptVersion = "version" // CLIOptSchemaFile is the cli option for schema file CLIOptSchemaFile = "schema-file" // CLIOptOverwrite is the cli option for overwrite CLIOptOverwrite = "overwrite" // CLIOptDisableVersioning is the cli option to disabling versioning CLIOptDisableVersioning = "disable-versioning" // CLIOptTargetVersion is the cli option for target version CLIOptTargetVersion = "version" // CLIOptDryrun is the cli option for enabling dryrun CLIOptDryrun = "dryrun" // CLIOptSchemaDir is the cli option for schema directory CLIOptSchemaDir = "schema-dir" // CLIOptReplicationFactor is the cli option for replication factor CLIOptReplicationFactor = "replication-factor" // CLIOptQuiet is the cli option for quiet mode CLIOptQuiet = "quiet" // CLIFlagEndpoint is the cli flag for endpoint CLIFlagEndpoint = CLIOptEndpoint + ", ep" // CLIFlagPort is the cli flag for port CLIFlagPort = CLIOptPort + ", p" // CLIFlagUser is the cli flag for user CLIFlagUser = CLIOptUser + ", u" // CLIFlagPassword is the cli flag for password CLIFlagPassword = CLIOptPassword + ", pw" // CLIFlagTimeout is the cli flag for timeout CLIFlagTimeout = CLIOptTimeout + ", t" // CLIFlagKeyspace is the cli flag for keyspace CLIFlagKeyspace = CLIOptKeyspace + ", k" // CLIFlagDatabase is the cli flag for database CLIFlagDatabase = CLIOptDatabase + ", db" // CLIFlagDriverName is the cli flag for driver name CLIFlagDriverName = CLIOptDriverName + ", dr" // CLIFlagVersion is the cli flag for version CLIFlagVersion = CLIOptVersion + ", v" // CLIFlagSchemaFile is the cli flag for schema file CLIFlagSchemaFile = CLIOptSchemaFile + ", f" // CLIFlagOverwrite is the cli flag for overwrite CLIFlagOverwrite = CLIOptOverwrite + ", o" // CLIFlagDisableVersioning is the cli flag for disabling versioning CLIFlagDisableVersioning = CLIOptDisableVersioning + ", d" // CLIFlagTargetVersion is the cli flag for target version CLIFlagTargetVersion = CLIOptTargetVersion + ", v" // CLIFlagDryrun is the cli flag for dryrun CLIFlagDryrun = CLIOptDryrun + ", y" // CLIFlagSchemaDir is the cli flag for schema directory CLIFlagSchemaDir = CLIOptSchemaDir + ", d" // CLIFlagReplicationFactor is the cli flag for replication factor CLIFlagReplicationFactor = CLIOptReplicationFactor + ", rf" // CLIFlagQuiet is the cli flag for quiet mode CLIFlagQuiet = CLIOptQuiet + ", q" )
const DryrunDBName = "_cadence_dryrun_"
DryrunDBName is the db name used for dryrun
Variables ¶
This section is empty.
Functions ¶
func NewConfigError ¶
NewConfigError creates and returns an instance of ConfigError
func ParseFile ¶
ParseFile takes a cql / sql file path as input and returns an array of cql / sql statements on success.
func SetupFromConfig ¶
func SetupFromConfig(config *SetupConfig, db DB) error
SetupFromConfig sets up schema tables based on the given config
Types ¶
type ConfigError ¶
type ConfigError struct {
// contains filtered or unexported fields
}
ConfigError is an error type that represents a problem with the config
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
Error returns a string representation of this error
type DB ¶
type DB interface { // Exec executes a cql statement Exec(stmt string) error //ListTables() ([]string, error) // DropAllTables drops all tables DropAllTables() error // CreateSchemaVersionTables sets up the schema version tables CreateSchemaVersionTables() error // ReadSchemaVersion returns the current schema version for the keyspace ReadSchemaVersion() (string, error) // UpdateSchemaVersion updates the schema version for the keyspace UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error // WriteSchemaUpdateLog adds an entry to the schema update history table WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error // Close gracefully closes the client object Close() }
DB is the database interface that's required to be implemented for the schema-tool to work
type SetupConfig ¶
type SetupConfig struct { SchemaFilePath string InitialVersion string Overwrite bool // overwrite previous data DisableVersioning bool // do not use schema versioning }
SetupConfig holds the config params need by the SetupTask
type SetupTask ¶
type SetupTask struct {
// contains filtered or unexported fields
}
SetupTask represents a task that sets up cassandra schema on a specified keyspace
type UpdateConfig ¶
UpdateConfig holds the config params for executing a UpdateTask
type UpdateTask ¶
type UpdateTask struct {
// contains filtered or unexported fields
}
UpdateTask represents a task that executes a cassandra schema upgrade