-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
56 additions
and
11 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,27 @@ | ||
package driver | ||
|
||
import ( | ||
"database/sql" | ||
"time" | ||
|
||
"github.com/ncruces/go-sqlite3" | ||
) | ||
|
||
// Savepoint establishes a new transaction savepoint. | ||
// | ||
// https://www.sqlite.org/lang_savepoint.html | ||
func Savepoint(tx *sql.Tx) sqlite3.Savepoint { | ||
var ctx saveptCtx | ||
tx.ExecContext(&ctx, "") | ||
return ctx.Savepoint | ||
} | ||
|
||
type saveptCtx struct{ sqlite3.Savepoint } | ||
|
||
func (*saveptCtx) Deadline() (deadline time.Time, ok bool) { return } | ||
|
||
func (*saveptCtx) Done() <-chan struct{} { return nil } | ||
|
||
func (*saveptCtx) Err() error { return nil } | ||
|
||
func (*saveptCtx) Value(key any) any { return nil } |
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