Documentation ¶
Index ¶
- Constants
- func BuildMysqlTruncateStatement(schema string, table string) (string, error)
- func BuildPgTruncateCascadeStatement(schema string, table string) (string, error)
- func BuildPgTruncateStatement(tables []string) string
- func BuildTable(schema, table string) string
- func EscapeMysqlColumn(col string) string
- func EscapeMysqlColumns(cols []string) []string
- func EscapePgColumn(col string) string
- func EscapePgColumns(cols []string) []string
- func GetUniqueSchemaColMappings(schemas []*DatabaseSchemaRow) map[string]map[string]*ColumnInfo
- func Ptr[T any](val T) *T
- type AlterTableStatement
- type BatchExecOpts
- type ColumnInfo
- type ConstraintType
- type DatabaseSchemaRow
- type ForeignConstraint
- type ForeignKey
- type ForeignKeyConstraintsRow
- type MockSqlDatabase
- func (_m *MockSqlDatabase) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
- func (_m *MockSqlDatabase) Close()
- func (_m *MockSqlDatabase) EXPECT() *MockSqlDatabase_Expecter
- func (_m *MockSqlDatabase) Exec(ctx context.Context, statement string) error
- func (_m *MockSqlDatabase) GetCreateTableStatement(ctx context.Context, schema string, table string) (string, error)
- func (_m *MockSqlDatabase) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
- func (_m *MockSqlDatabase) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
- func (_m *MockSqlDatabase) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
- func (_m *MockSqlDatabase) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
- func (_m *MockSqlDatabase) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error)
- func (_m *MockSqlDatabase) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error)
- func (_m *MockSqlDatabase) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
- func (_m *MockSqlDatabase) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
- func (_m *MockSqlDatabase) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
- func (_m *MockSqlDatabase) GetTableRowCount(ctx context.Context, schema string, table string, whereClause *string) (int64, error)
- func (_m *MockSqlDatabase) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error)
- type MockSqlDatabase_BatchExec_Call
- func (_c *MockSqlDatabase_BatchExec_Call) Return(_a0 error) *MockSqlDatabase_BatchExec_Call
- func (_c *MockSqlDatabase_BatchExec_Call) Run(...) *MockSqlDatabase_BatchExec_Call
- func (_c *MockSqlDatabase_BatchExec_Call) RunAndReturn(run func(context.Context, int, []string, *BatchExecOpts) error) *MockSqlDatabase_BatchExec_Call
- type MockSqlDatabase_Close_Call
- type MockSqlDatabase_Exec_Call
- func (_c *MockSqlDatabase_Exec_Call) Return(_a0 error) *MockSqlDatabase_Exec_Call
- func (_c *MockSqlDatabase_Exec_Call) Run(run func(ctx context.Context, statement string)) *MockSqlDatabase_Exec_Call
- func (_c *MockSqlDatabase_Exec_Call) RunAndReturn(run func(context.Context, string) error) *MockSqlDatabase_Exec_Call
- type MockSqlDatabase_Expecter
- func (_e *MockSqlDatabase_Expecter) BatchExec(ctx interface{}, batchSize interface{}, statements interface{}, ...) *MockSqlDatabase_BatchExec_Call
- func (_e *MockSqlDatabase_Expecter) Close() *MockSqlDatabase_Close_Call
- func (_e *MockSqlDatabase_Expecter) Exec(ctx interface{}, statement interface{}) *MockSqlDatabase_Exec_Call
- func (_e *MockSqlDatabase_Expecter) GetCreateTableStatement(ctx interface{}, schema interface{}, table interface{}) *MockSqlDatabase_GetCreateTableStatement_Call
- func (_e *MockSqlDatabase_Expecter) GetDatabaseSchema(ctx interface{}) *MockSqlDatabase_GetDatabaseSchema_Call
- func (_e *MockSqlDatabase_Expecter) GetForeignKeyConstraints(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetForeignKeyConstraints_Call
- func (_e *MockSqlDatabase_Expecter) GetForeignKeyConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
- func (_e *MockSqlDatabase_Expecter) GetPrimaryKeyConstraints(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
- func (_e *MockSqlDatabase_Expecter) GetPrimaryKeyConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
- func (_e *MockSqlDatabase_Expecter) GetRolePermissionsMap(ctx interface{}, role interface{}) *MockSqlDatabase_GetRolePermissionsMap_Call
- func (_e *MockSqlDatabase_Expecter) GetSchemaColumnMap(ctx interface{}) *MockSqlDatabase_GetSchemaColumnMap_Call
- func (_e *MockSqlDatabase_Expecter) GetTableConstraintsBySchema(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetTableConstraintsBySchema_Call
- func (_e *MockSqlDatabase_Expecter) GetTableInitStatements(ctx interface{}, tables interface{}) *MockSqlDatabase_GetTableInitStatements_Call
- func (_e *MockSqlDatabase_Expecter) GetTableRowCount(ctx interface{}, schema interface{}, table interface{}, ...) *MockSqlDatabase_GetTableRowCount_Call
- func (_e *MockSqlDatabase_Expecter) GetUniqueConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetUniqueConstraintsMap_Call
- type MockSqlDatabase_GetCreateTableStatement_Call
- func (_c *MockSqlDatabase_GetCreateTableStatement_Call) Return(_a0 string, _a1 error) *MockSqlDatabase_GetCreateTableStatement_Call
- func (_c *MockSqlDatabase_GetCreateTableStatement_Call) Run(run func(ctx context.Context, schema string, table string)) *MockSqlDatabase_GetCreateTableStatement_Call
- func (_c *MockSqlDatabase_GetCreateTableStatement_Call) RunAndReturn(run func(context.Context, string, string) (string, error)) *MockSqlDatabase_GetCreateTableStatement_Call
- type MockSqlDatabase_GetDatabaseSchema_Call
- func (_c *MockSqlDatabase_GetDatabaseSchema_Call) Return(_a0 []*DatabaseSchemaRow, _a1 error) *MockSqlDatabase_GetDatabaseSchema_Call
- func (_c *MockSqlDatabase_GetDatabaseSchema_Call) Run(run func(ctx context.Context)) *MockSqlDatabase_GetDatabaseSchema_Call
- func (_c *MockSqlDatabase_GetDatabaseSchema_Call) RunAndReturn(run func(context.Context) ([]*DatabaseSchemaRow, error)) *MockSqlDatabase_GetDatabaseSchema_Call
- type MockSqlDatabase_GetForeignKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Return(_a0 map[string][]*ForeignConstraint, _a1 error) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][]*ForeignConstraint, error)) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
- type MockSqlDatabase_GetForeignKeyConstraints_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) Return(_a0 []*ForeignKeyConstraintsRow, _a1 error) *MockSqlDatabase_GetForeignKeyConstraints_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetForeignKeyConstraints_Call
- func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) RunAndReturn(run func(context.Context, []string) ([]*ForeignKeyConstraintsRow, error)) *MockSqlDatabase_GetForeignKeyConstraints_Call
- type MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Return(_a0 map[string][]string, _a1 error) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][]string, error)) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
- type MockSqlDatabase_GetPrimaryKeyConstraints_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) Return(_a0 []*PrimaryKey, _a1 error) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
- func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) RunAndReturn(run func(context.Context, []string) ([]*PrimaryKey, error)) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
- type MockSqlDatabase_GetRolePermissionsMap_Call
- func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) Return(_a0 map[string][]string, _a1 error) *MockSqlDatabase_GetRolePermissionsMap_Call
- func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) Run(run func(ctx context.Context, role string)) *MockSqlDatabase_GetRolePermissionsMap_Call
- func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) RunAndReturn(run func(context.Context, string) (map[string][]string, error)) *MockSqlDatabase_GetRolePermissionsMap_Call
- type MockSqlDatabase_GetSchemaColumnMap_Call
- func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Return(_a0 map[string]map[string]*ColumnInfo, _a1 error) *MockSqlDatabase_GetSchemaColumnMap_Call
- func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Run(run func(ctx context.Context)) *MockSqlDatabase_GetSchemaColumnMap_Call
- func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) RunAndReturn(run func(context.Context) (map[string]map[string]*ColumnInfo, error)) *MockSqlDatabase_GetSchemaColumnMap_Call
- type MockSqlDatabase_GetTableConstraintsBySchema_Call
- func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) Return(_a0 *TableConstraints, _a1 error) *MockSqlDatabase_GetTableConstraintsBySchema_Call
- func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetTableConstraintsBySchema_Call
- func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) RunAndReturn(run func(context.Context, []string) (*TableConstraints, error)) *MockSqlDatabase_GetTableConstraintsBySchema_Call
- type MockSqlDatabase_GetTableInitStatements_Call
- func (_c *MockSqlDatabase_GetTableInitStatements_Call) Return(_a0 []*TableInitStatement, _a1 error) *MockSqlDatabase_GetTableInitStatements_Call
- func (_c *MockSqlDatabase_GetTableInitStatements_Call) Run(run func(ctx context.Context, tables []*SchemaTable)) *MockSqlDatabase_GetTableInitStatements_Call
- func (_c *MockSqlDatabase_GetTableInitStatements_Call) RunAndReturn(run func(context.Context, []*SchemaTable) ([]*TableInitStatement, error)) *MockSqlDatabase_GetTableInitStatements_Call
- type MockSqlDatabase_GetTableRowCount_Call
- func (_c *MockSqlDatabase_GetTableRowCount_Call) Return(_a0 int64, _a1 error) *MockSqlDatabase_GetTableRowCount_Call
- func (_c *MockSqlDatabase_GetTableRowCount_Call) Run(...) *MockSqlDatabase_GetTableRowCount_Call
- func (_c *MockSqlDatabase_GetTableRowCount_Call) RunAndReturn(run func(context.Context, string, string, *string) (int64, error)) *MockSqlDatabase_GetTableRowCount_Call
- type MockSqlDatabase_GetUniqueConstraintsMap_Call
- func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) Return(_a0 map[string][][]string, _a1 error) *MockSqlDatabase_GetUniqueConstraintsMap_Call
- func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetUniqueConstraintsMap_Call
- func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][][]string, error)) *MockSqlDatabase_GetUniqueConstraintsMap_Call
- type MockSqlManagerClient
- func (_m *MockSqlManagerClient) EXPECT() *MockSqlManagerClient_Expecter
- func (_m *MockSqlManagerClient) NewPooledSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection) (*SqlConnection, error)
- func (_m *MockSqlManagerClient) NewSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, ...) (*SqlConnection, error)
- func (_m *MockSqlManagerClient) NewSqlDbFromConnectionConfig(ctx context.Context, slogger *slog.Logger, ...) (*SqlConnection, error)
- func (_m *MockSqlManagerClient) NewSqlDbFromUrl(ctx context.Context, driver string, connectionUrl string) (*SqlConnection, error)
- type MockSqlManagerClient_Expecter
- func (_e *MockSqlManagerClient_Expecter) NewPooledSqlDb(ctx interface{}, slogger interface{}, connection interface{}) *MockSqlManagerClient_NewPooledSqlDb_Call
- func (_e *MockSqlManagerClient_Expecter) NewSqlDb(ctx interface{}, slogger interface{}, connection interface{}, ...) *MockSqlManagerClient_NewSqlDb_Call
- func (_e *MockSqlManagerClient_Expecter) NewSqlDbFromConnectionConfig(ctx interface{}, slogger interface{}, connectionConfig interface{}, ...) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
- func (_e *MockSqlManagerClient_Expecter) NewSqlDbFromUrl(ctx interface{}, driver interface{}, connectionUrl interface{}) *MockSqlManagerClient_NewSqlDbFromUrl_Call
- type MockSqlManagerClient_NewPooledSqlDb_Call
- func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewPooledSqlDb_Call
- func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) Run(...) *MockSqlManagerClient_NewPooledSqlDb_Call
- func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) RunAndReturn(...) *MockSqlManagerClient_NewPooledSqlDb_Call
- type MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Run(run func(ctx context.Context, slogger *slog.Logger, ...)) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) RunAndReturn(...) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
- type MockSqlManagerClient_NewSqlDbFromUrl_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDbFromUrl_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) Run(run func(ctx context.Context, driver string, connectionUrl string)) *MockSqlManagerClient_NewSqlDbFromUrl_Call
- func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) RunAndReturn(run func(context.Context, string, string) (*SqlConnection, error)) *MockSqlManagerClient_NewSqlDbFromUrl_Call
- type MockSqlManagerClient_NewSqlDb_Call
- func (_c *MockSqlManagerClient_NewSqlDb_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDb_Call
- func (_c *MockSqlManagerClient_NewSqlDb_Call) Run(...) *MockSqlManagerClient_NewSqlDb_Call
- func (_c *MockSqlManagerClient_NewSqlDb_Call) RunAndReturn(...) *MockSqlManagerClient_NewSqlDb_Call
- type MysqlManager
- func (m *MysqlManager) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
- func (m *MysqlManager) Close()
- func (m *MysqlManager) Exec(ctx context.Context, statement string) error
- func (m *MysqlManager) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error)
- func (m *MysqlManager) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
- func (m *MysqlManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
- func (m *MysqlManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
- func (m *MysqlManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
- func (m *MysqlManager) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error)
- func (m *MysqlManager) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error)
- func (m *MysqlManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
- func (m *MysqlManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
- func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
- func (m *MysqlManager) GetTableRowCount(ctx context.Context, schema, table string, whereClause *string) (int64, error)
- func (m *MysqlManager) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error)
- type PostgresManager
- func (p *PostgresManager) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
- func (p *PostgresManager) Close()
- func (p *PostgresManager) Exec(ctx context.Context, statement string) error
- func (p *PostgresManager) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error)
- func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
- func (p *PostgresManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
- func (p *PostgresManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
- func (p *PostgresManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
- func (p *PostgresManager) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error)
- func (p *PostgresManager) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error)
- func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
- func (p *PostgresManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
- func (p *PostgresManager) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
- func (p *PostgresManager) GetTableRowCount(ctx context.Context, schema, table string, whereClause *string) (int64, error)
- func (p *PostgresManager) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error)
- type PrimaryKey
- type SchemaTable
- type SqlConnection
- type SqlDatabase
- type SqlManager
- func (s *SqlManager) NewPooledSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection) (*SqlConnection, error)
- func (s *SqlManager) NewSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, ...) (*SqlConnection, error)
- func (s *SqlManager) NewSqlDbFromConnectionConfig(ctx context.Context, slogger *slog.Logger, ...) (*SqlConnection, error)
- func (s *SqlManager) NewSqlDbFromUrl(ctx context.Context, driver, connectionUrl string) (*SqlConnection, error)
- type SqlManagerClient
- type TableConstraints
- type TableInitStatement
Constants ¶
const ( PostgresDriver = "postgres" MysqlDriver = "mysql" )
const (
DisableForeignKeyChecks = "SET FOREIGN_KEY_CHECKS = 0;"
)
Variables ¶
This section is empty.
Functions ¶
func BuildTable ¶
func EscapeMysqlColumn ¶
func EscapeMysqlColumns ¶
func EscapePgColumn ¶
func EscapePgColumns ¶
func GetUniqueSchemaColMappings ¶ added in v0.4.24
func GetUniqueSchemaColMappings( schemas []*DatabaseSchemaRow, ) map[string]map[string]*ColumnInfo
Types ¶
type AlterTableStatement ¶ added in v0.4.24
type AlterTableStatement struct { Statement string ConstraintType ConstraintType }
type BatchExecOpts ¶
type BatchExecOpts struct {
Prefix *string // this string will be added to the start of each statement
}
type ColumnInfo ¶
type ColumnInfo struct { OrdinalPosition int32 // Specifies the sequence or order in which each column is defined within the table. Starts at 1 for the first column. ColumnDefault string // Specifies the default value for a column, if any is set. IsNullable bool // Specifies if the column is nullable or not. DataType string // Specifies the data type of the column, i.e., bool, varchar, int, etc. CharacterMaximumLength *int32 // Specifies the maximum allowable length of the column for character-based data types. For datatypes such as integers, boolean, dates etc. this is NULL. NumericPrecision *int32 // Specifies the precision for numeric data types. It represents the TOTAL count of significant digits in the whole number, that is, the number of digits to BOTH sides of the decimal point. Null for non-numeric data types. NumericScale *int32 // Specifies the scale of the column for numeric data types, specifically non-integers. It represents the number of digits to the RIGHT of the decimal point. Null for non-numeric data types and integers. }
type ConstraintType ¶ added in v0.4.24
type ConstraintType int
const ( PrimaryConstraintType ConstraintType = iota ForeignConstraintType UniqueConstraintType CheckConstraintType )
type DatabaseSchemaRow ¶
type ForeignConstraint ¶
type ForeignConstraint struct { Columns []string NotNullable []bool ForeignKey *ForeignKey }
type ForeignKey ¶
type MockSqlDatabase ¶
MockSqlDatabase is an autogenerated mock type for the SqlDatabase type
func NewMockSqlDatabase ¶
func NewMockSqlDatabase(t interface { mock.TestingT Cleanup(func()) }) *MockSqlDatabase
NewMockSqlDatabase creates a new instance of MockSqlDatabase. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockSqlDatabase) BatchExec ¶
func (_m *MockSqlDatabase) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
BatchExec provides a mock function with given fields: ctx, batchSize, statements, opts
func (*MockSqlDatabase) Close ¶
func (_m *MockSqlDatabase) Close()
Close provides a mock function with given fields:
func (*MockSqlDatabase) EXPECT ¶
func (_m *MockSqlDatabase) EXPECT() *MockSqlDatabase_Expecter
func (*MockSqlDatabase) Exec ¶
func (_m *MockSqlDatabase) Exec(ctx context.Context, statement string) error
Exec provides a mock function with given fields: ctx, statement
func (*MockSqlDatabase) GetCreateTableStatement ¶
func (_m *MockSqlDatabase) GetCreateTableStatement(ctx context.Context, schema string, table string) (string, error)
GetCreateTableStatement provides a mock function with given fields: ctx, schema, table
func (*MockSqlDatabase) GetDatabaseSchema ¶
func (_m *MockSqlDatabase) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
GetDatabaseSchema provides a mock function with given fields: ctx
func (*MockSqlDatabase) GetForeignKeyConstraints ¶
func (_m *MockSqlDatabase) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
GetForeignKeyConstraints provides a mock function with given fields: ctx, schemas
func (*MockSqlDatabase) GetForeignKeyConstraintsMap ¶
func (_m *MockSqlDatabase) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
GetForeignKeyConstraintsMap provides a mock function with given fields: ctx, schemas
func (*MockSqlDatabase) GetPrimaryKeyConstraints ¶
func (_m *MockSqlDatabase) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
GetPrimaryKeyConstraints provides a mock function with given fields: ctx, schemas
func (*MockSqlDatabase) GetPrimaryKeyConstraintsMap ¶
func (_m *MockSqlDatabase) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error)
GetPrimaryKeyConstraintsMap provides a mock function with given fields: ctx, schemas
func (*MockSqlDatabase) GetRolePermissionsMap ¶
func (_m *MockSqlDatabase) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error)
GetRolePermissionsMap provides a mock function with given fields: ctx, role
func (*MockSqlDatabase) GetSchemaColumnMap ¶
func (_m *MockSqlDatabase) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
GetSchemaColumnMap provides a mock function with given fields: ctx
func (*MockSqlDatabase) GetTableConstraintsBySchema ¶ added in v0.4.23
func (_m *MockSqlDatabase) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
GetTableConstraintsBySchema provides a mock function with given fields: ctx, schemas
func (*MockSqlDatabase) GetTableInitStatements ¶ added in v0.4.24
func (_m *MockSqlDatabase) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
GetTableInitStatements provides a mock function with given fields: ctx, tables
func (*MockSqlDatabase) GetTableRowCount ¶ added in v0.4.24
func (_m *MockSqlDatabase) GetTableRowCount(ctx context.Context, schema string, table string, whereClause *string) (int64, error)
GetTableRowCount provides a mock function with given fields: ctx, schema, table, whereClause
func (*MockSqlDatabase) GetUniqueConstraintsMap ¶
func (_m *MockSqlDatabase) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error)
GetUniqueConstraintsMap provides a mock function with given fields: ctx, schemas
type MockSqlDatabase_BatchExec_Call ¶
MockSqlDatabase_BatchExec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchExec'
func (*MockSqlDatabase_BatchExec_Call) Return ¶
func (_c *MockSqlDatabase_BatchExec_Call) Return(_a0 error) *MockSqlDatabase_BatchExec_Call
func (*MockSqlDatabase_BatchExec_Call) Run ¶
func (_c *MockSqlDatabase_BatchExec_Call) Run(run func(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts)) *MockSqlDatabase_BatchExec_Call
func (*MockSqlDatabase_BatchExec_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_BatchExec_Call) RunAndReturn(run func(context.Context, int, []string, *BatchExecOpts) error) *MockSqlDatabase_BatchExec_Call
type MockSqlDatabase_Close_Call ¶
MockSqlDatabase_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
func (*MockSqlDatabase_Close_Call) Return ¶
func (_c *MockSqlDatabase_Close_Call) Return() *MockSqlDatabase_Close_Call
func (*MockSqlDatabase_Close_Call) Run ¶
func (_c *MockSqlDatabase_Close_Call) Run(run func()) *MockSqlDatabase_Close_Call
func (*MockSqlDatabase_Close_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_Close_Call) RunAndReturn(run func()) *MockSqlDatabase_Close_Call
type MockSqlDatabase_Exec_Call ¶
MockSqlDatabase_Exec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exec'
func (*MockSqlDatabase_Exec_Call) Return ¶
func (_c *MockSqlDatabase_Exec_Call) Return(_a0 error) *MockSqlDatabase_Exec_Call
func (*MockSqlDatabase_Exec_Call) Run ¶
func (_c *MockSqlDatabase_Exec_Call) Run(run func(ctx context.Context, statement string)) *MockSqlDatabase_Exec_Call
func (*MockSqlDatabase_Exec_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_Exec_Call) RunAndReturn(run func(context.Context, string) error) *MockSqlDatabase_Exec_Call
type MockSqlDatabase_Expecter ¶
type MockSqlDatabase_Expecter struct {
// contains filtered or unexported fields
}
func (*MockSqlDatabase_Expecter) BatchExec ¶
func (_e *MockSqlDatabase_Expecter) BatchExec(ctx interface{}, batchSize interface{}, statements interface{}, opts interface{}) *MockSqlDatabase_BatchExec_Call
BatchExec is a helper method to define mock.On call
- ctx context.Context
- batchSize int
- statements []string
- opts *BatchExecOpts
func (*MockSqlDatabase_Expecter) Close ¶
func (_e *MockSqlDatabase_Expecter) Close() *MockSqlDatabase_Close_Call
Close is a helper method to define mock.On call
func (*MockSqlDatabase_Expecter) Exec ¶
func (_e *MockSqlDatabase_Expecter) Exec(ctx interface{}, statement interface{}) *MockSqlDatabase_Exec_Call
Exec is a helper method to define mock.On call
- ctx context.Context
- statement string
func (*MockSqlDatabase_Expecter) GetCreateTableStatement ¶
func (_e *MockSqlDatabase_Expecter) GetCreateTableStatement(ctx interface{}, schema interface{}, table interface{}) *MockSqlDatabase_GetCreateTableStatement_Call
GetCreateTableStatement is a helper method to define mock.On call
- ctx context.Context
- schema string
- table string
func (*MockSqlDatabase_Expecter) GetDatabaseSchema ¶
func (_e *MockSqlDatabase_Expecter) GetDatabaseSchema(ctx interface{}) *MockSqlDatabase_GetDatabaseSchema_Call
GetDatabaseSchema is a helper method to define mock.On call
- ctx context.Context
func (*MockSqlDatabase_Expecter) GetForeignKeyConstraints ¶
func (_e *MockSqlDatabase_Expecter) GetForeignKeyConstraints(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetForeignKeyConstraints_Call
GetForeignKeyConstraints is a helper method to define mock.On call
- ctx context.Context
- schemas []string
func (*MockSqlDatabase_Expecter) GetForeignKeyConstraintsMap ¶
func (_e *MockSqlDatabase_Expecter) GetForeignKeyConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
GetForeignKeyConstraintsMap is a helper method to define mock.On call
- ctx context.Context
- schemas []string
func (*MockSqlDatabase_Expecter) GetPrimaryKeyConstraints ¶
func (_e *MockSqlDatabase_Expecter) GetPrimaryKeyConstraints(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
GetPrimaryKeyConstraints is a helper method to define mock.On call
- ctx context.Context
- schemas []string
func (*MockSqlDatabase_Expecter) GetPrimaryKeyConstraintsMap ¶
func (_e *MockSqlDatabase_Expecter) GetPrimaryKeyConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
GetPrimaryKeyConstraintsMap is a helper method to define mock.On call
- ctx context.Context
- schemas []string
func (*MockSqlDatabase_Expecter) GetRolePermissionsMap ¶
func (_e *MockSqlDatabase_Expecter) GetRolePermissionsMap(ctx interface{}, role interface{}) *MockSqlDatabase_GetRolePermissionsMap_Call
GetRolePermissionsMap is a helper method to define mock.On call
- ctx context.Context
- role string
func (*MockSqlDatabase_Expecter) GetSchemaColumnMap ¶
func (_e *MockSqlDatabase_Expecter) GetSchemaColumnMap(ctx interface{}) *MockSqlDatabase_GetSchemaColumnMap_Call
GetSchemaColumnMap is a helper method to define mock.On call
- ctx context.Context
func (*MockSqlDatabase_Expecter) GetTableConstraintsBySchema ¶ added in v0.4.23
func (_e *MockSqlDatabase_Expecter) GetTableConstraintsBySchema(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetTableConstraintsBySchema_Call
GetTableConstraintsBySchema is a helper method to define mock.On call
- ctx context.Context
- schemas []string
func (*MockSqlDatabase_Expecter) GetTableInitStatements ¶ added in v0.4.24
func (_e *MockSqlDatabase_Expecter) GetTableInitStatements(ctx interface{}, tables interface{}) *MockSqlDatabase_GetTableInitStatements_Call
GetTableInitStatements is a helper method to define mock.On call
- ctx context.Context
- tables []*SchemaTable
func (*MockSqlDatabase_Expecter) GetTableRowCount ¶ added in v0.4.24
func (_e *MockSqlDatabase_Expecter) GetTableRowCount(ctx interface{}, schema interface{}, table interface{}, whereClause interface{}) *MockSqlDatabase_GetTableRowCount_Call
GetTableRowCount is a helper method to define mock.On call
- ctx context.Context
- schema string
- table string
- whereClause *string
func (*MockSqlDatabase_Expecter) GetUniqueConstraintsMap ¶
func (_e *MockSqlDatabase_Expecter) GetUniqueConstraintsMap(ctx interface{}, schemas interface{}) *MockSqlDatabase_GetUniqueConstraintsMap_Call
GetUniqueConstraintsMap is a helper method to define mock.On call
- ctx context.Context
- schemas []string
type MockSqlDatabase_GetCreateTableStatement_Call ¶
MockSqlDatabase_GetCreateTableStatement_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCreateTableStatement'
func (*MockSqlDatabase_GetCreateTableStatement_Call) Return ¶
func (_c *MockSqlDatabase_GetCreateTableStatement_Call) Return(_a0 string, _a1 error) *MockSqlDatabase_GetCreateTableStatement_Call
func (*MockSqlDatabase_GetCreateTableStatement_Call) Run ¶
func (_c *MockSqlDatabase_GetCreateTableStatement_Call) Run(run func(ctx context.Context, schema string, table string)) *MockSqlDatabase_GetCreateTableStatement_Call
func (*MockSqlDatabase_GetCreateTableStatement_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetCreateTableStatement_Call) RunAndReturn(run func(context.Context, string, string) (string, error)) *MockSqlDatabase_GetCreateTableStatement_Call
type MockSqlDatabase_GetDatabaseSchema_Call ¶
MockSqlDatabase_GetDatabaseSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseSchema'
func (*MockSqlDatabase_GetDatabaseSchema_Call) Return ¶
func (_c *MockSqlDatabase_GetDatabaseSchema_Call) Return(_a0 []*DatabaseSchemaRow, _a1 error) *MockSqlDatabase_GetDatabaseSchema_Call
func (*MockSqlDatabase_GetDatabaseSchema_Call) Run ¶
func (_c *MockSqlDatabase_GetDatabaseSchema_Call) Run(run func(ctx context.Context)) *MockSqlDatabase_GetDatabaseSchema_Call
func (*MockSqlDatabase_GetDatabaseSchema_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetDatabaseSchema_Call) RunAndReturn(run func(context.Context) ([]*DatabaseSchemaRow, error)) *MockSqlDatabase_GetDatabaseSchema_Call
type MockSqlDatabase_GetForeignKeyConstraintsMap_Call ¶
MockSqlDatabase_GetForeignKeyConstraintsMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetForeignKeyConstraintsMap'
func (*MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Return ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Return(_a0 map[string][]*ForeignConstraint, _a1 error) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
func (*MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Run ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
func (*MockSqlDatabase_GetForeignKeyConstraintsMap_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][]*ForeignConstraint, error)) *MockSqlDatabase_GetForeignKeyConstraintsMap_Call
type MockSqlDatabase_GetForeignKeyConstraints_Call ¶
MockSqlDatabase_GetForeignKeyConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetForeignKeyConstraints'
func (*MockSqlDatabase_GetForeignKeyConstraints_Call) Return ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) Return(_a0 []*ForeignKeyConstraintsRow, _a1 error) *MockSqlDatabase_GetForeignKeyConstraints_Call
func (*MockSqlDatabase_GetForeignKeyConstraints_Call) Run ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetForeignKeyConstraints_Call
func (*MockSqlDatabase_GetForeignKeyConstraints_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetForeignKeyConstraints_Call) RunAndReturn(run func(context.Context, []string) ([]*ForeignKeyConstraintsRow, error)) *MockSqlDatabase_GetForeignKeyConstraints_Call
type MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call ¶
MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrimaryKeyConstraintsMap'
func (*MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Return ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Return(_a0 map[string][]string, _a1 error) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
func (*MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Run ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
func (*MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][]string, error)) *MockSqlDatabase_GetPrimaryKeyConstraintsMap_Call
type MockSqlDatabase_GetPrimaryKeyConstraints_Call ¶
MockSqlDatabase_GetPrimaryKeyConstraints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrimaryKeyConstraints'
func (*MockSqlDatabase_GetPrimaryKeyConstraints_Call) Return ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) Return(_a0 []*PrimaryKey, _a1 error) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
func (*MockSqlDatabase_GetPrimaryKeyConstraints_Call) Run ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
func (*MockSqlDatabase_GetPrimaryKeyConstraints_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetPrimaryKeyConstraints_Call) RunAndReturn(run func(context.Context, []string) ([]*PrimaryKey, error)) *MockSqlDatabase_GetPrimaryKeyConstraints_Call
type MockSqlDatabase_GetRolePermissionsMap_Call ¶
MockSqlDatabase_GetRolePermissionsMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRolePermissionsMap'
func (*MockSqlDatabase_GetRolePermissionsMap_Call) Return ¶
func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) Return(_a0 map[string][]string, _a1 error) *MockSqlDatabase_GetRolePermissionsMap_Call
func (*MockSqlDatabase_GetRolePermissionsMap_Call) Run ¶
func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) Run(run func(ctx context.Context, role string)) *MockSqlDatabase_GetRolePermissionsMap_Call
func (*MockSqlDatabase_GetRolePermissionsMap_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetRolePermissionsMap_Call) RunAndReturn(run func(context.Context, string) (map[string][]string, error)) *MockSqlDatabase_GetRolePermissionsMap_Call
type MockSqlDatabase_GetSchemaColumnMap_Call ¶
MockSqlDatabase_GetSchemaColumnMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSchemaColumnMap'
func (*MockSqlDatabase_GetSchemaColumnMap_Call) Return ¶
func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Return(_a0 map[string]map[string]*ColumnInfo, _a1 error) *MockSqlDatabase_GetSchemaColumnMap_Call
func (*MockSqlDatabase_GetSchemaColumnMap_Call) Run ¶
func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) Run(run func(ctx context.Context)) *MockSqlDatabase_GetSchemaColumnMap_Call
func (*MockSqlDatabase_GetSchemaColumnMap_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetSchemaColumnMap_Call) RunAndReturn(run func(context.Context) (map[string]map[string]*ColumnInfo, error)) *MockSqlDatabase_GetSchemaColumnMap_Call
type MockSqlDatabase_GetTableConstraintsBySchema_Call ¶ added in v0.4.23
MockSqlDatabase_GetTableConstraintsBySchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTableConstraintsBySchema'
func (*MockSqlDatabase_GetTableConstraintsBySchema_Call) Return ¶ added in v0.4.23
func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) Return(_a0 *TableConstraints, _a1 error) *MockSqlDatabase_GetTableConstraintsBySchema_Call
func (*MockSqlDatabase_GetTableConstraintsBySchema_Call) Run ¶ added in v0.4.23
func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetTableConstraintsBySchema_Call
func (*MockSqlDatabase_GetTableConstraintsBySchema_Call) RunAndReturn ¶ added in v0.4.23
func (_c *MockSqlDatabase_GetTableConstraintsBySchema_Call) RunAndReturn(run func(context.Context, []string) (*TableConstraints, error)) *MockSqlDatabase_GetTableConstraintsBySchema_Call
type MockSqlDatabase_GetTableInitStatements_Call ¶ added in v0.4.24
MockSqlDatabase_GetTableInitStatements_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTableInitStatements'
func (*MockSqlDatabase_GetTableInitStatements_Call) Return ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableInitStatements_Call) Return(_a0 []*TableInitStatement, _a1 error) *MockSqlDatabase_GetTableInitStatements_Call
func (*MockSqlDatabase_GetTableInitStatements_Call) Run ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableInitStatements_Call) Run(run func(ctx context.Context, tables []*SchemaTable)) *MockSqlDatabase_GetTableInitStatements_Call
func (*MockSqlDatabase_GetTableInitStatements_Call) RunAndReturn ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableInitStatements_Call) RunAndReturn(run func(context.Context, []*SchemaTable) ([]*TableInitStatement, error)) *MockSqlDatabase_GetTableInitStatements_Call
type MockSqlDatabase_GetTableRowCount_Call ¶ added in v0.4.24
MockSqlDatabase_GetTableRowCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTableRowCount'
func (*MockSqlDatabase_GetTableRowCount_Call) Return ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableRowCount_Call) Return(_a0 int64, _a1 error) *MockSqlDatabase_GetTableRowCount_Call
func (*MockSqlDatabase_GetTableRowCount_Call) Run ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableRowCount_Call) Run(run func(ctx context.Context, schema string, table string, whereClause *string)) *MockSqlDatabase_GetTableRowCount_Call
func (*MockSqlDatabase_GetTableRowCount_Call) RunAndReturn ¶ added in v0.4.24
func (_c *MockSqlDatabase_GetTableRowCount_Call) RunAndReturn(run func(context.Context, string, string, *string) (int64, error)) *MockSqlDatabase_GetTableRowCount_Call
type MockSqlDatabase_GetUniqueConstraintsMap_Call ¶
MockSqlDatabase_GetUniqueConstraintsMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUniqueConstraintsMap'
func (*MockSqlDatabase_GetUniqueConstraintsMap_Call) Return ¶
func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) Return(_a0 map[string][][]string, _a1 error) *MockSqlDatabase_GetUniqueConstraintsMap_Call
func (*MockSqlDatabase_GetUniqueConstraintsMap_Call) Run ¶
func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) Run(run func(ctx context.Context, schemas []string)) *MockSqlDatabase_GetUniqueConstraintsMap_Call
func (*MockSqlDatabase_GetUniqueConstraintsMap_Call) RunAndReturn ¶
func (_c *MockSqlDatabase_GetUniqueConstraintsMap_Call) RunAndReturn(run func(context.Context, []string) (map[string][][]string, error)) *MockSqlDatabase_GetUniqueConstraintsMap_Call
type MockSqlManagerClient ¶
MockSqlManagerClient is an autogenerated mock type for the SqlManagerClient type
func NewMockSqlManagerClient ¶
func NewMockSqlManagerClient(t interface { mock.TestingT Cleanup(func()) }) *MockSqlManagerClient
NewMockSqlManagerClient creates a new instance of MockSqlManagerClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockSqlManagerClient) EXPECT ¶
func (_m *MockSqlManagerClient) EXPECT() *MockSqlManagerClient_Expecter
func (*MockSqlManagerClient) NewPooledSqlDb ¶
func (_m *MockSqlManagerClient) NewPooledSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection) (*SqlConnection, error)
NewPooledSqlDb provides a mock function with given fields: ctx, slogger, connection
func (*MockSqlManagerClient) NewSqlDb ¶
func (_m *MockSqlManagerClient) NewSqlDb(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, connectionTimeout *int) (*SqlConnection, error)
NewSqlDb provides a mock function with given fields: ctx, slogger, connection, connectionTimeout
func (*MockSqlManagerClient) NewSqlDbFromConnectionConfig ¶
func (_m *MockSqlManagerClient) NewSqlDbFromConnectionConfig(ctx context.Context, slogger *slog.Logger, connectionConfig *mgmtv1alpha1.ConnectionConfig, connectionTimeout *int) (*SqlConnection, error)
NewSqlDbFromConnectionConfig provides a mock function with given fields: ctx, slogger, connectionConfig, connectionTimeout
func (*MockSqlManagerClient) NewSqlDbFromUrl ¶
func (_m *MockSqlManagerClient) NewSqlDbFromUrl(ctx context.Context, driver string, connectionUrl string) (*SqlConnection, error)
NewSqlDbFromUrl provides a mock function with given fields: ctx, driver, connectionUrl
type MockSqlManagerClient_Expecter ¶
type MockSqlManagerClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockSqlManagerClient_Expecter) NewPooledSqlDb ¶
func (_e *MockSqlManagerClient_Expecter) NewPooledSqlDb(ctx interface{}, slogger interface{}, connection interface{}) *MockSqlManagerClient_NewPooledSqlDb_Call
NewPooledSqlDb is a helper method to define mock.On call
- ctx context.Context
- slogger *slog.Logger
- connection *mgmtv1alpha1.Connection
func (*MockSqlManagerClient_Expecter) NewSqlDb ¶
func (_e *MockSqlManagerClient_Expecter) NewSqlDb(ctx interface{}, slogger interface{}, connection interface{}, connectionTimeout interface{}) *MockSqlManagerClient_NewSqlDb_Call
NewSqlDb is a helper method to define mock.On call
- ctx context.Context
- slogger *slog.Logger
- connection *mgmtv1alpha1.Connection
- connectionTimeout *int
func (*MockSqlManagerClient_Expecter) NewSqlDbFromConnectionConfig ¶
func (_e *MockSqlManagerClient_Expecter) NewSqlDbFromConnectionConfig(ctx interface{}, slogger interface{}, connectionConfig interface{}, connectionTimeout interface{}) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
NewSqlDbFromConnectionConfig is a helper method to define mock.On call
- ctx context.Context
- slogger *slog.Logger
- connectionConfig *mgmtv1alpha1.ConnectionConfig
- connectionTimeout *int
func (*MockSqlManagerClient_Expecter) NewSqlDbFromUrl ¶
func (_e *MockSqlManagerClient_Expecter) NewSqlDbFromUrl(ctx interface{}, driver interface{}, connectionUrl interface{}) *MockSqlManagerClient_NewSqlDbFromUrl_Call
NewSqlDbFromUrl is a helper method to define mock.On call
- ctx context.Context
- driver string
- connectionUrl string
type MockSqlManagerClient_NewPooledSqlDb_Call ¶
MockSqlManagerClient_NewPooledSqlDb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewPooledSqlDb'
func (*MockSqlManagerClient_NewPooledSqlDb_Call) Return ¶
func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewPooledSqlDb_Call
func (*MockSqlManagerClient_NewPooledSqlDb_Call) Run ¶
func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) Run(run func(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection)) *MockSqlManagerClient_NewPooledSqlDb_Call
func (*MockSqlManagerClient_NewPooledSqlDb_Call) RunAndReturn ¶
func (_c *MockSqlManagerClient_NewPooledSqlDb_Call) RunAndReturn(run func(context.Context, *slog.Logger, *mgmtv1alpha1.Connection) (*SqlConnection, error)) *MockSqlManagerClient_NewPooledSqlDb_Call
type MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call ¶
MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewSqlDbFromConnectionConfig'
func (*MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Return ¶
func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
func (*MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Run ¶
func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) Run(run func(ctx context.Context, slogger *slog.Logger, connectionConfig *mgmtv1alpha1.ConnectionConfig, connectionTimeout *int)) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
func (*MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) RunAndReturn ¶
func (_c *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call) RunAndReturn(run func(context.Context, *slog.Logger, *mgmtv1alpha1.ConnectionConfig, *int) (*SqlConnection, error)) *MockSqlManagerClient_NewSqlDbFromConnectionConfig_Call
type MockSqlManagerClient_NewSqlDbFromUrl_Call ¶
MockSqlManagerClient_NewSqlDbFromUrl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewSqlDbFromUrl'
func (*MockSqlManagerClient_NewSqlDbFromUrl_Call) Return ¶
func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDbFromUrl_Call
func (*MockSqlManagerClient_NewSqlDbFromUrl_Call) Run ¶
func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) Run(run func(ctx context.Context, driver string, connectionUrl string)) *MockSqlManagerClient_NewSqlDbFromUrl_Call
func (*MockSqlManagerClient_NewSqlDbFromUrl_Call) RunAndReturn ¶
func (_c *MockSqlManagerClient_NewSqlDbFromUrl_Call) RunAndReturn(run func(context.Context, string, string) (*SqlConnection, error)) *MockSqlManagerClient_NewSqlDbFromUrl_Call
type MockSqlManagerClient_NewSqlDb_Call ¶
MockSqlManagerClient_NewSqlDb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewSqlDb'
func (*MockSqlManagerClient_NewSqlDb_Call) Return ¶
func (_c *MockSqlManagerClient_NewSqlDb_Call) Return(_a0 *SqlConnection, _a1 error) *MockSqlManagerClient_NewSqlDb_Call
func (*MockSqlManagerClient_NewSqlDb_Call) Run ¶
func (_c *MockSqlManagerClient_NewSqlDb_Call) Run(run func(ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, connectionTimeout *int)) *MockSqlManagerClient_NewSqlDb_Call
func (*MockSqlManagerClient_NewSqlDb_Call) RunAndReturn ¶
func (_c *MockSqlManagerClient_NewSqlDb_Call) RunAndReturn(run func(context.Context, *slog.Logger, *mgmtv1alpha1.Connection, *int) (*SqlConnection, error)) *MockSqlManagerClient_NewSqlDb_Call
type MysqlManager ¶
type MysqlManager struct {
// contains filtered or unexported fields
}
func (*MysqlManager) BatchExec ¶
func (m *MysqlManager) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
func (*MysqlManager) Close ¶
func (m *MysqlManager) Close()
func (*MysqlManager) Exec ¶
func (m *MysqlManager) Exec(ctx context.Context, statement string) error
func (*MysqlManager) GetCreateTableStatement ¶
func (*MysqlManager) GetDatabaseSchema ¶
func (m *MysqlManager) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
func (*MysqlManager) GetForeignKeyConstraints ¶
func (m *MysqlManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
func (*MysqlManager) GetForeignKeyConstraintsMap ¶
func (m *MysqlManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
Key is schema.table value is list of tables that key depends on
func (*MysqlManager) GetPrimaryKeyConstraints ¶
func (m *MysqlManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
func (*MysqlManager) GetPrimaryKeyConstraintsMap ¶
func (*MysqlManager) GetRolePermissionsMap ¶
func (*MysqlManager) GetSchemaColumnMap ¶
func (m *MysqlManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
returns: {public.users: { id: struct{}{}, created_at: struct{}{}}}
func (*MysqlManager) GetTableConstraintsBySchema ¶ added in v0.4.23
func (m *MysqlManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
func (*MysqlManager) GetTableInitStatements ¶ added in v0.4.24
func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
todo
func (*MysqlManager) GetTableRowCount ¶ added in v0.4.24
func (*MysqlManager) GetUniqueConstraintsMap ¶
type PostgresManager ¶
type PostgresManager struct {
// contains filtered or unexported fields
}
func (*PostgresManager) BatchExec ¶
func (p *PostgresManager) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error
func (*PostgresManager) Close ¶
func (p *PostgresManager) Close()
func (*PostgresManager) Exec ¶
func (p *PostgresManager) Exec(ctx context.Context, statement string) error
func (*PostgresManager) GetCreateTableStatement ¶
func (*PostgresManager) GetDatabaseSchema ¶
func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error)
func (*PostgresManager) GetForeignKeyConstraints ¶
func (p *PostgresManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error)
func (*PostgresManager) GetForeignKeyConstraintsMap ¶
func (p *PostgresManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error)
Key is schema.table value is list of tables that key depends on
func (*PostgresManager) GetPrimaryKeyConstraints ¶
func (p *PostgresManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error)
func (*PostgresManager) GetPrimaryKeyConstraintsMap ¶
func (*PostgresManager) GetRolePermissionsMap ¶
func (*PostgresManager) GetSchemaColumnMap ¶
func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error)
returns: {public.users: { id: struct{}{}, created_at: struct{}{}}}
func (*PostgresManager) GetTableConstraintsBySchema ¶ added in v0.4.23
func (p *PostgresManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error)
func (*PostgresManager) GetTableInitStatements ¶ added in v0.4.24
func (p *PostgresManager) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error)
func (*PostgresManager) GetTableRowCount ¶ added in v0.4.24
func (*PostgresManager) GetUniqueConstraintsMap ¶
type PrimaryKey ¶
type SchemaTable ¶ added in v0.4.24
func (SchemaTable) String ¶ added in v0.4.24
func (s SchemaTable) String() string
type SqlConnection ¶
type SqlConnection struct { Db SqlDatabase Driver string }
type SqlDatabase ¶
type SqlDatabase interface { GetDatabaseSchema(ctx context.Context) ([]*DatabaseSchemaRow, error) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*ColumnInfo, error) // ex: {public.users: { id: struct{}{}, created_at: struct{}{}}} GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*TableConstraints, error) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*ForeignKeyConstraintsRow, error) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*ForeignConstraint, error) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*PrimaryKey, error) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error) GetTableInitStatements(ctx context.Context, tables []*SchemaTable) ([]*TableInitStatement, error) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error) GetTableRowCount(ctx context.Context, schema, table string, whereClause *string) (int64, error) BatchExec(ctx context.Context, batchSize int, statements []string, opts *BatchExecOpts) error Exec(ctx context.Context, statement string) error Close() }
type SqlManager ¶
type SqlManager struct {
// contains filtered or unexported fields
}
func NewSqlManager ¶
func NewSqlManager( pgpool *sync.Map, pgquerier pg_queries.Querier, mysqlpool *sync.Map, mysqlquerier mysql_queries.Querier, sqlconnector sqlconnect.SqlConnector, ) *SqlManager
func (*SqlManager) NewPooledSqlDb ¶
func (s *SqlManager) NewPooledSqlDb( ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, ) (*SqlConnection, error)
func (*SqlManager) NewSqlDb ¶
func (s *SqlManager) NewSqlDb( ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, connectionTimeout *int, ) (*SqlConnection, error)
func (*SqlManager) NewSqlDbFromConnectionConfig ¶
func (s *SqlManager) NewSqlDbFromConnectionConfig( ctx context.Context, slogger *slog.Logger, connectionConfig *mgmtv1alpha1.ConnectionConfig, connectionTimeout *int, ) (*SqlConnection, error)
func (*SqlManager) NewSqlDbFromUrl ¶
func (s *SqlManager) NewSqlDbFromUrl( ctx context.Context, driver, connectionUrl string, ) (*SqlConnection, error)
type SqlManagerClient ¶
type SqlManagerClient interface { NewPooledSqlDb( ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, ) (*SqlConnection, error) NewSqlDb( ctx context.Context, slogger *slog.Logger, connection *mgmtv1alpha1.Connection, connectionTimeout *int, ) (*SqlConnection, error) NewSqlDbFromUrl( ctx context.Context, driver, connectionUrl string, ) (*SqlConnection, error) NewSqlDbFromConnectionConfig( ctx context.Context, slogger *slog.Logger, connectionConfig *mgmtv1alpha1.ConnectionConfig, connectionTimeout *int, ) (*SqlConnection, error) }
type TableConstraints ¶ added in v0.4.23
type TableInitStatement ¶ added in v0.4.24
type TableInitStatement struct { CreateTableStatement string AlterTableStatements []*AlterTableStatement IndexStatements []string }