Skip to content

openrpcserver #

fn comment2id #

fn comment2id(comment string) !u32

fn comment_exist #

fn comment_exist(id u32) !bool

fn comment_get #

fn comment_get(id u32) !Comment

fn comment_load #

fn comment_load(data []u8) !Comment

fn comment_multiset #

fn comment_multiset(args []CommentArg) ![]u32

fn comment_new #

fn comment_new(args CommentArg) !Comment

get new comment, not from the DB

fn comment_set #

fn comment_set(args CommentArg) !u32

fn comments2ids #

fn comments2ids(args []CommentArg) ![]u32

fn delete #

fn delete[T](id u32) !

fn exists #

fn exists[T](id u32) !bool

fn get #

fn get[T](id u32) !T

fn list #

fn list[T]() ![]T

fn new_base #

fn new_base(args BaseArgs) !Base

make it easy to get a base object

fn new_from_base #

fn new_from_base[T](args BaseArgs) !Base

make it easy to get a base object

fn set #

fn set[T](mut obj T) !u32

fn tags2id #

fn tags2id(tags []string) !u32

struct Base #

@[heap]
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
	comments       []u32
}

Group represents a collection of users with roles and permissions

struct BaseArgs #

@[params]
struct BaseArgs {
pub mut:
	id             ?u32
	name           string
	description    string
	securitypolicy ?u32
	tags           []string
	comments       []CommentArg
}

///////////////

struct Comment #

@[heap]
struct Comment {
pub mut:
	id         u32
	comment    string
	parent     u32 // id of parent comment if any, 0 means none
	updated_at i64
	author     u32 // links to user
}

fn (Comment) type_name #

fn (self Comment) type_name() string

fn (Comment) load #

fn (self Comment) load(data []u8) !Comment

fn (Comment) dump #

fn (self Comment) dump() ![]u8

struct CommentArg #

struct CommentArg {
pub mut:
	comment 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
}