-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make postgres queries composable into transaction
Create sub functions which requires sql.Tx as parameters, so they will run queries in transaction. The queries can be combined and reused in functions That's a start to make possible to roll back if we detect that client can't read the secret (bad decrypt key for example)
- Loading branch information
Showing
8 changed files
with
172 additions
and
256 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
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,21 @@ | ||
package entries | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_EntryMeta(t *testing.T) { | ||
expire := time.Now() | ||
|
||
meta := EntryMeta{Expire: expire.Add(time.Second)} | ||
|
||
if meta.IsExpired() { | ||
t.Error("entry meta should not be expired") | ||
} | ||
|
||
meta = EntryMeta{Expire: expire.Add(-time.Second)} | ||
if !meta.IsExpired() { | ||
t.Error("entry meta should be expired") | ||
} | ||
} |
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.