-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14918 from manadart/3.0-dqlite-lease-store
[JUJU-1944] DB-backed lease store implementation
- Loading branch information
Showing
5 changed files
with
747 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package database | ||
|
||
import ( | ||
"github.com/juju/errors" | ||
"github.com/mattn/go-sqlite3" | ||
) | ||
|
||
// IsErrConstraintUnique returns true if the input error was | ||
// returned by SQLite due to violation of a unique constraint. | ||
func IsErrConstraintUnique(err error) bool { | ||
var sqliteErr sqlite3.Error | ||
if errors.As(err, &sqliteErr) && sqliteErr.ExtendedCode == sqlite3.ErrConstraintUnique { | ||
return true | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.