Documentation ¶
Index ¶
Constants ¶
const ( DefaultHost = "localhost" DefaultUser = "root" DefaultPort = "26257" DefaultDatabase = "service" DefaultMigrationTable = "schema_migrations" )
Defaults for cockroachdb connection string
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cockroach ¶
type Cockroach struct { MigrationsPath string // contains filtered or unexported fields }
Cockroach wraps a database connection along with the necessary fields required to run migrations against said database.
func NewCockroach ¶
func NewCockroach(path string, opts *CockroachConnectionOptions) (*Cockroach, error)
NewCockroach provides a Migrator to be ran against a CockroachDB databases
type CockroachConnectionOptions ¶
type CockroachConnectionOptions struct { *ConnectionOptions // MigrationTable optionally specifies the table name to store migration // history in. If not specified it'll default to `schema_migrations`. MigrationTable string // Secure informs the migrator that the connection is secured via SSL, // and that it should use the certificates from `SSL` struct paths when // verifying the identity and connecting to the database. Secure bool // SSL is used in conjunction with `Secure`. SSL *CockroachSSL }
CockroachConnectionOptions expands on the standard ConnectionOptions and adds support for cockroachdb's secure connection along with a specified table to store migration information under
func (*CockroachConnectionOptions) ConnectionString ¶
func (co *CockroachConnectionOptions) ConnectionString() (string, error)
ConnectionString concatenates the CockroachConnectionOptions down to a string, applying defaults to options that were not set ready to be used in a connection to the database
type CockroachSSL ¶
CockroachSSL contains paths to the SSL keys on the disk for making a connection to a secured database.
type ConnectionOptions ¶
type ConnectionOptions struct { Host string Port int User string Pass string Database string // contains filtered or unexported fields }
ConnectionOptions define a collection of information that's required to connect to any database in order to be able to run migrations. This will be used by all `Migrator`s, either embedded in database-specific options, or wholly.
func (*ConnectionOptions) String ¶
func (co *ConnectionOptions) String() (string, error)
ConnectionString concatenates the CockroachConnectionOptions down to a string, applying defaults to options that were not set ready to be used in a connection to the database