Fix linter errors.
This commit is contained in:
parent
733614d245
commit
fd11c377b9
7 changed files with 12 additions and 12 deletions
|
|
@ -98,5 +98,5 @@ func (d *deleteStatementImpl) Exec(db execution.DB) (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)
|
||||
return execContext(context, d, db)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
// Query executes query with arguments over database connection with context and stores result into destination.
|
||||
// Destination can be either pointer to struct or pointer to slice of structs.
|
||||
func Query(db DB, context context.Context, query string, args []interface{}, destinationPtr interface{}) error {
|
||||
func Query(context context.Context, db DB, query string, args []interface{}, destinationPtr interface{}) error {
|
||||
|
||||
if destinationPtr == nil {
|
||||
return errors.New("jet: Destination is nil")
|
||||
|
|
@ -27,12 +27,12 @@ func Query(db DB, context context.Context, query string, args []interface{}, des
|
|||
}
|
||||
|
||||
if destinationPtrType.Elem().Kind() == reflect.Slice {
|
||||
return queryToSlice(db, context, query, args, destinationPtr)
|
||||
return queryToSlice(context, db, query, args, destinationPtr)
|
||||
} else if destinationPtrType.Elem().Kind() == reflect.Struct {
|
||||
tempSlicePtrValue := reflect.New(reflect.SliceOf(destinationPtrType))
|
||||
tempSliceValue := tempSlicePtrValue.Elem()
|
||||
|
||||
err := queryToSlice(db, context, query, args, tempSlicePtrValue.Interface())
|
||||
err := queryToSlice(context, db, query, args, tempSlicePtrValue.Interface())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -54,7 +54,7 @@ func Query(db DB, context context.Context, query string, args []interface{}, des
|
|||
}
|
||||
}
|
||||
|
||||
func queryToSlice(db DB, ctx context.Context, query string, args []interface{}, slicePtr interface{}) error {
|
||||
func queryToSlice(ctx context.Context, db DB, query string, args []interface{}, slicePtr interface{}) error {
|
||||
if db == nil {
|
||||
return errors.New("jet: db is nil")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,5 +165,5 @@ func (i *insertStatementImpl) Exec(db execution.DB) (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)
|
||||
return execContext(context, i, db)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,5 +110,5 @@ func (l *lockStatementImpl) Exec(db execution.DB) (sql.Result, error) {
|
|||
}
|
||||
|
||||
func (l *lockStatementImpl) ExecContext(context context.Context, db execution.DB) (res sql.Result, err error) {
|
||||
return execContext(l, db, context)
|
||||
return execContext(context, l, db)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ func (s *selectStatementImpl) Exec(db execution.DB) (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)
|
||||
return execContext(context, s.parent, db)
|
||||
}
|
||||
|
||||
// SelectLock is interface for SELECT statement locks
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func query(statement Statement, db execution.DB, destination interface{}) error
|
|||
return err
|
||||
}
|
||||
|
||||
return execution.Query(db, context.Background(), query, args, destination)
|
||||
return execution.Query(context.Background(), db, query, args, destination)
|
||||
}
|
||||
|
||||
func queryContext(context context.Context, statement Statement, db execution.DB, destination interface{}) error {
|
||||
|
|
@ -65,7 +65,7 @@ func queryContext(context context.Context, statement Statement, db execution.DB,
|
|||
return err
|
||||
}
|
||||
|
||||
return execution.Query(db, context, query, args, destination)
|
||||
return execution.Query(context, db, query, args, destination)
|
||||
}
|
||||
|
||||
func exec(statement Statement, db execution.DB) (res sql.Result, err error) {
|
||||
|
|
@ -78,7 +78,7 @@ func exec(statement Statement, db execution.DB) (res sql.Result, err error) {
|
|||
return db.Exec(query, args...)
|
||||
}
|
||||
|
||||
func execContext(statement Statement, db execution.DB, context context.Context) (res sql.Result, err error) {
|
||||
func execContext(context context.Context, statement Statement, db execution.DB) (res sql.Result, err error) {
|
||||
query, args, err := statement.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -144,5 +144,5 @@ func (u *updateStatementImpl) Exec(db execution.DB) (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)
|
||||
return execContext(context, u, db)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue