Skip to content

Commit

Permalink
refactor(query_builder) simpler param validation
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Jun 22, 2015
1 parent b3359e7 commit 0a22962
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions kong/dao/cassandra/query_builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,12 @@ local function where_fragment(where_t, column_family_details, no_filtering_check
end
end

if column_family_details.primary_key then
assert(type(column_family_details.primary_key) == "table", "primary_key must be a table")
else
column_family_details.primary_key = {}
end

if column_family_details.clustering_key then
assert(type(column_family_details.clustering_key) == "table", "clustering_key must be a table")
else
column_family_details.clustering_key= {}
end

if column_family_details.indexes then
assert(type(column_family_details.indexes) == "table", "indexes must be a table")
else
column_family_details.indexes = {}
for _, prop in ipairs({"primary_key", "clustering_key", "indexes"}) do
if column_family_details[prop] then
assert(type(column_family_details[prop]) == "table", prop.." must be a table")
else
column_family_details[prop] = {}
end
end

local where_parts, columns = {}, {}
Expand Down

0 comments on commit 0a22962

Please sign in to comment.