Skip to content

Commit

Permalink
Merge pull request #1 from assafmo/assafmo/sqlite-fix-get
Browse files Browse the repository at this point in the history
SQLite: Fix Get() to return nil when there is no value
  • Loading branch information
faddat committed Apr 5, 2024
2 parents cabbeff + aee4b35 commit 90f59fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ func (db *SQLiteDB) Get(key []byte) ([]byte, error) {
return nil, err
}

// sqlite.QueryRow().Scan() returns an empty byte slice if there is no value.
// Get() is expected to return nil in this case.
if len(value) == 0 {
return nil, nil
}

return value, nil
}

Expand Down

0 comments on commit 90f59fd

Please sign in to comment.