mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 21:32:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			690 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			690 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package driver
 | |
| 
 | |
| import (
 | |
| 	"database/sql"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/ncruces/go-sqlite3"
 | |
| )
 | |
| 
 | |
| // Savepoint establishes a new transaction savepoint.
 | |
| //
 | |
| // https://sqlite.org/lang_savepoint.html
 | |
| func Savepoint(tx *sql.Tx) sqlite3.Savepoint {
 | |
| 	var ctx saveptCtx
 | |
| 	tx.ExecContext(&ctx, "")
 | |
| 	return ctx.Savepoint
 | |
| }
 | |
| 
 | |
| // A saveptCtx is never canceled, has no values, and has no deadline.
 | |
| type saveptCtx struct{ sqlite3.Savepoint }
 | |
| 
 | |
| func (*saveptCtx) Deadline() (deadline time.Time, ok bool) {
 | |
| 	// notest
 | |
| 	return
 | |
| }
 | |
| 
 | |
| func (*saveptCtx) Done() <-chan struct{} {
 | |
| 	// notest
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func (*saveptCtx) Err() error {
 | |
| 	// notest
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func (*saveptCtx) Value(key any) any {
 | |
| 	// notest
 | |
| 	return nil
 | |
| }
 |