* add query builder to facilitate dynamic SQL construction * leverage query builder to refactor user store This is partially setup work for MM-13120, but merged to master to avoid further conflicts. * fix unrelated unit test breakage * documentation tweaks * Apply suggestions from code review Co-Authored-By: lieut-data <jesse.hallam@gmail.com> * prefer comma separated case options to fallthrough * vendor github.com/Masterminds/squirrel and deps * switch to using github.com/Masterminds/squirrel * rm querybuilder
28 строки
599 B
Go
28 строки
599 B
Go
// +build go1.8
|
|
|
|
package squirrel
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
|
|
"github.com/lann/builder"
|
|
)
|
|
|
|
func (d *deleteData) ExecContext(ctx context.Context) (sql.Result, error) {
|
|
if d.RunWith == nil {
|
|
return nil, RunnerNotSet
|
|
}
|
|
ctxRunner, ok := d.RunWith.(ExecerContext)
|
|
if !ok {
|
|
return nil, NoContextSupport
|
|
}
|
|
return ExecContextWith(ctx, ctxRunner, d)
|
|
}
|
|
|
|
// ExecContext builds and ExecContexts the query with the Runner set by RunWith.
|
|
func (b DeleteBuilder) ExecContext(ctx context.Context) (sql.Result, error) {
|
|
data := builder.GetStruct(b).(deleteData)
|
|
return data.ExecContext(ctx)
|
|
}
|