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