QueryContext and ExecContext function parameters reorder.
This commit is contained in:
parent
b927769d5a
commit
733614d245
8 changed files with 14 additions and 14 deletions
|
|
@ -89,7 +89,7 @@ func (d *deleteStatementImpl) Query(db execution.DB, destination interface{}) er
|
|||
return query(d, db, destination)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
func (d *deleteStatementImpl) QueryContext(context context.Context, db execution.DB, destination interface{}) error {
|
||||
return queryContext(context, d, db, destination)
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +97,6 @@ func (d *deleteStatementImpl) Exec(db execution.DB) (res sql.Result, err error)
|
|||
return exec(d, db)
|
||||
}
|
||||
|
||||
func (d *deleteStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func (d *deleteStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(d, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ func (i *insertStatementImpl) Query(db execution.DB, destination interface{}) er
|
|||
return query(i, db, destination)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
func (i *insertStatementImpl) QueryContext(context context.Context, db execution.DB, destination interface{}) error {
|
||||
return queryContext(context, i, db, destination)
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +164,6 @@ func (i *insertStatementImpl) Exec(db execution.DB) (res sql.Result, err error)
|
|||
return exec(i, db)
|
||||
}
|
||||
|
||||
func (i *insertStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func (i *insertStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(i, db, context)
|
||||
}
|
||||
|
|
|
|||
2
internal/3rdparty/snaker/snaker_test.go
vendored
2
internal/3rdparty/snaker/snaker_test.go
vendored
|
|
@ -83,7 +83,7 @@ var _ = Describe("Snaker", func() {
|
|||
Expect(SnakeToCamel("id")).To(Equal("ID"))
|
||||
})
|
||||
|
||||
It("sould work with initialism where only certain characters are uppercase", func() {
|
||||
It("should work with initialism where only certain characters are uppercase", func() {
|
||||
Expect(SnakeToCamel("oauth_client")).To(Equal("OAuthClient"))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func (l *lockStatementImpl) Query(db execution.DB, destination interface{}) erro
|
|||
return query(l, db, destination)
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
func (l *lockStatementImpl) QueryContext(context context.Context, db execution.DB, destination interface{}) error {
|
||||
return queryContext(context, l, db, destination)
|
||||
}
|
||||
|
||||
|
|
@ -109,6 +109,6 @@ func (l *lockStatementImpl) Exec(db execution.DB) (sql.Result, error) {
|
|||
return exec(l, db)
|
||||
}
|
||||
|
||||
func (l *lockStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func (l *lockStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(l, db, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ func (s *selectStatementImpl) Query(db execution.DB, destination interface{}) er
|
|||
return query(s.parent, db, destination)
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
func (s *selectStatementImpl) QueryContext(context context.Context, db execution.DB, destination interface{}) error {
|
||||
return queryContext(context, s.parent, db, destination)
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ func (s *selectStatementImpl) Exec(db execution.DB) (res sql.Result, err error)
|
|||
return exec(s.parent, db)
|
||||
}
|
||||
|
||||
func (s *selectStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func (s *selectStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(s.parent, db, context)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ type Statement interface {
|
|||
Query(db execution.DB, destination interface{}) error
|
||||
// QueryContext executes statement with a context over database connection db and stores row result in destination.
|
||||
// Destination can be of arbitrary structure
|
||||
QueryContext(db execution.DB, context context.Context, destination interface{}) error
|
||||
QueryContext(context context.Context, db execution.DB, destination interface{}) error
|
||||
|
||||
//Exec executes statement over db connection without returning any rows.
|
||||
Exec(db execution.DB) (sql.Result, error)
|
||||
//Exec executes statement with context over db connection without returning any rows.
|
||||
ExecContext(db execution.DB, context context.Context) (sql.Result, error)
|
||||
ExecContext(context context.Context, db execution.DB) (sql.Result, error)
|
||||
}
|
||||
|
||||
func debugSql(statement Statement) (string, error) {
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ func TestExecWithContext(t *testing.T) {
|
|||
CROSS_JOIN(Track).
|
||||
CROSS_JOIN(InvoiceLine).
|
||||
SELECT(Album.AllColumns, Track.AllColumns, InvoiceLine.AllColumns).
|
||||
ExecContext(db, ctx)
|
||||
ExecContext(ctx, db)
|
||||
|
||||
assert.Error(t, err, "pq: canceling statement due to user request")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (u *updateStatementImpl) Query(db execution.DB, destination interface{}) er
|
|||
return query(u, db, destination)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) QueryContext(db execution.DB, context context.Context, destination interface{}) error {
|
||||
func (u *updateStatementImpl) QueryContext(context context.Context, db execution.DB, destination interface{}) error {
|
||||
return queryContext(context, u, db, destination)
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +143,6 @@ func (u *updateStatementImpl) Exec(db execution.DB) (res sql.Result, err error)
|
|||
return exec(u, db)
|
||||
}
|
||||
|
||||
func (u *updateStatementImpl) ExecContext(db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func (u *updateStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(u, db, context)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue