Documentation ¶
Index ¶
- func BOOL(dbType string, value bool) string
- func DATE_SINCE(dbType string, value int, interval string) string
- func DEFAULT_TIMESTAMP(dbType string) string
- func IGNORE(dbType string) string
- func JSON(dbType string, value string) string
- func PRIMARY_KEY(dbType string) string
- type DBManager
- type Result
- type Rows
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DATE_SINCE ¶
interval must be minute, hour, second TODO support more
func DEFAULT_TIMESTAMP ¶
func JSON ¶
Important, in JSON entries, must not have surrounding `'` because need to be able to stick in NULL with no `'`
func PRIMARY_KEY ¶
Types ¶
type DBManager ¶
type DBManager interface { /// IsReady will indicate if the SQL connection is ready IsReady() bool // IsLocked returns if the DB is available but locked IsLocked() bool // IsInitialized returns if the DB has ever been created IsInitialized() bool Type() string // Unlock will unlock an SQL database with a key/passphrase Unlock(string) error // RegisterInitScript will register initialization scripts // WILL PANIC IF ANY OF THESE SCRIPTS DO NOT RUN RegisterInitScript(string) // SafeQuery will query safely if the DB is ready SafeQuery(query string, args ...interface{}) (Rows, error) // SafeExec will query safely if the DB is ready SafeExec(query string, args ...interface{}) (Result, error) // GetKey gets a value GetKey(key []byte) (string, error) // SetKey sets a key with a value SetKey(key []byte, value []byte) error // DelKey deletes a key DelKey(key []byte) error KVDB() *bolt.DB }
type Result ¶
type Result interface { // LastInsertId returns the integer generated by the database // in response to a command. Typically this will be from an // "auto increment" column when inserting a new row. Not all // databases support this feature, and the syntax of such // statements varies. LastInsertId() (int64, error) // RowsAffected returns the number of rows affected by an // update, insert, or delete. Not every database or database // driver may support this. RowsAffected() (int64, error) }
Create a passthrough interface for db.Result to allow for mocking
Click to show internal directories.
Click to hide internal directories.