Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
add reference link to sqlite codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuentesg committed Jun 12, 2022
1 parent ed10187 commit ee0c08a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions storage/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ var (
)

// SQLite constraint codes
// Reference: https://www.sqlite.org/rescode.html#pve

const (
ConstraintUnique = 2067
ErrCodeConstraintUnique = 2067
)

type SQLite struct {
Expand All @@ -41,7 +42,7 @@ func (sq *SQLite) Put(r storage.Record) (string, error) {
err := sq.db.QueryRow(query, r.Domain, r.IPv4, r.IPv6, r.TTL, r.Type).Scan(&id)

errCode := err.(*sqlite.Error).Code()
if errCode == ConstraintUnique {
if errCode == ErrCodeConstraintUnique {
return "", ErrRecordAlreadyExists
}
return id, err
Expand Down

0 comments on commit ee0c08a

Please sign in to comment.