39 lines
928 B
Go
39 lines
928 B
Go
package dbwrapper
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
type mssqlDbWrapper struct {
|
|
db *sql.DB
|
|
}
|
|
|
|
func (wrapper *mssqlDbWrapper) Connect(ctx context.Context, dbUrl string) error { return nil }
|
|
|
|
func (wrapper *mssqlDbWrapper) Close() error { return nil }
|
|
|
|
func (wrapper *mssqlDbWrapper) Exec(ctx context.Context, query string, args ...any) (ExecResult, error) {
|
|
result, execErr := wrapper.db.ExecContext(ctx, query, args...)
|
|
if execErr != nil {
|
|
return ExecResult{}, execErr
|
|
}
|
|
|
|
affectedRows, err := result.RowsAffected()
|
|
if err != nil {
|
|
return ExecResult{}, err
|
|
}
|
|
|
|
return ExecResult{
|
|
AffectedRows: affectedRows,
|
|
}, nil
|
|
}
|
|
|
|
func (wrapper *mssqlDbWrapper) Query(ctx context.Context, query string, args ...any) (RowsResult, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (wrapper *mssqlDbWrapper) SaveMassive(ctx context.Context, schema string, table string, columnNames []string, rows [][]any) (int64, error) {
|
|
return 0, nil
|
|
}
|