Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions coverage/submit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
submit(
filter(
let prefix = joinpath(pwd(), "src", "")
coverage -> startswith(coverage.filename, prefix)
end,
coverage->startswith(coverage.filename, prefix)
end,
readfolder(".")
)
)
Expand Down
27 changes: 12 additions & 15 deletions src/iterate.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function generate_namedtuple(::Type{NamedTuple{names, types}}, q) where {names, types}
function generate_namedtuple(::Type{NamedTuple{names,types}}, q) where {names,types}
if @generated
vals = Tuple(:(getvalue(q, $i, $(fieldtype(types, i)))) for i = 1:fieldcount(types))
return :(NamedTuple{names, types}(($(vals...),)))
return :(NamedTuple{names,types}(($(vals...),)))
else
return NamedTuple{names, types}(Tuple(getvalue(q, i, fieldtype(types, i)) for i = 1:fieldcount(types)))
return NamedTuple{names,types}(Tuple(getvalue(q, i, fieldtype(types, i)) for i = 1:fieldcount(types)))
end
end

Expand Down Expand Up @@ -44,14 +44,14 @@ function getvalue(cursor::SQLiteCursor, column_number::Int, ::Type{Value}) where
julia_type = juliatype(column_type) # native SQLite Int, Float, and Text types
sqlitevalue(
if julia_type === Any
if !isbitstype(Value)
Value
else
julia_type
end
if !isbitstype(Value)
Value
else
julia_type
end, handle, column_number)
end
else
julia_type
end, handle, column_number)
end
end

Expand Down Expand Up @@ -118,14 +118,11 @@ function getiterator(source_code::SourceCode)
handle = statement.handle
schema = ntuple(
let handle = handle
column_number -> name_and_type(handle, column_number)
end,
column_number->name_and_type(handle, column_number)
end,
sqlite3_column_count(handle)
)
SQLiteCursor{NamedTuple{
Tuple(map(first, schema)),
Tuple{map(second, schema)...}
}}(statement, Ref(status), Ref(0))
SQLiteCursor{NamedTuple{Tuple(map(first, schema)),Tuple{map(second, schema)...}}}(statement, Ref(status), Ref(0))
end

# Use default show methods from the queryverse
Expand Down
6 changes: 3 additions & 3 deletions src/model_row.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function model_row_call(::typeof(getproperty), source_tables::Database, table_na
source_row = SourceRow(source, table_name)
NamedTuple{column_names}(
map(column_names) do column_name
get_column(source_row, column_name)
end
get_column(source_row, column_name)
end
)
end

Expand All @@ -39,7 +39,7 @@ function model_row_call(::typeof(QueryOperators.map), iterator, call, call_expre
end

# Grouped rows have their own dedicated model type
struct GroupRow{Group, Row}
struct GroupRow{Group,Row}
group::Group
row::Row
end
Expand Down
12 changes: 6 additions & 6 deletions src/translate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function nest(sql_expression)
SQLExpression(:AS, SQLExpression(:FROM, sql_expression), :__TABLE__)
end

function translate(something::Union{Char, AbstractString}; _primary = true)
function translate(something::Union{Char,AbstractString}; _primary = true)
repr(something)
end

Expand All @@ -29,11 +29,11 @@ end
function translate_default(location, function_type, SQL_call)
result = :(
function translate_call($function_type, arguments...; _primary = true)
$SQLExpression($SQL_call, $map(
argument -> $translate(argument; _primary = _primary),
$SQLExpression($SQL_call, $map(
argument->$translate(argument; _primary = _primary),
arguments
)...)
end
end
)
result.args[2].args[1] = location
result
Expand Down Expand Up @@ -161,7 +161,7 @@ function translate_call(::typeof(QueryOperators.join), source1, source2, key1, k
),
# mark both as not _primary to always be explicit about table
Generator(
pair -> as(pair; _primary = false),
pair->as(pair; _primary = false),
pairs(combine(model_row_1, model_row_2))
)...
)
Expand All @@ -179,7 +179,7 @@ function translate_call(::typeof(QueryOperators.map), select_table, call, call_e
SQLExpression(
:SELECT, inner,
Generator(
pair -> as(pair; _primary = _primary),
pair->as(pair; _primary = _primary),
pairs(call(model_row(select_table)))
)...
)
Expand Down
8 changes: 4 additions & 4 deletions src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ end

split_keyword(keyword::Expr) =
if keyword.head === :kw
Pair(keyword.args[1], keyword.args[2])
else
error("Cannot split keyword $keyword")
end
Pair(keyword.args[1], keyword.args[2])
else
error("Cannot split keyword $keyword")
end

# Split a function call into its pieces
# Normalize non-function-like patterns into function calls
Expand Down
Loading