코드 정리

This commit is contained in:
freestrings
2019-09-22 22:09:38 +09:00
parent c8ab8ad107
commit c3ac7e40e8
5 changed files with 4564 additions and 72 deletions

View File

@ -35,8 +35,15 @@ function module.compile(path)
cache[path] = jsonpath.ffi_path_compile(path)
_ngx.log(_ngx.INFO, 'compile : [' .. path .. ']')
end
end
function module.exec(path)
local compiledPath = cache[path]
if(cache[path] == nil) then
assert(jsonpath, path .. ": is not compiled")
end
return function(jsonStr)
local result = jsonpath.ffi_select_with_compiled_path(compiledPath, jsonStr)
return ffi.string(result);