summaryrefslogtreecommitdiff
path: root/meta/3rd
diff options
context:
space:
mode:
authorGowa2017 <33367355+Gowa2017@users.noreply.github.com>2021-12-28 15:00:44 +0800
committerGowa2017 <33367355+Gowa2017@users.noreply.github.com>2021-12-28 15:00:44 +0800
commit4781ef1de14f685d9dc49c7bd861f9967a902446 (patch)
tree81d47a45fcebf4ea707cb3c42a25861dd7036ed1 /meta/3rd
parent913b3b45af8c41c95515756602f8dc8ef46fe748 (diff)
downloadlua-language-server-4781ef1de14f685d9dc49c7bd861f9967a902446.zip
add more skynet function defines
Diffstat (limited to 'meta/3rd')
-rw-r--r--meta/3rd/skynet/library/skynet/db/mongo.lua20
-rw-r--r--meta/3rd/skynet/library/skynet/db/mysql.lua54
2 files changed, 70 insertions, 4 deletions
diff --git a/meta/3rd/skynet/library/skynet/db/mongo.lua b/meta/3rd/skynet/library/skynet/db/mongo.lua
index 7908c97d..f4112535 100644
--- a/meta/3rd/skynet/library/skynet/db/mongo.lua
+++ b/meta/3rd/skynet/library/skynet/db/mongo.lua
@@ -14,7 +14,7 @@ local mongo_client = {}
---@class mongo_db
---@field connection mongo_client
----@field name string
+---@field name string
---@field full_name string
---@field database mongo_db
---@field _cmd string dbname.$cmd
@@ -76,8 +76,11 @@ end
function mongo_collection:insert(doc)
end
---向集合安全的插入数据
----@param dco table
-function mongo_collection:safe_insert(dco)
+---@param doc table
+---@return boolean ok #是否成功
+---@return string err #错误消息
+---@return table r #错误返回数据
+function mongo_collection:safe_insert(doc)
end
---插入批量数据
@@ -87,6 +90,9 @@ function mongo_collection:batch_insert(docs)
end
---安全插入批量数据
---@param docs table[]
+---@return boolean ok #是否成功
+---@return string err #错误消息
+---@return table r #错误返回数据
function mongo_collection:safe_batch_insert(docs)
end
@@ -103,6 +109,9 @@ end
---@param update table
---@param upsert boolean
---@param multi boolean
+---@return boolean ok #是否成功
+---@return string err #错误消息
+---@return table r #错误返回数据
function mongo_collection:safe_update(selector, update, upsert, multi)
end
@@ -116,6 +125,9 @@ end
---安全删除数据
---@param selector table
---@param single boolean
+---@return boolean ok #是否成功
+---@return string err #错误消息
+---@return table r #错误返回数据
function mongo_collection:safe_delete(selector, single)
end
@@ -155,7 +167,7 @@ end
--- 删除索引
---* collection:dropIndex("age_1")
---* collection:dropIndex("*")
----@param indexName string
+---@param indexName string
function mongo_collection:dropIndex(indexName)
end
diff --git a/meta/3rd/skynet/library/skynet/db/mysql.lua b/meta/3rd/skynet/library/skynet/db/mysql.lua
new file mode 100644
index 00000000..bd874051
--- /dev/null
+++ b/meta/3rd/skynet/library/skynet/db/mysql.lua
@@ -0,0 +1,54 @@
+---@meta
+---@class MySQL
+local _M = {}
+
+---comment
+---@param opts table {database,user, password,charset,host, port, overload}
+---@return MySQL
+function _M.connect(opts)
+end
+function _M:disconnect()
+end
+---@param query string
+---@return boolean #whether ok
+---@return table # error description table or rows list
+function _M:query(query)
+end
+
+---@class STMT
+---@field prepare_id number
+---@field field_count integer
+---@field param_count integer
+---@field warning_count integer
+---@field params table
+---@field fields table
+local STMT = {}
+---@param sql string
+---@return boolean #whether ok
+---@return STMT # error description table or rows list
+function _M:prepare(sql)
+end
+
+---@param stmt STMT
+---@param ... any
+---@return boolean #whether ok
+---@return table # error description table or rows list
+function _M:execute(stmt, ...)
+end
+---@param stmt STMT
+---@return boolean #whether ok
+---@return table # error description table or rows list
+function _M:stmt_reset(stmt)
+end
+---@param stmt STMT
+function _M:stmt_close(stmt)
+end
+function _M:ping()
+end
+function _M.server_ver()
+end
+function _M.quote_sql_str(str)
+end
+function _M:set_compact_arrays(value)
+end
+return _M