Documentation ¶
Index ¶
- func InitSchemas(ctx context.Context, to, from DBConn) (err error)
- func Migrate(ctx context.Context, c chan *Result, migrations ...*Migration)
- func MongoToV1(ctx context.Context, to, from DBConn) (err error)
- type DBConn
- type DBOption
- type DBOptions
- type Migration
- type MigrationBuilder
- func (m *MigrationBuilder) Build() *Migration
- func (m *MigrationBuilder) From(from DBConn) *MigrationBuilder
- func (m *MigrationBuilder) Name(name string) *MigrationBuilder
- func (m *MigrationBuilder) RunFunc(f func(context.Context, DBConn, DBConn) error) *MigrationBuilder
- func (m *MigrationBuilder) To(to DBConn) *MigrationBuilder
- type MongoDB
- type PostgresDB
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSchemas ¶
InitSchemas executes the DDL that initializes the schemas and tables that the different IM Operands will use.
Types ¶
type DBOptions ¶
type DBOptions struct { Name string // the name of the database used in a DSN ID string // the identifier used for logs, recording migration activity, etc. Port string // the port used to connect to User string // the user to authenticate as Password string // the password to authenticate with Host string // the database hostname/URL TLSConfig *tls.Config // the certificates used to authenticate with Schemas []string // a list of schema names }
DBOptions repesent a series of details about a given database instance
func (*DBOptions) GetMigrationKey ¶
GetMigrationKey returns a key name used for writing back successful migration state to some other database
type Migration ¶
type MigrationBuilder ¶
type MigrationBuilder struct {
Migration *Migration
}
func NewMigration ¶
func NewMigration() *MigrationBuilder
func (*MigrationBuilder) Build ¶
func (m *MigrationBuilder) Build() *Migration
func (*MigrationBuilder) From ¶
func (m *MigrationBuilder) From(from DBConn) *MigrationBuilder
func (*MigrationBuilder) Name ¶
func (m *MigrationBuilder) Name(name string) *MigrationBuilder
func (*MigrationBuilder) RunFunc ¶
func (m *MigrationBuilder) RunFunc(f func(context.Context, DBConn, DBConn) error) *MigrationBuilder
func (*MigrationBuilder) To ¶
func (m *MigrationBuilder) To(to DBConn) *MigrationBuilder
type MongoDB ¶
func NewMongoDB ¶
type PostgresDB ¶
type PostgresDB struct { *DBOptions Conn *pgx.Conn }
func NewPostgresDB ¶
func NewPostgresDB(opts ...DBOption) (*PostgresDB, error)
func (*PostgresDB) Disconnect ¶
func (p *PostgresDB) Disconnect(ctx context.Context) error
func (*PostgresDB) HasSchemas ¶
func (p *PostgresDB) HasSchemas(ctx context.Context) (bool, error)
Click to show internal directories.
Click to hide internal directories.