add db-wrapper package types

This commit is contained in:
DiegoAlessandroMotta
2026-04-15 20:22:23 -05:00
parent 803f8988b8
commit ed889b740a
4 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package dbwrapper
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
type postgresDbWrapper struct {
db *pgxpool.Pool
}
func (wrapper *postgresDbWrapper) Connect(ctx context.Context, dbUrl string) error { return nil }
func (wrapper *postgresDbWrapper) Close() error { return nil }
func (wrapper *postgresDbWrapper) Exec(ctx context.Context, query string, args ...any) (ExecResult, error) {
result, err := wrapper.db.Exec(ctx, query, args...)
if err != nil {
return ExecResult{}, err
}
return ExecResult{
AffectedRows: result.RowsAffected(),
}, nil
}
func (wrapper *postgresDbWrapper) Query(ctx context.Context, query string, args ...any) (RowsResult, error) {
return nil, nil
}
func (wrapper *postgresDbWrapper) SaveMassive(ctx context.Context, schema string, table string, columnNames []string, rows [][]any) (int64, error) {
return 0, nil
}