Documentation ¶
Overview ¶
This package defines a SQLCipher database. It provides some default setup options and provides an interface for running functions before and after a transaction.
Index ¶
- Constants
- func EAVExtractNameValues(in []byte) (map[uint32]*EAVValue, error)
- func EAVPack(nameIdx uint32, ts uint64, null bool, val []byte) []byte
- type CallbackFunc
- type Database
- func (db *Database) AfterCommit(f func())
- func (db *Database) BeforeCommit(f RunnerFunc)
- func (db *Database) DB() *sql.DB
- func (db *Database) Initialize(key []byte) error
- func (db *Database) Initialized() bool
- func (db *Database) Lock(label string, runner RunnerFunc) error
- func (db *Database) Migrate(name string, migrations []*migration.Migration) error
- func (db *Database) MigrateNoLock(name string, migrations []*migration.Migration) error
- func (db *Database) Open(key []byte) error
- func (db *Database) Run(label string, runner RunnerFunc) error
- func (db *Database) RunReadOnly(label string, runner RunnerFunc) error
- func (db *Database) RunTx(label string, txOptions *sql.TxOptions, runner RunnerFunc) error
- func (db *Database) Shutdown() error
- func (db *Database) Vacuum() error
- type EAV
- type EAVValue
- type RunnerFunc
Constants ¶
View Source
const NullFlag = 1
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct { Log *zap.SugaredLogger Conn *sqlx.DB Tx *sqlx.Tx EAVHandler *EAV // contains filtered or unexported fields }
func NewDatabase ¶
func (*Database) AfterCommit ¶
func (db *Database) AfterCommit(f func())
func (*Database) BeforeCommit ¶
func (db *Database) BeforeCommit(f RunnerFunc)
func (*Database) Initialize ¶
func (*Database) Initialized ¶
func (*Database) MigrateNoLock ¶
func (*Database) RunReadOnly ¶
func (db *Database) RunReadOnly(label string, runner RunnerFunc) error
type EAV ¶
func (*EAV) MakeEmptyRecord ¶
func (*EAV) SetCallback ¶
func (eav *EAV) SetCallback(r CallbackFunc)
type RunnerFunc ¶
type RunnerFunc func() error
Click to show internal directories.
Click to hide internal directories.