mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-03 06:07:20 +02:00
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
|
|
package database // import "imuslab.com/arozos/mod/database"
|
|
|
|
|
|
TYPES
|
|
|
|
type Database struct {
|
|
Db *bolt.DB
|
|
ReadOnly bool
|
|
}
|
|
|
|
func NewDatabase(dbfile string, readOnlyMode bool) (*Database, error)
|
|
|
|
func (d *Database) Close()
|
|
|
|
func (d *Database) Delete(tableName string, key string) error
|
|
Delete a value from the database table given tablename and key
|
|
|
|
err := sysdb.Delete("MyTable", "username/message");
|
|
|
|
func (d *Database) DropTable(tableName string) error
|
|
|
|
func (d *Database) KeyExists(tableName string, key string) bool
|
|
|
|
func (d *Database) ListTable(tableName string) ([][][]byte, error)
|
|
|
|
func (d *Database) NewTable(tableName string) error
|
|
|
|
func (d *Database) Read(tableName string, key string, assignee interface{}) error
|
|
|
|
func (d *Database) UpdateReadWriteMode(readOnly bool)
|
|
|
|
func (d *Database) Write(tableName string, key string, value interface{}) error
|
|
Write to database with given tablename and key. Example Usage: type demo
|
|
struct{
|
|
|
|
content string
|
|
|
|
} thisDemo := demo{
|
|
|
|
content: "Hello World",
|
|
|
|
} err := sysdb.Write("MyTable", "username/message",thisDemo);
|
|
|