Commit 08066e33 authored by François Perrad's avatar François Perrad

refactor

parent 3fdf3b19
......@@ -8,7 +8,6 @@ local rawget = rawget
local rawset = rawset
local require = require
local setmetatable = setmetatable
local tostring = tostring
local type = type
local _G = _G
local Coat = require 'Coat'
......@@ -117,7 +116,7 @@ local function save (class, obj)
for _, field in ipairs(attributes(class)) do
local val = obj[field]
if val ~= nil then
values[field] = tostring(val)
values[field] = val
end
end
......
......@@ -8,8 +8,6 @@ local pairs = pairs
local rawget = rawget
local rawset = rawset
local setmetatable = setmetatable
local tonumber = tonumber
local tostring = tostring
local type = type
local _G = _G
local Coat = require 'Coat'
......@@ -99,7 +97,7 @@ local function save (class, obj)
for _, field in ipairs(attributes(class)) do
local val = obj[field]
if val ~= nil then
values[field] = tostring(val)
values[field] = val
end
end
......@@ -160,9 +158,6 @@ local function find_by_sql (class, sql)
return function (_, var)
local row = f(s, var)
if row then
for k, v in pairs(row) do
row[k] = tonumber(v) or v
end
local obj = class.new(row)
rawset(obj, '_db_exist', true)
return obj
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment