Files
sqlite3/driver/savepoint.go

41 lines
690 B
Go
Raw Permalink Normal View History

2023-11-07 15:19:40 +00:00
package driver
import (
"database/sql"
"time"
"github.com/ncruces/go-sqlite3"
)
// Savepoint establishes a new transaction savepoint.
//
2023-11-09 16:35:45 +00:00
// https://sqlite.org/lang_savepoint.html
2023-11-07 15:19:40 +00:00
func Savepoint(tx *sql.Tx) sqlite3.Savepoint {
var ctx saveptCtx
tx.ExecContext(&ctx, "")
return ctx.Savepoint
}
2024-07-20 01:42:50 +01:00
// A saveptCtx is never canceled, has no values, and has no deadline.
2023-11-07 15:19:40 +00:00
type saveptCtx struct{ sqlite3.Savepoint }
2024-07-20 01:42:50 +01:00
func (*saveptCtx) Deadline() (deadline time.Time, ok bool) {
// notest
return
}
2023-11-07 15:19:40 +00:00
2024-07-20 01:42:50 +01:00
func (*saveptCtx) Done() <-chan struct{} {
// notest
return nil
}
2023-11-07 15:19:40 +00:00
2024-07-20 01:42:50 +01:00
func (*saveptCtx) Err() error {
// notest
return nil
}
2023-11-07 15:19:40 +00:00
2024-07-20 01:42:50 +01:00
func (*saveptCtx) Value(key any) any {
// notest
return nil
}