lib/ohm/lua/save.lua in ohm-2.3.0 vs lib/ohm/lua/save.lua in ohm-3.0.0
- old
+ new
@@ -1,7 +1,7 @@
-- This script receives four parameters, all encoded with
--- MessagePack. The decoded values are used for saving a model
+-- JSON. The decoded values are used for saving a model
-- instance in Redis, creating or updating a hash as needed and
-- updating zero or more sets (indices) and zero or more hashes
-- (unique indices).
--
-- # model
@@ -28,13 +28,13 @@
-- values are not enumerable. If a field/value pair is not unique
-- (i.e., if there was already a hash entry for that field and
-- value), an error is returned with the UniqueIndexViolation
-- message and the field that triggered the error.
--
-local model = cmsgpack.unpack(ARGV[1])
-local attrs = cmsgpack.unpack(ARGV[2])
-local indices = cmsgpack.unpack(ARGV[3])
-local uniques = cmsgpack.unpack(ARGV[4])
+local model = cjson.decode(ARGV[1])
+local attrs = cjson.decode(ARGV[2])
+local indices = cjson.decode(ARGV[3])
+local uniques = cjson.decode(ARGV[4])
local function save(model, attrs)
if model.id == nil then
model.id = redis.call("INCR", model.name .. ":id")
end