diff options
Diffstat (limited to 'vendor/github.com')
-rw-r--r-- | vendor/github.com/mattermost/gorp/.gitignore | 1 | ||||
-rw-r--r-- | vendor/github.com/mattermost/gorp/gorp.go | 21 | ||||
-rw-r--r-- | vendor/github.com/mattermost/gorp/select.go | 23 |
3 files changed, 13 insertions, 32 deletions
diff --git a/vendor/github.com/mattermost/gorp/.gitignore b/vendor/github.com/mattermost/gorp/.gitignore index d18c8ca70..c1bbd21d1 100644 --- a/vendor/github.com/mattermost/gorp/.gitignore +++ b/vendor/github.com/mattermost/gorp/.gitignore @@ -7,3 +7,4 @@ _obj 6.out gorptest.bin tmp +*.swp diff --git a/vendor/github.com/mattermost/gorp/gorp.go b/vendor/github.com/mattermost/gorp/gorp.go index 728971e48..784712fd9 100644 --- a/vendor/github.com/mattermost/gorp/gorp.go +++ b/vendor/github.com/mattermost/gorp/gorp.go @@ -173,13 +173,9 @@ func exec(e SqlExecutor, query string, doTimeout bool, args ...interface{}) (sql query, args = maybeExpandNamedQuery(dbMap, query, args) } - if doTimeout && dbMap.Dialect.Name() != "PostgresDialect" { - ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout) - defer cancel() - return executor.ExecContext(ctx, query, args...) - } else { - return executor.Exec(query, args...) - } + ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout) + defer cancel() + return executor.ExecContext(ctx, query, args...) } // maybeExpandNamedQuery checks the given arg to see if it's eligible to be used @@ -410,14 +406,9 @@ func get(m *DbMap, exec SqlExecutor, i interface{}, dest[x] = target } - var row *sql.Row - if m.Dialect.Name() != "PostgresDialect" { - ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout) - defer cancel() - row = exec.QueryRowContext(ctx, plan.query, keys...) - } else { - row = exec.QueryRow(plan.query, keys...) - } + ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout) + defer cancel() + row := exec.QueryRowContext(ctx, plan.query, keys...) err = row.Scan(dest...) if err != nil { diff --git a/vendor/github.com/mattermost/gorp/select.go b/vendor/github.com/mattermost/gorp/select.go index 1967b0246..10c84b084 100644 --- a/vendor/github.com/mattermost/gorp/select.go +++ b/vendor/github.com/mattermost/gorp/select.go @@ -167,15 +167,9 @@ func selectVal(e SqlExecutor, holder interface{}, query string, args ...interfac query, args = maybeExpandNamedQuery(dbMap, query, args) } - var rows *sql.Rows - var err error - if dbMap.Dialect.Name() != "PostgresDialect" { - ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout) - defer cancel() - rows, err = e.QueryContext(ctx, query, args...) - } else { - rows, err = e.Query(query, args...) - } + ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout) + defer cancel() + rows, err := e.QueryContext(ctx, query, args...) if err != nil { return err @@ -267,14 +261,9 @@ func rawselect(m *DbMap, exec SqlExecutor, i interface{}, query string, } // Run the query - var rows *sql.Rows - if m.Dialect.Name() != "PostgresDialect" { - ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout) - defer cancel() - rows, err = exec.QueryContext(ctx, query, args...) - } else { - rows, err = exec.Query(query, args...) - } + ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout) + defer cancel() + rows, err := exec.QueryContext(ctx, query, args...) if err != nil { return nil, err |