Documentation ¶
Index ¶
- func CommitOrClose(dbOrTx DBOrTx) error
- func Create(dbPath string, flag int, perm os.FileMode) (*sql.DB, error)
- func CreateTemp() (db *sql.DB, deleteOrPanic func(), err error)
- func CreateTempCopyOf(basedOn string) (db *sql.DB, path string, deleteOrPanic func(), err error)
- func DeleteEmptyMessages(ctx context.Context, dbOrTx DBOrTx) error
- func Open(dbPath string) (*sql.DB, error)
- type ClosableTx
- func (dbAndTx *ClosableTx) Close() error
- func (dbAndTx *ClosableTx) Commit() error
- func (dbAndTx *ClosableTx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (dbAndTx *ClosableTx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (dbAndTx *ClosableTx) Prepare(query string) (*sql.Stmt, error)
- func (dbAndTx *ClosableTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (dbAndTx *ClosableTx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (dbAndTx *ClosableTx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (dbAndTx *ClosableTx) QueryRow(query string, args ...interface{}) *sql.Row
- func (dbAndTx *ClosableTx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (dbAndTx *ClosableTx) Rollback() error
- type DBOrTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitOrClose ¶
func CreateTemp ¶
CreateTemp can be used to create a temporary SQLite DB. It gives you a cleanup function whose execution you can defer. The cleanup function will panic if there's an error deleting the file, since databases can contain sensitive info.
func CreateTempCopyOf ¶
func DeleteEmptyMessages ¶
DeleteEmptyMessages deletes SMSes/MMSes that have no body and no attachments
Types ¶
type ClosableTx ¶
func NewClosableTx ¶
func NewClosableTx(db *sql.DB) (*ClosableTx, error)
func OpenToTx ¶
func OpenToTx(dbPath string) (*ClosableTx, error)
func (*ClosableTx) Close ¶
func (dbAndTx *ClosableTx) Close() error
func (*ClosableTx) Commit ¶
func (dbAndTx *ClosableTx) Commit() error
func (*ClosableTx) Exec ¶
func (dbAndTx *ClosableTx) Exec(query string, args ...interface{}) (sql.Result, error)
func (*ClosableTx) ExecContext ¶
func (*ClosableTx) PrepareContext ¶
func (*ClosableTx) Query ¶
func (dbAndTx *ClosableTx) Query(query string, args ...interface{}) (*sql.Rows, error)
func (*ClosableTx) QueryContext ¶
func (*ClosableTx) QueryRow ¶
func (dbAndTx *ClosableTx) QueryRow(query string, args ...interface{}) *sql.Row
func (*ClosableTx) QueryRowContext ¶
func (*ClosableTx) Rollback ¶
func (dbAndTx *ClosableTx) Rollback() error
type DBOrTx ¶
type DBOrTx interface { Exec(query string, args ...interface{}) (sql.Result, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) Prepare(query string) (*sql.Stmt, error) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row }
DBOrTx is an interface satisfied by *sql.DB and *sql.Tx. It lets you run whatever SQL queries you need, either in a transaction or not in a transaction
Click to show internal directories.
Click to hide internal directories.