github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/driver/savepoint.go (about)

     1  package driver
     2  
     3  import (
     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
    13  func Savepoint(tx *sql.Tx) sqlite3.Savepoint {
    14  	var ctx saveptCtx
    15  	tx.ExecContext(&ctx, "")
    16  	return ctx.Savepoint
    17  }
    18  
    19  type saveptCtx struct{ sqlite3.Savepoint }
    20  
    21  func (*saveptCtx) Deadline() (deadline time.Time, ok bool) { return }
    22  
    23  func (*saveptCtx) Done() <-chan struct{} { return nil }
    24  
    25  func (*saveptCtx) Err() error { return nil }
    26  
    27  func (*saveptCtx) Value(key any) any { return nil }