Skip to content

Instantly share code, notes, and snippets.

@r6m
Created April 23, 2018 13:48
Show Gist options
  • Save r6m/c7f2d57d4678b8cb7ab1b7be6d697980 to your computer and use it in GitHub Desktop.
Save r6m/c7f2d57d4678b8cb7ab1b7be6d697980 to your computer and use it in GitHub Desktop.
module
local function get_topic(context, payload)
local query = "SELECT * from game_topics WHERE id = $1"
local parameters = {payload.id}
local ok, rows = pcall(nk.sql_query, query, parameters)
if ok then
return { topic = rows[1] }
else
error(rows)
return { status = "error", error = rows}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment