clients.zerodb_client #
Vlang ZDB Client
to use:
- build zero db from source: https://github.com/threefoldtech/0-db
- run zero db from root of 0db folder:
./zdbd/zdb --help || true
for more info
to use test
##r#mkdir -p ~/.zdb
zdb --socket ~/.zdb/socket --admin 1234
redis-cli -s ~/.zdb/socket
#redis-cli -s ~/.zdb/socket --raw nsinfo default
then in the redis-cli can do e.g.
nsinfo default
Constants #
const version = '0.0.0'
fn delete #
fn delete(args ArgsGet) !
fn exists #
fn exists(args ArgsGet) !bool
does the config exists?
fn get #
fn get(args ArgsGet) !&ZeroDBClient
fn get_zdb #
fn get_zdb(addr string, auth string, namespace string) !ZDB
https://redis.io/topics/protocol examples: localhost:6379 /tmp/redis-default.sock
fn heroscript_dumps #
fn heroscript_dumps(obj ZeroDBClient) !string
///////////NORMALLY NO NEED TO TOUCH
fn heroscript_loads #
fn heroscript_loads(heroscript string) !ZeroDBClient
fn list #
fn list(args ArgsList) ![]&ZeroDBClient
if fromdb set: load from filesystem, and not from mem, will also reset what is in mem
fn new #
fn new(args ArgsGet) !&ZeroDBClient
fn play #
fn play(mut plbook PlayBook) !
fn set #
fn set(o ZeroDBClient) !
register the config for the future
fn switch #
fn switch(name string)
switch instance to be used for zerodb_client
struct ArgsGet #
@[params]
struct ArgsGet {
pub mut:
name string = 'default'
fromdb bool // will load from filesystem
create bool // default will not create if not exist
}
///////FACTORY
struct ArgsList #
@[params]
struct ArgsList {
pub mut:
fromdb bool // will load from filesystem
}
struct ScanArgs #
struct ScanArgs {
cursor string
}
struct ZDB #
struct ZDB {
pub mut:
redis redisclient.Redis
}
fn (ZDB) ping #
fn (mut zdb ZDB) ping() !string
fn (ZDB) set #
fn (mut zdb ZDB) set(key string, val string) !string
if key not specified will get incremental key
fn (ZDB) get #
fn (mut zdb ZDB) get(key string) !string
fn (ZDB) mget #
fn (mut zdb ZDB) mget(key string) !string
fn (ZDB) del #
fn (mut zdb ZDB) del(key string) !string
fn (ZDB) stop #
fn (mut zdb ZDB) stop() !string
used only for debugging, to check memory leaks
fn (ZDB) exists #
fn (mut zdb ZDB) exists(key string) !string
fn (ZDB) check #
fn (mut zdb ZDB) check(key string) !string
fn (ZDB) keycur #
fn (mut zdb ZDB) keycur(key string) !string
fn (ZDB) info #
fn (mut zdb ZDB) info() !string
fn (ZDB) nsnew #
fn (mut zdb ZDB) nsnew(namespace string) !string
fn (ZDB) nsdel #
fn (mut zdb ZDB) nsdel(namespace string) !string
fn (ZDB) nsinfo #
fn (mut zdb ZDB) nsinfo(namespace string) !map[string]string
fn (ZDB) nslist #
fn (mut zdb ZDB) nslist() ![]string
fn (ZDB) nssset #
fn (mut zdb ZDB) nssset(ns string, prop string, val string) !string
fn (ZDB) select_ns #
fn (mut zdb ZDB) select_ns(args SelectArgs) !string
fn (ZDB) dbsize #
fn (mut zdb ZDB) dbsize() !string
fn (ZDB) time #
fn (mut zdb ZDB) time() !string
fn (ZDB) auth #
fn (mut zdb ZDB) auth(password string) !string
fn (ZDB) auth_secure #
fn (mut zdb ZDB) auth_secure() !string
fn (ZDB) scan #
fn (mut zdb ZDB) scan(args ScanArgs) !string
fn (ZDB) scanx #
fn (mut zdb ZDB) scanx(args ScanArgs) !string
this is just an alias for SCAN
fn (ZDB) rscan #
fn (mut zdb ZDB) rscan(args ScanArgs) !string
fn (ZDB) wait #
fn (mut zdb ZDB) wait(args WaitArgs) !string
fn (ZDB) history #
fn (mut zdb ZDB) history(args HistoryArgs) ![]string
fn (ZDB) flush #
fn (mut zdb ZDB) flush() !string
fn (ZDB) hooks #
fn (mut zdb ZDB) hooks() ![]string
fn (ZDB) index_dirty #
fn (mut zdb ZDB) index_dirty() ![]string
fn (ZDB) index_dirty_reset #
fn (mut zdb ZDB) index_dirty_reset() !string
struct ZeroDBClient #
@[heap]
struct ZeroDBClient {
pub mut:
name string = 'default'
mail_from string
mail_password string @[secret]
mail_port int
mail_server string
mail_username string
}
THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED