-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.lua
87 lines (60 loc) · 1.69 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
-- Dorea Plugin Loader
-- YuKun Liu <[email protected]>
-- https://dorea.mrxzx.info/
if not ROOT_PATH then
ROOT_PATH = "."
end
if not PLUGIN_LOADER then
PLUGIN_LOADER = {}
end
if not LOGGER_IN then
LOGGER_IN = {}
LOGGER_IN.info = function (message)
print("[INFO] " .. message)
end
LOGGER_IN.trace = function (message)
print("[TRACE] " .. message)
end
LOGGER_IN.debug = function (message)
print("[DEBUG] " .. message)
end
LOGGER_IN.warn = function (message)
print("[WARN] " .. message)
end
LOGGER_IN.error = function (message)
print("[ERROR] " .. message)
end
end
if not DB_MANAGER then
DB_MANAGER = {}
DB_MANAGER.select = function (_, db_name)
LOGGER_IN.info("selet to `" .. db_name .. "`")
end
DB_MANAGER.setex = function (_, key, value, expire)
LOGGER_IN.info("set data: " .. key .. ": " .. value .. " [" .. expire .. "]")
end
DB_MANAGER.get = function (_, key)
LOGGER_IN.info("get data: " .. key)
end
DB_MANAGER.delete = function (_, key)
LOGGER_IN.info("delete data: " .. key)
end
DB_MANAGER.cache = function (_, info)
local state, dump = pcall(require, "dump")
local message = "[> object <]"
if state and dump ~= nil then
message = dump(info)
end
LOGGER_IN.info("send a cache operation: " .. message)
end
end
package.path = ROOT_PATH .. "/library/?.lua;" .. package.path
MANAGER = require("manager")
-- include plugin here
for key, val in pairs(PLUGIN_LOADER) do
MANAGER.load(key, val)
end
-- end to include
MANAGER.load("example", {})
MANAGER.require(ROOT_PATH)
-- rust call