add db-wrapper package types
This commit is contained in:
34
internal/app/db-wrapper/postgres.go
Normal file
34
internal/app/db-wrapper/postgres.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user