mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
mongo client : copy table
This commit is contained in:
@@ -89,14 +89,18 @@ local function mongo_auth(mongoc)
|
||||
end
|
||||
end
|
||||
|
||||
function mongo.client( obj )
|
||||
obj.port = obj.port or 27017
|
||||
function mongo.client( conf )
|
||||
local obj = {
|
||||
host = conf.host,
|
||||
port = conf.port or 27017,
|
||||
}
|
||||
|
||||
obj.__id = 0
|
||||
obj.__sock = socketchannel.channel {
|
||||
host = obj.host,
|
||||
port = obj.port,
|
||||
response = dispatch_reply,
|
||||
auth = mongo_auth(obj),
|
||||
auth = mongo_auth(conf),
|
||||
}
|
||||
setmetatable(obj, client_meta)
|
||||
obj.__sock:connect()
|
||||
|
||||
Reference in New Issue
Block a user