feat: add database wrapper interfaces for mssql and postgres

Introduce a DB dialect interface and per-dialect wrappers that expose connection, query and column type operations with pre/post SQL hooks.
This commit is contained in:
2026-04-15 19:00:00 -05:00
parent 74abf12dcf
commit ecf0937a53
10 changed files with 145 additions and 15 deletions

View File

@@ -26,3 +26,22 @@ func Close(pool *pgxpool.Pool) {
pool.Close()
}
}
type PostgresDbWrapper struct {
db *pgxpool.Pool
}
func NewPostgresDbWrapper(db *pgxpool.Pool) DbWrapper {
return &PostgresDbWrapper{db: db}
}
func (wrapper *PostgresDbWrapper) Exec(ctx context.Context, query string, args ...any) (DbWrapperResult, error) {
result, err := wrapper.db.Exec(ctx, query, args...)
if err != nil {
return DbWrapperResult{}, err
}
return DbWrapperResult{
AffectedRows: result.RowsAffected(),
}, nil
}