command

package
v0.0.0-...-0a47f3e Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package command provides helpers to create a binary / command from a migration sequence.

Index

Constants

View Source
const (
	// EnvVarMySQLPassword is the environment variable used to supply a MySQL
	// password. Due to the sensitive nature of passwords, we don't support a
	// `--password` flag for passing along a password in plain text.
	EnvVarMySQLPassword = "DB_PASSWORD"
)
View Source
const (
	// EnvVarPostgresPassword is the environment variable officially supported by
	// `psql` for a password. Due to the sensitive nature of passwords, we
	// don't support a `--password` flag for passing along a password in plain
	// text.
	EnvVarPostgresPassword = "PGPASSWORD"
)

Variables

This section is empty.

Functions

func MakeRootCommand

func MakeRootCommand(rm RegisterMigrations) (*cobra.Command, error)

MakeRootCommand creates a `cobra` command that is bound to a sequence of migrations. The flags for the root command and relevant subcommands will be used to configure a `Manager`.

Types

type RegisterMigrations

type RegisterMigrations = func(sqlDirectory, engine string) (*golembic.Migrations, error)

RegisterMigrations defines a function interface that registers an entire sequence of migrations. The inputs are a directory where `.sql` files may be stored and the database engine (i.e. `postgres` or `mysql`). Functions satisfying this interface are intended to be used to lazily create migrations after flag parsing provides the SQL directory and engine as input.

type RoundDuration

type RoundDuration struct {
	Base  time.Duration
	Value *time.Duration
}

RoundDuration wraps a `time.Duration` as a value that can be used as flag with `cobra` / `pflag`, but one that must be convertible to a multiple of some base duration.

func (*RoundDuration) Set

func (rd *RoundDuration) Set(value string) error

Set sets the duration based on a string input.

func (*RoundDuration) String

func (rd *RoundDuration) String() string

String is the string representation of the stored value.

func (*RoundDuration) Type

func (*RoundDuration) Type() string

Type is a human readable "description" of the underlying type being represented.

Jump to

Keyboard shortcuts

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