Skip to content

Commit 8bcd162

Browse files
authored
Merge pull request #36 from queryverse/create-pull-request/patch
[AUTO] Format files using DocumentFormat
2 parents 4645117 + 6049c2f commit 8bcd162

5 files changed

Lines changed: 66 additions & 66 deletions

File tree

coverage/submit.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
submit(
1010
filter(
1111
let prefix = joinpath(pwd(), "src", "")
12-
coverage->startswith(coverage.filename, prefix)
13-
end,
12+
coverage -> startswith(coverage.filename, prefix)
13+
end,
1414
readfolder(".")
1515
)
1616
)

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Documenter: deploydocs, makedocs
22
using QuerySQLite
33

4-
makedocs(sitename = "QuerySQLite.jl", modules = [QuerySQLite], doctest = false)
5-
deploydocs(repo = "github.com/queryverse/QuerySQLite.jl.git")
4+
makedocs(sitename="QuerySQLite.jl", modules=[QuerySQLite], doctest=false)
5+
deploydocs(repo="github.com/queryverse/QuerySQLite.jl.git")

src/functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ julia> hex("hello")
8080
```
8181
"""
8282
function hex(it::Number)
83-
uppercase(string(it, base = 16))
83+
uppercase(string(it, base=16))
8484
end
8585
function hex(it::AbstractString)
8686
join(hex(byte) for byte in codeunits(it))

src/iterate.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function second((value_1, value_2))
9494
value_2
9595
end
9696

97-
function name_and_type(handle, column_number, nullable = true, strict_types = true)
97+
function name_and_type(handle, column_number, nullable=true, strict_types=true)
9898
Symbol(unsafe_string(sqlite3_column_name(handle, column_number))),
9999
if strict_types
100100
julia_type = juliatype(handle, column_number)
@@ -118,8 +118,8 @@ function getiterator(source_code::SourceCode)
118118
handle = statement.handle
119119
schema = ntuple(
120120
let handle = handle
121-
column_number->name_and_type(handle, column_number)
122-
end,
121+
column_number -> name_and_type(handle, column_number)
122+
end,
123123
sqlite3_column_count(handle)
124124
)
125125
SQLiteCursor{NamedTuple{Tuple(map(first, schema)),Tuple{map(second, schema)...}}}(statement, Ref(status), Ref(0))

src/translate.jl

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ function nest(sql_expression)
1010
SQLExpression(:AS, SQLExpression(:FROM, sql_expression), :__TABLE__)
1111
end
1212

13-
function translate(something::Union{Char,AbstractString}; _primary = true)
13+
function translate(something::Union{Char,AbstractString}; _primary=true)
1414
repr(something)
1515
end
1616

17-
function translate(something; _primary = true)
17+
function translate(something; _primary=true)
1818
something
1919
end
20-
function translate(source_row::SourceRow; _primary = true)
20+
function translate(source_row::SourceRow; _primary=true)
2121
source_row.table_name
2222
end
23-
function translate(call::Expr; _primary = true)
23+
function translate(call::Expr; _primary=true)
2424
arguments, keywords = split_call(call)
25-
translate_call(arguments...; _primary = _primary, keywords...)
25+
translate_call(arguments...; _primary=_primary, keywords...)
2626
end
2727

2828
# A 1-1 mapping between Julia functions and SQL functions
2929
function translate_default(location, function_type, SQL_call)
3030
result = :(
31-
function translate_call($function_type, arguments...; _primary = true)
32-
$SQLExpression($SQL_call, $map(
33-
argument->$translate(argument; _primary = _primary),
31+
function translate_call($function_type, arguments...; _primary=true)
32+
$SQLExpression($SQL_call, $map(
33+
argument -> $translate(argument; _primary=_primary),
3434
arguments
3535
)...)
36-
end
36+
end
3737
)
3838
result.args[2].args[1] = location
3939
result
@@ -65,9 +65,9 @@ end
6565

6666
@translate_default ::typeof(abs) :ABS
6767

68-
function as(pair; _primary = true)
68+
function as(pair; _primary=true)
6969
SQLExpression(:AS,
70-
translate(pair.second.code; _primary = _primary),
70+
translate(pair.second.code; _primary=_primary),
7171
pair.first
7272
)
7373
end
@@ -76,56 +76,56 @@ end
7676

7777
@translate_default ::typeof(char) :CHAR
7878

79-
function translate_call(::typeof(convert), ::Type{Int}, it; _primary = true)
79+
function translate_call(::typeof(convert), ::Type{Int}, it; _primary=true)
8080
SQLExpression(:UNICODE, translate(it))
8181
end
8282

8383
@translate_default ::typeof(hex) :HEX
8484

8585
@translate_default ::typeof(QueryOperators.drop) :OFFSET
8686

87-
function translate_call(::typeof(QueryOperators.filter), iterator, call, call_expression; _primary = true)
87+
function translate_call(::typeof(QueryOperators.filter), iterator, call, call_expression; _primary=true)
8888
SQLExpression(:WHERE,
89-
translate(iterator; _primary = _primary),
90-
translate(call(model_row(iterator)).code; _primary = _primary)
89+
translate(iterator; _primary=_primary),
90+
translate(call(model_row(iterator)).code; _primary=_primary)
9191
)
9292
end
9393

94-
function translate_call(::typeof(format), time_type, format_string; _primary = true)
94+
function translate_call(::typeof(format), time_type, format_string; _primary=true)
9595
SQLExpression(
9696
:STRFTIME,
97-
translate(format_string; _primary = _primary),
98-
translate(time_type; _primary = _primary)
97+
translate(format_string; _primary=_primary),
98+
translate(time_type; _primary=_primary)
9999
)
100100
end
101101

102-
function translate_call(::typeof(getproperty), source_tables::Database, table_name; _primary = true)
103-
translated = translate(table_name; _primary = _primary)
102+
function translate_call(::typeof(getproperty), source_tables::Database, table_name; _primary=true)
103+
translated = translate(table_name; _primary=_primary)
104104
if _primary
105105
SQLExpression(:FROM, translated)
106106
else
107107
translated
108108
end
109109
end
110-
function translate_call(::typeof(getproperty), source_row::SourceRow, column_name; _primary = true)
111-
translated = translate(column_name; _primary = _primary)
110+
function translate_call(::typeof(getproperty), source_row::SourceRow, column_name; _primary=true)
111+
translated = translate(column_name; _primary=_primary)
112112
if _primary
113113
translated
114114
else
115115
SQLExpression(:., source_row.table_name, translated)
116116
end
117117
end
118118

119-
function translate_call(::typeof(QueryOperators.groupby), ungrouped, group_function, group_function_expression, map_selector, map_function_expression; _primary = true)
119+
function translate_call(::typeof(QueryOperators.groupby), ungrouped, group_function, group_function_expression, map_selector, map_function_expression; _primary=true)
120120
model = model_row(ungrouped)
121121
SQLExpression(Symbol("GROUP BY"),
122122
nest(translate_call(
123123
QueryOperators.map,
124124
ungrouped,
125125
map_selector, map_function_expression,
126-
_primary = _primary
126+
_primary=_primary
127127
)),
128-
translate(group_function(model).code; _primary = _primary)
128+
translate(group_function(model).code; _primary=_primary)
129129
)
130130
end
131131

@@ -143,25 +143,25 @@ end
143143

144144
@translate_default ::typeof(join) :GROUP_CONCAT
145145

146-
function translate_call(::typeof(QueryOperators.join), source1, source2, key1, key1_expression, key2, key2_expression, combine, combine_expression; _primary = true)
146+
function translate_call(::typeof(QueryOperators.join), source1, source2, key1, key1_expression, key2, key2_expression, combine, combine_expression; _primary=true)
147147
model_row_1 = model_row(source1)
148148
model_row_2 = model_row(source2)
149149
SQLExpression(:SELECT,
150150
SQLExpression(:ON,
151151
SQLExpression(Symbol("INNER JOIN"),
152152
translate(source1),
153153
# mark as not _primary to suppress FROM
154-
translate(source2; _primary = false)
154+
translate(source2; _primary=false)
155155
),
156156
# mark both as not _primary to always be explicit about table
157157
SQLExpression(:(=),
158-
translate(key1(model_row_1).code; _primary = false),
159-
translate(key2(model_row_2).code; _primary = false)
158+
translate(key1(model_row_1).code; _primary=false),
159+
translate(key2(model_row_2).code; _primary=false)
160160
)
161161
),
162162
# mark both as not _primary to always be explicit about table
163163
Generator(
164-
pair->as(pair; _primary = false),
164+
pair -> as(pair; _primary=false),
165165
pairs(combine(model_row_1, model_row_2))
166166
)...
167167
)
@@ -171,15 +171,15 @@ end
171171

172172
@translate_default ::typeof(lowercase) :LOWER
173173

174-
function translate_call(::typeof(QueryOperators.map), select_table, call, call_expression; _primary = true)
175-
inner = translate(select_table; _primary = _primary)
174+
function translate_call(::typeof(QueryOperators.map), select_table, call, call_expression; _primary=true)
175+
inner = translate(select_table; _primary=_primary)
176176
if inner.call == :SELECT
177177
inner = nest(inner)
178178
end
179179
SQLExpression(
180180
:SELECT, inner,
181181
Generator(
182-
pair->as(pair; _primary = _primary),
182+
pair -> as(pair; _primary=_primary),
183183
pairs(call(model_row(select_table)))
184184
)...
185185
)
@@ -193,49 +193,49 @@ end
193193
@translate_default ::typeof(min) :min
194194
@translate_default ::typeof(minimum) :min
195195

196-
translate_call(::typeof(occursin), needle, haystack; _primary = true) =
196+
translate_call(::typeof(occursin), needle, haystack; _primary=true) =
197197
SQLExpression(
198198
:LIKE,
199-
translate(haystack; _primary = _primary),
200-
translate(needle; _primary = _primary)
199+
translate(haystack; _primary=_primary),
200+
translate(needle; _primary=_primary)
201201
)
202202

203-
function translate_call(::typeof(QueryOperators.orderby), unordered, key_function, key_function_expression; _primary = true)
203+
function translate_call(::typeof(QueryOperators.orderby), unordered, key_function, key_function_expression; _primary=true)
204204
SQLExpression(Symbol("ORDER BY"),
205-
translate(unordered; _primary = _primary),
206-
translate(key_function(model_row(unordered)).code; _primary = _primary)
205+
translate(unordered; _primary=_primary),
206+
translate(key_function(model_row(unordered)).code; _primary=_primary)
207207
)
208208
end
209209

210-
function translate_call(::typeof(QueryOperators.orderby_descending), unordered, key_function, key_function_expression; _primary = true)
210+
function translate_call(::typeof(QueryOperators.orderby_descending), unordered, key_function, key_function_expression; _primary=true)
211211
SQLExpression(Symbol("ORDER BY"),
212-
translate(unordered; _primary = _primary),
212+
translate(unordered; _primary=_primary),
213213
SQLExpression(:DESC,
214-
translate(key_function(model_row(unordered)).code; _primary = _primary)
214+
translate(key_function(model_row(unordered)).code; _primary=_primary)
215215
)
216216
)
217217
end
218218

219219
@translate_default ::typeof(repr) :QUOTE
220220

221-
function translate_call(::typeof(rand), ::Type{Int}; _primary = true)
221+
function translate_call(::typeof(rand), ::Type{Int}; _primary=true)
222222
SQLExpression(:RANDOM)
223223
end
224224

225225
@translate_default ::typeof(randstring) :RANDOMBLOB
226226

227-
function translate_call(::typeof(replace), it, pair; _primary = true)
227+
function translate_call(::typeof(replace), it, pair; _primary=true)
228228
SQLExpression(:REPLACE,
229-
translate(it; _primary = _primary),
230-
translate(pair.first; _primary = _primary),
231-
translate(pair.second; _primary = _primary)
229+
translate(it; _primary=_primary),
230+
translate(pair.first; _primary=_primary),
231+
translate(pair.second; _primary=_primary)
232232
)
233233
end
234234

235-
function translate_call(::typeof(round), it; _primary = true, digits = 0)
235+
function translate_call(::typeof(round), it; _primary=true, digits=0)
236236
SQLExpression(:ROUND,
237-
translate(it; _primary = _primary),
238-
translate(digits; _primary = _primary)
237+
translate(it; _primary=_primary),
238+
translate(digits; _primary=_primary)
239239
)
240240
end
241241

@@ -249,26 +249,26 @@ end
249249

250250
@translate_default ::typeof(QueryOperators.take) :LIMIT
251251

252-
function translate_call(::typeof(QueryOperators.thenby), unordered, key_function, key_function_expression; _primary = true)
253-
original = translate(unordered; _primary = _primary)
252+
function translate_call(::typeof(QueryOperators.thenby), unordered, key_function, key_function_expression; _primary=true)
253+
original = translate(unordered; _primary=_primary)
254254
SQLExpression(original.call, original.arguments...,
255-
translate(key_function(model_row(unordered)).code; _primary = _primary)
255+
translate(key_function(model_row(unordered)).code; _primary=_primary)
256256
)
257257
end
258258

259-
function translate_call(::typeof(QueryOperators.thenby_descending), unordered, key_function, key_function_expression; _primary = true)
260-
original = translate(unordered; _primary = _primary)
259+
function translate_call(::typeof(QueryOperators.thenby_descending), unordered, key_function, key_function_expression; _primary=true)
260+
original = translate(unordered; _primary=_primary)
261261
SQLExpression(original.call, original.arguments...,
262262
SQLExpression(:DESC,
263-
translate(key_function(model_row(unordered)).code; _primary = _primary)
263+
translate(key_function(model_row(unordered)).code; _primary=_primary)
264264
)
265265
)
266266
end
267267

268268
@translate_default ::typeof(type_of) :TYPEOF
269269

270-
function translate_call(::typeof(QueryOperators.unique), repeated, key_function, key_function_expression; _primary = true)
271-
result = translate(repeated; _primary = _primary)
270+
function translate_call(::typeof(QueryOperators.unique), repeated, key_function, key_function_expression; _primary=true)
271+
result = translate(repeated; _primary=_primary)
272272
SQLExpression(Symbol(string(result.call, " DISTINCT")), result.arguments...)
273273
end
274274

0 commit comments

Comments
 (0)