mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
Bump Go & improve SQL layer
This commit is contained in:
parent
95c67acaa0
commit
15f8a64c86
14 changed files with 109 additions and 135 deletions
|
@ -27,7 +27,7 @@ type Context struct {
|
|||
|
||||
// Bind selects query parameter placeholder for given database provider.
|
||||
//
|
||||
// MySQL uses ?, ?, ? (default for all Documize queries).``
|
||||
// MySQL uses ?, ?, ? (default for all Documize queries).“
|
||||
// PostgreSQL uses $1, $2, $3.
|
||||
// MS SQL Server uses @p1, @p2, @p3.
|
||||
func (c *Context) Bind(sql string) string {
|
||||
|
@ -86,20 +86,6 @@ func (c *Context) DeleteConstrainedWithID(tx *sqlx.Tx, table string, orgID, id s
|
|||
return
|
||||
}
|
||||
|
||||
// DeleteWhere free form query.
|
||||
func (c *Context) DeleteWhere(tx *sqlx.Tx, statement string) (rows int64, err error) {
|
||||
_, err = tx.Exec(statement)
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("unable to delete rows: %s", statement))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// EmptyJSON returns database specific empty JSON object.
|
||||
func (c *Context) EmptyJSON() string {
|
||||
return c.Runtime.StoreProvider.JSONEmpty()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue