summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-gorp/gorp/lockerror.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-05-29 15:46:35 -0400
committerGitHub <noreply@github.com>2017-05-29 15:46:35 -0400
commit860e5d483cd952ec833c40312a2141bb3e4ef579 (patch)
treea854943f1f008f9b0f607f486de4b117b98e08e4 /vendor/github.com/go-gorp/gorp/lockerror.go
parentf9843b380074cc6082566a2752c5482210f912bb (diff)
downloadchat-860e5d483cd952ec833c40312a2141bb3e4ef579.tar.gz
chat-860e5d483cd952ec833c40312a2141bb3e4ef579.tar.bz2
chat-860e5d483cd952ec833c40312a2141bb3e4ef579.zip
PLT-6341/PLT-6342 Update gorp to mattermost fork and add connection timeout setting (#6410)
* Update gorp to mattermost fork and add connection timeout setting * Add go dependency * Rename from connection timeout to query timeout * Properly add gorp dependency
Diffstat (limited to 'vendor/github.com/go-gorp/gorp/lockerror.go')
-rw-r--r--vendor/github.com/go-gorp/gorp/lockerror.go63
1 files changed, 0 insertions, 63 deletions
diff --git a/vendor/github.com/go-gorp/gorp/lockerror.go b/vendor/github.com/go-gorp/gorp/lockerror.go
deleted file mode 100644
index 07b3047ae..000000000
--- a/vendor/github.com/go-gorp/gorp/lockerror.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2012 James Cooper. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-// Package gorp provides a simple way to marshal Go structs to and from
-// SQL databases. It uses the database/sql package, and should work with any
-// compliant database/sql driver.
-//
-// Source code and project home:
-// https://github.com/go-gorp/gorp
-
-package gorp
-
-import (
- "fmt"
- "reflect"
-)
-
-// OptimisticLockError is returned by Update() or Delete() if the
-// struct being modified has a Version field and the value is not equal to
-// the current value in the database
-type OptimisticLockError struct {
- // Table name where the lock error occurred
- TableName string
-
- // Primary key values of the row being updated/deleted
- Keys []interface{}
-
- // true if a row was found with those keys, indicating the
- // LocalVersion is stale. false if no value was found with those
- // keys, suggesting the row has been deleted since loaded, or
- // was never inserted to begin with
- RowExists bool
-
- // Version value on the struct passed to Update/Delete. This value is
- // out of sync with the database.
- LocalVersion int64
-}
-
-// Error returns a description of the cause of the lock error
-func (e OptimisticLockError) Error() string {
- if e.RowExists {
- return fmt.Sprintf("gorp: OptimisticLockError table=%s keys=%v out of date version=%d", e.TableName, e.Keys, e.LocalVersion)
- }
-
- return fmt.Sprintf("gorp: OptimisticLockError no row found for table=%s keys=%v", e.TableName, e.Keys)
-}
-
-func lockError(m *DbMap, exec SqlExecutor, tableName string,
- existingVer int64, elem reflect.Value,
- keys ...interface{}) (int64, error) {
-
- existing, err := get(m, exec, elem.Interface(), keys...)
- if err != nil {
- return -1, err
- }
-
- ole := OptimisticLockError{tableName, keys, true, existingVer}
- if existing == nil {
- ole.RowExists = false
- }
- return -1, ole
-}