Documentation
¶
Index ¶
- type ColumnSchema
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) DeleteBatch(table string, idCol string, ids []interface{}) error
- func (c *Connection) DeleteBatchWithCount(table string, idCol string, ids []interface{}) (int64, error)
- func (c *Connection) DisableForeignKeyChecks(db *sql.Tx) error
- func (c *Connection) EnableForeignKeyChecks() error
- func (c *Connection) GetDB() *sql.DB
- func (c *Connection) GetSchema() ([]TableSchema, error)
- func (c *Connection) UpsertRow(schema *TableSchema, data map[string]interface{}) error
- type DBType
- type TableSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnSchema ¶
type ColumnSchema struct {
Name string
Type string
IsID bool // True if this is an ID column
Nullable bool
MaxLength int // Maximum length for varchar fields
}
ColumnSchema represents the structure of a table column
type Connection ¶
type Connection struct {
Type DBType
// contains filtered or unexported fields
}
Connection represents a database connection
func (*Connection) DeleteBatch ¶
func (c *Connection) DeleteBatch(table string, idCol string, ids []interface{}) error
DeleteBatch deletes rows from the given table where id is between minID and maxID and not in the provided ids. ids must be a pre-sorted, non-empty slice of interface{} representing the IDs to keep.
func (*Connection) DeleteBatchWithCount ¶
func (c *Connection) DeleteBatchWithCount(table string, idCol string, ids []interface{}) (int64, error)
DeleteBatchWithCount deletes rows from the given table where id is between minID and maxID and not in the provided ids. Returns the number of rows deleted and any error that occurred. ids must be a pre-sorted, non-empty slice of interface{} representing the IDs to keep.
func (*Connection) DisableForeignKeyChecks ¶
func (c *Connection) DisableForeignKeyChecks(db *sql.Tx) error
DisableForeignKeyChecks disables foreign key constraint checking
func (*Connection) EnableForeignKeyChecks ¶
func (c *Connection) EnableForeignKeyChecks() error
EnableForeignKeyChecks enables foreign key constraint checking
func (*Connection) GetDB ¶
func (c *Connection) GetDB() *sql.DB
GetDB returns the underlying *sql.DB instance
func (*Connection) GetSchema ¶
func (c *Connection) GetSchema() ([]TableSchema, error)
GetSchema retrieves the database schema for all tables
func (*Connection) UpsertRow ¶
func (c *Connection) UpsertRow(schema *TableSchema, data map[string]interface{}) error
UpsertRow handles inserting or updating a row in the destination database
type TableSchema ¶
type TableSchema struct {
Name string
Columns []ColumnSchema
HasID bool // Indicates if table has an ID field for upsert logic
IDCol string // Name of the ID column, if any
}
TableSchema represents the structure of a database table