Skip to content

Commit 96ce09d

Browse files
huntkaliojohzchen
andauthored
som bug fix (#54)
* bug fix * fix: need to do json encode that make use could save table directly Co-authored-by: nic-chen <[email protected]>
1 parent 544588b commit 96ce09d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/resty/etcd/v3.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,17 @@ local function set(self, key, val, attr)
249249

250250
local prev_kv
251251
if attr.prev_kv then
252-
prev_kv = attr.prev_kv and 'true' or 'false'
252+
prev_kv = attr.prev_kv and true or false
253253
end
254254

255255
local ignore_value
256256
if attr.ignore_value then
257-
ignore_value = attr.ignore_value and 'true' or 'false'
257+
ignore_value = attr.ignore_value and true or false
258258
end
259259

260260
local ignore_lease
261261
if attr.ignore_lease then
262-
ignore_lease = attr.ignore_lease and 'true' or 'false'
262+
ignore_lease = attr.ignore_lease and true or false
263263
end
264264

265265
local opts = {
@@ -326,17 +326,17 @@ local function get(self, key, attr)
326326

327327
local serializable
328328
if attr.serializable then
329-
serializable = attr.serializable and 'true' or 'false'
329+
serializable = attr.serializable and true or false
330330
end
331331

332332
local keys_only
333333
if attr.keys_only then
334-
keys_only = attr.keys_only and 'true' or 'false'
334+
keys_only = attr.keys_only and true or false
335335
end
336336

337337
local count_only
338338
if attr.count_only then
339-
count_only = attr.count_only and 'true' or 'false'
339+
count_only = attr.count_only and true or false
340340
end
341341

342342
local min_mod_revision
@@ -406,7 +406,7 @@ local function delete(self, key, attr)
406406

407407
local prev_kv
408408
if attr.prev_kv then
409-
prev_kv = attr.prev_kv and 'true' or 'false'
409+
prev_kv = attr.prev_kv and true or false
410410
end
411411

412412
key = encode_base64(key)
@@ -648,7 +648,7 @@ function _M.get(self, key, opts)
648648
attr.timeout = opts and opts.timeout
649649
attr.revision = opts and opts.revision
650650

651-
return get(self, key)
651+
return get(self, key, attr)
652652
end
653653

654654
function _M.watch(self, key, opts)

t/v3/key.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ __DATA__
5656
local etcd, err = require "resty.etcd" .new({protocol = "v3"})
5757
check_res(etcd, err)
5858
59-
local res, err = etcd:set("/test", "abc")
59+
local res, err = etcd:set("/test", "abc", {prev_kv = true})
6060
check_res(res, err)
6161
6262
local data, err = etcd:get("/test")

0 commit comments

Comments
 (0)