Documentation ¶
Index ¶
- type Clickhouse
- func (c *Clickhouse) CreateMigrationHistoryTable(ctx context.Context) error
- func (c *Clickhouse) DropMigrationHistoryTable(ctx context.Context) error
- func (c *Clickhouse) ExecQuery(ctx context.Context, query string, args ...any) error
- func (c *Clickhouse) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
- func (c *Clickhouse) ForceSafely() bool
- func (c *Clickhouse) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
- func (c *Clickhouse) InsertMigration(ctx context.Context, version string) error
- func (c *Clickhouse) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
- func (c *Clickhouse) MigrationsCount(ctx context.Context) (int, error)
- func (c *Clickhouse) RemoveMigration(ctx context.Context, version string) error
- func (c *Clickhouse) TableNameWithSchema() string
- type Connection
- type DBError
- type MySQL
- func (m *MySQL) CreateMigrationHistoryTable(ctx context.Context) error
- func (m *MySQL) DropMigrationHistoryTable(ctx context.Context) error
- func (m *MySQL) ExecQuery(ctx context.Context, query string, args ...any) error
- func (m *MySQL) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
- func (m *MySQL) ForceSafely() bool
- func (m *MySQL) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
- func (m *MySQL) InsertMigration(ctx context.Context, version string) error
- func (m *MySQL) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
- func (m *MySQL) MigrationsCount(ctx context.Context) (int, error)
- func (m *MySQL) RemoveMigration(ctx context.Context, version string) error
- func (m *MySQL) TableNameWithSchema() string
- type Options
- type Postgres
- func (p *Postgres) CreateMigrationHistoryTable(ctx context.Context) error
- func (p *Postgres) DropMigrationHistoryTable(ctx context.Context) error
- func (p *Postgres) ExecQuery(ctx context.Context, query string, args ...any) error
- func (p *Postgres) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
- func (p *Postgres) ForceSafely() bool
- func (p *Postgres) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
- func (p *Postgres) InsertMigration(ctx context.Context, version string) error
- func (p *Postgres) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
- func (p *Postgres) MigrationsCount(ctx context.Context) (int, error)
- func (p *Postgres) RemoveMigration(ctx context.Context, version string) error
- func (p *Postgres) TableNameWithSchema() string
- type Repository
- func (r *Repository) CreateMigrationHistoryTable(ctx context.Context) error
- func (r *Repository) DropMigrationHistoryTable(ctx context.Context) error
- func (r *Repository) ExecQuery(ctx context.Context, query string, args ...any) error
- func (r *Repository) ExecQueryTransaction(ctx context.Context, fnTx func(ctx context.Context) error) error
- func (r *Repository) ForceSafely() bool
- func (r *Repository) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
- func (r *Repository) InsertMigration(ctx context.Context, version string) error
- func (r *Repository) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
- func (r *Repository) MigrationsCount(ctx context.Context) (int, error)
- func (r *Repository) RemoveMigration(ctx context.Context, version string) error
- func (r *Repository) TableNameWithSchema() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clickhouse ¶
type Clickhouse struct {
// contains filtered or unexported fields
}
func NewClickhouse ¶
func NewClickhouse(conn Connection, options *Options) *Clickhouse
func (*Clickhouse) CreateMigrationHistoryTable ¶
func (c *Clickhouse) CreateMigrationHistoryTable(ctx context.Context) error
CreateMigrationHistoryTable creates a new migration history table.
func (*Clickhouse) DropMigrationHistoryTable ¶
func (c *Clickhouse) DropMigrationHistoryTable(ctx context.Context) error
DropMigrationHistoryTable drops the migration history table.
func (*Clickhouse) ExecQuery ¶
ExecQuery executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*Clickhouse) ExecQueryTransaction ¶
func (c *Clickhouse) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
ExecQueryTransaction executes txFn in transaction. todo: называется ExecQuery но query не принимает. подумать
func (*Clickhouse) ForceSafely ¶
func (c *Clickhouse) ForceSafely() bool
func (*Clickhouse) HasMigrationHistoryTable ¶
func (c *Clickhouse) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
HasMigrationHistoryTable returns true if migration history table exists.
func (*Clickhouse) InsertMigration ¶
func (c *Clickhouse) InsertMigration(ctx context.Context, version string) error
InsertMigration inserts the new migration record.
func (*Clickhouse) Migrations ¶
func (c *Clickhouse) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
Migrations returns applied migrations history.
func (*Clickhouse) MigrationsCount ¶
func (c *Clickhouse) MigrationsCount(ctx context.Context) (int, error)
MigrationsCount returns the number of migrations
func (*Clickhouse) RemoveMigration ¶
func (c *Clickhouse) RemoveMigration(ctx context.Context, version string) error
RemoveMigration removes the migration record.
func (*Clickhouse) TableNameWithSchema ¶
func (c *Clickhouse) TableNameWithSchema() string
type Connection ¶
type Connection interface { DSN() string Driver() connection.Driver Ping() error QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) Transaction(ctx context.Context, txFn func(ctx context.Context) error) error }
type DBError ¶
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
func NewMySQL ¶
func NewMySQL(conn Connection, options *Options) *MySQL
func (*MySQL) CreateMigrationHistoryTable ¶
CreateMigrationHistoryTable creates a new migration history table.
func (*MySQL) DropMigrationHistoryTable ¶
DropMigrationHistoryTable drops the migration history table.
func (*MySQL) ExecQuery ¶
ExecQuery executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*MySQL) ExecQueryTransaction ¶
func (m *MySQL) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
ExecQueryTransaction executes a query in transaction without returning any rows. The args are for any placeholder parameters in the query.
func (*MySQL) ForceSafely ¶
func (*MySQL) HasMigrationHistoryTable ¶
HasMigrationHistoryTable returns true if migration history table exists.
func (*MySQL) InsertMigration ¶
InsertMigration inserts the new migration record.
func (*MySQL) Migrations ¶
Migrations returns applied migrations history.
func (*MySQL) MigrationsCount ¶
MigrationsCount returns the number of migrations
func (*MySQL) RemoveMigration ¶
RemoveMigration removes the migration record.
func (*MySQL) TableNameWithSchema ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func NewPostgres ¶
func NewPostgres(conn Connection, options *Options) *Postgres
func (*Postgres) CreateMigrationHistoryTable ¶
CreateMigrationHistoryTable creates a new migration history table.
func (*Postgres) DropMigrationHistoryTable ¶
DropMigrationHistoryTable drops the migration history table.
func (*Postgres) ExecQuery ¶
ExecQuery executes a query without returning any rows. The args are for any placeholder parameters in the query.
func (*Postgres) ExecQueryTransaction ¶
func (p *Postgres) ExecQueryTransaction(ctx context.Context, txFn func(ctx context.Context) error) error
ExecQueryTransaction executes a query in transaction without returning any rows. The args are for any placeholder parameters in the query.
func (*Postgres) ForceSafely ¶
func (*Postgres) HasMigrationHistoryTable ¶
HasMigrationHistoryTable returns true if migration history table exists.
func (*Postgres) InsertMigration ¶
InsertMigration inserts the new migration record.
func (*Postgres) Migrations ¶
Migrations returns applied migrations history.
func (*Postgres) MigrationsCount ¶
MigrationsCount returns the number of migrations
func (*Postgres) RemoveMigration ¶
RemoveMigration removes the migration record.
func (*Postgres) TableNameWithSchema ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func New ¶
func New(conn Connection, options *Options) (*Repository, error)
New creates repository by connection
func (*Repository) CreateMigrationHistoryTable ¶
func (r *Repository) CreateMigrationHistoryTable(ctx context.Context) error
func (*Repository) DropMigrationHistoryTable ¶
func (r *Repository) DropMigrationHistoryTable(ctx context.Context) error
func (*Repository) ExecQueryTransaction ¶
func (*Repository) ForceSafely ¶
func (r *Repository) ForceSafely() bool
func (*Repository) HasMigrationHistoryTable ¶
func (r *Repository) HasMigrationHistoryTable(ctx context.Context) (exists bool, err error)
func (*Repository) InsertMigration ¶
func (r *Repository) InsertMigration(ctx context.Context, version string) error
func (*Repository) Migrations ¶
func (r *Repository) Migrations(ctx context.Context, limit int) (entity.Migrations, error)
func (*Repository) MigrationsCount ¶
func (r *Repository) MigrationsCount(ctx context.Context) (int, error)
func (*Repository) RemoveMigration ¶
func (r *Repository) RemoveMigration(ctx context.Context, version string) error
func (*Repository) TableNameWithSchema ¶
func (r *Repository) TableNameWithSchema() string