Mini documentation
ivogel editó esta página hace 2 años

sled

functions

Opens new database or returns exsisting handle

sled.Open(dbname)

Creates new buffer object. Accepts buffer size as integer or string as initial data.

sled.Buffer(buffer size or data)

csldb (Db)

Database object.

methods

Returns tree name.
For csldb object it will always return __sled__default.

csldb:Name()

Clears all data from tree.

csldb:Clear()

Retrives data from tree.
If data is valid, will return string, othervise nil is returned

csldb:Get(key)

Retrives data from tree.
Uses struct as data structure description. If data does not exsist, will return nil. Othervise, it will try to unpack data.
Supports everything from Format Strings for Pack and Unpack except iIzxX! options.
May throw an error.

csldb:GetStruct(key, struct)

Inserts data into tree.

csldb:Insert(key, data)

Inserts structured data into tree.
Supports everything from Format Strings for Pack and Unpack except iIzxX! options.

csldb:InsertStruct(key, struct, data)

Removes key from db.

csldb:Remove(key)

Returns iterator that iterates over range of keys.
This range is inclusive. This means, end_key will be included in end result. (If it exists)

csldb:Range(start_key, end_key)

Returns iterator that will iterate over all keys with specified prefix

csldb:ScanPrefix(key_prefix)

Returns iterator that will iterate over all tree names. Including default one (__sled__default).

csldb:TreeNames()

Opens or returns exsisting tree

csldb:OpenTree(tree_name)

Generates unique ID

csldb:GenerateID()

Exports whole database into string.
Use this only if you want to migrate to newer version of sled.

csldb:Export()

Imports data from string that you have previously retrieved from csldb:Export() call.
DO NOT USE THIS FUNCTION IF YOUR DB ALREADY HAS ANY DATA, OR ELSE THIS WILL CRASH YOUR SERVER.

csldb:Import(data)

cslt (Tree)

Database object.

methods

Returns tree name.

csldb:Name()

Clears all data from tree.

csldb:Clear()

Retrives data from tree.
If data is valid, will return string, othervise nil is returned

csldb:Get(key)

Retrives data from tree.
Uses struct as data structure description. If data does not exsist, will return nil. Othervise, it will try to unpack data.
Supports everything from Format Strings for Pack and Unpack except iIzxX! options.
May throw an error

csldb:GetStruct(key, struct)

Inserts data into tree.

csldb:Insert(key, data)

Inserts structured data into tree.
Supports everything from Format Strings for Pack and Unpack except iIzxX! options.

csldb:InsertStruct(key, struct, data)

Removes key from db.

csldb:Remove(key)

Returns iterator that iterates over range of keys.
This range is inclusive. This means, end_key will be included in end result. (If it exists)

csldb:Range(start_key, end_key)

Returns iterator that will iterate over all keys with specified prefix

csldb:ScanPrefix(key_prefix)