hero.db #
fn decode_bool #
fn decode_bool(data string) !bool
fn decode_generic #
fn decode_generic[T](data string) !T
fn decode_int #
fn decode_int(data string) !int
fn decode_string #
fn decode_string(data string) !string
fn decode_u32 #
fn decode_u32(data string) !u32
fn new #
fn new(args DBArgs) !DB
fn new_test #
fn new_test() !DB
struct Base #
struct Base {
pub mut:
id u32
name string
description string
created_at i64
updated_at i64
securitypolicy u32
tags u32 // when we set/get we always do as []string but this can then be sorted and md5ed this gies the unique id of tags
messages []u32
}
struct DB #
struct DB {
pub mut:
redis &redisclient.Redis @[skip; str: skip]
}
Current time import incubaid.herolib.data.encoder
fn (DB) delete #
fn (mut self DB) delete[T](id u32) !
fn (DB) exists #
fn (mut self DB) exists[T](id u32) !bool
fn (DB) get_data #
fn (mut self DB) get_data[T](id u32) !(T, []u8)
return the data, cannot return the object as we do not know the type
fn (DB) list #
fn (mut self DB) list[T]() ![]u32
fn (DB) message_get #
fn (mut self DB) message_get(message string) !u32
fn (DB) messages_get #
fn (mut self DB) messages_get(args []MessageArg) ![]u32
fn (DB) new_from_base #
fn (mut self DB) new_from_base[T](args BaseArgs) !Base
make it easy to get a base object
fn (DB) new_id #
fn (mut self DB) new_id() !u32
fn (DB) set #
fn (mut self DB) set[T](obj_ T) !T
struct DBArgs #
@[params]
struct DBArgs {
pub mut:
redis ?&redisclient.Redis
}
struct MessageArg #
@[params]
struct MessageArg {
pub mut:
message string
parent u32
author u32
}
struct SecurityPolicy #
@[heap]
struct SecurityPolicy {
pub mut:
id u32
read []u32 // links to users & groups
write []u32 // links to users & groups
delete []u32 // links to users & groups
public bool
md5 string // this sorts read, write and delete u32 + hash, then do md5 hash, this allows to go from a random read/write/delete/public config to a hash
}
struct Tags #
@[heap]
struct Tags {
pub mut:
id u32
names []string // unique per id
md5 string // of sorted names, to make easy to find unique id, each name lowercased and made ascii
}