1package driver
2
3import (
4 "database/sql"
5 "time"
6
7 "github.com/ncruces/go-sqlite3"
8)
9
10// Savepoint establishes a new transaction savepoint.
11//
12// https://sqlite.org/lang_savepoint.html
13func Savepoint(tx *sql.Tx) sqlite3.Savepoint {
14 var ctx saveptCtx
15 tx.ExecContext(&ctx, "")
16 return ctx.Savepoint
17}
18
19// A saveptCtx is never canceled, has no values, and has no deadline.
20type saveptCtx struct{ sqlite3.Savepoint }
21
22func (*saveptCtx) Deadline() (deadline time.Time, ok bool) {
23 // notest
24 return
25}
26
27func (*saveptCtx) Done() <-chan struct{} {
28 // notest
29 return nil
30}
31
32func (*saveptCtx) Err() error {
33 // notest
34 return nil
35}
36
37func (*saveptCtx) Value(key any) any {
38 // notest
39 return nil
40}