Skip to content

Commit ab43b39

Browse files
committed
more
1 parent b65b920 commit ab43b39

12 files changed

Lines changed: 69 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.jl.*.cov
33
*.jl.mem
44
.vscode
5+
docs/build

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ TableShowUtils = "5e66a065-1f0a-5976-b372-e0b8c017ca10"
1313
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1414

1515
[extras]
16+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
1617
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1718
Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1"
1819
QueryTables = "30ad73d7-305e-5999-88c2-a7d9e8945169"
1920

2021
[targets]
21-
test = ["Test", "Query", "QueryTables"]
22+
test = ["Documenter", "Query", "QueryTables", "Test"]
2223

2324
[compat]
2425
julia = "1"

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

docs/document.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Documenter: deploydocs, makedocs
2+
using Pkg: develop, instantiate, PackageSpec
3+
using QuerySQLite
4+
5+
develop(PackageSpec(path=pwd()))
6+
instantiate()
7+
makedocs(sitename = "QuerySQLite.jl", modules = [QuerySQLite], doctest = false)
8+
deploydocs(repo = "github.com/queryverse/QuerySQLite.jl.git")

docs/src/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```@index
2+
Modules = [QuerySQLite]
3+
```
4+
5+
```@autodocs
6+
Modules = [QuerySQLite]
7+
```

src/QuerySQLite.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module QuerySQLite
22

33
import Base: !, &, |, ==, !=, *, +, %, abs, Char, coalesce, collect, eltype, getproperty, length,
44
lowercase, in, isdone, isequal, isless, ismissing, iterate, IteratorSize, max, min,
5-
occursin, rand, show, showerror, startswith, string, uppercase
5+
occursin, rand, show, showerror, startswith, string, strip, uppercase
66
using Base: Generator, NamedTuple, RefValue, SizeUnknown, tail
77
using Base.Meta: quot
88
import Base.Multimedia: showable

src/code_instead.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ end
117117

118118
@code_instead QueryOperators.groupby SourceCode Any Expr Any Expr
119119

120+
@code_instead hex SourceCode
121+
120122
@code_instead if_else SourceCode Any Any
121123
@code_instead if_else Any SourceCode Any
122124
@code_instead if_else Any Any SourceCode
@@ -172,21 +174,22 @@ end
172174

173175
@code_instead sum SourceCode
174176

177+
@code_instead strip SourceCode
178+
@code_instead strip SourceCode Char
179+
175180
# TODO: add more methods
176181
@code_instead QueryOperators.unique SourceCode Any Expr
177182

178183
@code_instead uppercase SourceCode
179184

180185
# TODO: add
181-
# hex
182186
# printf
183187
# quote
184188
# random
185189
# randomblob
186190
# replace
187191
# round
188192
# substr
189-
# trim
190193
# typeof
191194
# unicode
192195
# zeroblob

src/functions.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,23 @@ function type_of(it)
6666
typeof(it)
6767
end
6868
export type_of
69+
70+
"""
71+
hex(it)
72+
73+
Uppercase heximal representation
74+
75+
```jldoctest
76+
julia> using QuerySQLite
77+
78+
julia> hex("hello")
79+
"68656C6C6F"
80+
```
81+
"""
82+
function hex(it::Number)
83+
uppercase(string(it, base = 16))
84+
end
85+
function hex(it::AbstractString)
86+
join(hex(byte) for byte in codeunits(it))
87+
end
88+
export hex

src/iterate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ end
5858

5959
function iterate(cursor::SQLiteCursor{Row}, state) where {Row}
6060
if state != cursor.cursor_row[]
61-
error("State does not match SQLiteCursor model_row")
61+
error("State does not match SQLiteCursor cursor_row")
6262
else
6363
cursor.status[] = sqlite3_step(cursor.statement.handle)
6464
if isdone(cursor)

src/translate.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct SQLExpression
66
SQLExpression(call, arguments...) = new(call, arguments)
77
end
88

9-
function translate(something::AbstractString; primary = true)
9+
function translate(something::Union{Char, AbstractString}; primary = true)
1010
repr(something)
1111
end
1212

@@ -69,6 +69,8 @@ end
6969

7070
@translate_default ::typeof(coalesce) :COALESCE
7171

72+
@translate_default ::typeof(hex) :HEX
73+
7274
@translate_default ::typeof(QueryOperators.drop) :OFFSET
7375

7476
function translate_call(::typeof(QueryOperators.filter), iterator, call, call_expression; primary = true)
@@ -191,6 +193,8 @@ end
191193

192194
@translate_default ::typeof(string) :||
193195

196+
@translate_default ::typeof(strip) :TRIM
197+
194198
@translate_default ::typeof(sum) :SUM
195199

196200
@translate_default ::typeof(QueryOperators.take) :LIMIT

0 commit comments

Comments
 (0)