35 lines
870 B
Go
35 lines
870 B
Go
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
|
|
}
|