README
¶
cockroachdb
cockroachdb://user:password@host:port/dbname?query
(cockroach://
, and crdb-postgres://
work, too)
URL Query | WithInstance Config | Description |
---|---|---|
x-migrations-table |
MigrationsTable |
Name of the migrations table |
x-lock-table |
LockTable |
Name of the table which maintains the migration lock |
x-force-lock |
ForceLock |
Force lock acquisition to fix faulty migrations which may not have released the schema lock (Boolean, default is false ) |
dbname |
DatabaseName |
The name of the database to connect to |
user |
The user to sign in as | |
password |
The user's password | |
host |
The host to connect to. Values that start with / are for unix domain sockets. (default is localhost) | |
port |
The port to bind to. (default is 5432) | |
connect_timeout |
Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely. | |
sslcert |
Cert file location. The file must contain PEM encoded data. | |
sslkey |
Key file location. The file must contain PEM encoded data. | |
sslrootcert |
The location of the root certificate file. The file must contain PEM encoded data. | |
sslmode |
Whether or not to use SSL (disable|require|verify-ca|verify-full) |
Documentation
¶
Index ¶
- Variables
- func WithInstance(instance *sql.DB, config *Config) (database.Driver, error)
- type CockroachDb
- func (c *CockroachDb) Close() error
- func (c *CockroachDb) Drop() error
- func (c *CockroachDb) Lock() error
- func (c *CockroachDb) Open(url string) (database.Driver, error)
- func (c *CockroachDb) Run(migration io.Reader) error
- func (c *CockroachDb) SetVersion(version int, dirty bool) error
- func (c *CockroachDb) Unlock() error
- func (c *CockroachDb) Version() (version int, dirty bool, err error)
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilConfig = fmt.Errorf("no config") ErrNoDatabaseName = fmt.Errorf("no database name") )
View Source
var DefaultLockTable = "schema_lock"
View Source
var DefaultMigrationsTable = "schema_migrations"
Functions ¶
Types ¶
type CockroachDb ¶
type CockroachDb struct {
// contains filtered or unexported fields
}
func (*CockroachDb) Close ¶
func (c *CockroachDb) Close() error
func (*CockroachDb) Drop ¶
func (c *CockroachDb) Drop() error
func (*CockroachDb) Lock ¶
func (c *CockroachDb) Lock() error
Locking is done manually with a separate lock table. Implementing advisory locks in CRDB is being discussed See: https://github.com/cockroachdb/cockroach/issues/13546
func (*CockroachDb) SetVersion ¶
func (c *CockroachDb) SetVersion(version int, dirty bool) error
func (*CockroachDb) Unlock ¶
func (c *CockroachDb) Unlock() error
Locking is done manually with a separate lock table. Implementing advisory locks in CRDB is being discussed See: https://github.com/cockroachdb/cockroach/issues/13546
Click to show internal directories.
Click to hide internal directories.