Documentation ¶
Overview ¶
Package infra defines dnote structure
Index ¶
- Variables
- func InitDB(ctx DnoteCtx) error
- type Config
- type DB
- func (d *DB) Begin() (*DB, error)
- func (d *DB) Close() error
- func (d *DB) Commit() error
- func (d *DB) Exec(query string, values ...interface{}) (sql.Result, error)
- func (d *DB) Prepare(query string) (*sql.Stmt, error)
- func (d *DB) Query(query string, values ...interface{}) (*sql.Rows, error)
- func (d *DB) QueryRow(query string, values ...interface{}) *sql.Row
- func (d *DB) Rollback() error
- type DnoteCtx
- type SQLCommon
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DnoteDirName is the name of the directory containing dnote files DnoteDirName = ".dnote" // SystemSchema is the key for schema in the system table SystemSchema = "schema" // SystemRemoteSchema is the key for remote schema in the system table SystemRemoteSchema = "remote_schema" // SystemLastSyncAt is the timestamp of the server at the last sync SystemLastSyncAt = "last_sync_time" // SystemLastMaxUSN is the user's max_usn from the server at the alst sync SystemLastMaxUSN = "last_max_usn" // SystemLastUpgrade is the timestamp at which the system more recently checked for an upgrade SystemLastUpgrade = "last_upgrade" // SystemCipherKey is the encryption key SystemCipherKey = "enc_key" // SystemSessionKey is the session key SystemSessionKey = "session_token" // SystemSessionKeyExpiry is the timestamp at which the session key will expire SystemSessionKeyExpiry = "session_token_expiry" )
Functions ¶
Types ¶
type DB ¶ added in v0.6.0
type DB struct {
Conn SQLCommon
}
DB contains information about the current database connection
type DnoteCtx ¶
type DnoteCtx struct { HomeDir string DnoteDir string APIEndpoint string Version string DB *DB SessionKey string SessionKeyExpiry int64 CipherKey []byte }
DnoteCtx is a context holding the information of the current runtime
type SQLCommon ¶ added in v0.6.0
type SQLCommon interface { Exec(query string, args ...interface{}) (sql.Result, error) Prepare(query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
SQLCommon is the minimal interface required by a db connection
Click to show internal directories.
Click to hide internal directories.