good morning!!!!

Skip to content
Snippets Groups Projects
Commit 858e2fef authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Adding HasExecStatement interface to delegate Exec to the adapter.

parent 0874969d
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,10 @@ import (
"upper.io/db/internal/sqlutil/tx"
)
type HasExecStatement interface {
Exec(stmt *sqlx.Stmt, args ...interface{}) (sql.Result, error)
}
type PartialDatabase interface {
PopulateSchema() error
TableExists(name string) error
......@@ -195,6 +199,10 @@ func (d *BaseDatabase) Exec(stmt *sqlgen.Statement, args ...interface{}) (sql.Re
return nil, err
}
if execer, ok := d.partial.(HasExecStatement); ok {
return execer.Exec(p, args...)
}
return p.Exec(args...)
}
......
......@@ -147,7 +147,7 @@ func (r *Result) Count() (uint64, error) {
}{}
q := r.buildSelect()
q.Columns(db.Raw{"COUNT(1) AS _t"}).Limit(1)
q.Columns(db.Raw{"count(1) AS _t"}).Limit(1)
if err := q.Iterator().One(&counter); err != nil {
return 0, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment