Skip to content

Commit cb003bd

Browse files
authored
Merge pull request #3 from cpfiffer/main
minor doc corrections
2 parents e6718a2 + 5f9fee3 commit cb003bd

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Wasabi is a simple yet powerful ORM for the Julia Language. It currently support
1313
1414
### Getting Started
1515

16-
```
16+
```julia
1717
using Wasabi
1818
using SQLite
1919

docs/src/customtype.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can implement a new custom type just implementing some functions.
1010

1111
Suppose you want to create a JSON type called CustomType that is converted as TEXT on the database.
1212

13-
```
13+
```julia
1414
using SQLite
1515

1616
struct CustomType
@@ -30,4 +30,4 @@ model = TestModel(1, CustomType(Dict("key" => "value")))
3030
Wasabi.insert!(conn, model)
3131

3232
model = Wasabi.first(conn, TestModel, 1) # model.custom.value["key"] == "value"
33-
```
33+
```

docs/src/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CurrentModule = Wasabi
77
Wasabi is a simple ORM for Julia. It currently supports PostgreSQL and SQLite.
88
Wasabi uses [package extensions](https://github.com/JuliaLang/julia/blob/v1.9.0-beta3/NEWS.md#package-manager) so it requires Julia >= 1.9 to run. Using SQLite or LibPQ automatically includes Wasabi features to support it as backend database.
99

10-
```
10+
```julia
1111
using Wasabi
1212
using SQLite
1313

docs/src/migrations.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ Migrations are an easy way to keep track of database schema updates.
44

55
This will generate a folder containing the first migration which create the migration table and keep track of the current status of the database.
66

7-
```
7+
```julia
88
using Wasbi
99

1010
path = "migrations/"
1111
Migrations.generate(path)
1212
```
1313

1414
Next you can update (upgrade/downgrade) the database to the required version doing
15-
```
15+
```julia
1616
using Wasbi
1717
using SQLite
1818

1919
version = "xxx" # using Migrations.get_last_version(path) gives you the latest available migration
2020
Migrations.execute(db, path, version)
21-
```
21+
```

docs/src/querybuilder.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CurrentModule = Wasabi.QueryBuilder
55
# QueryBuilder
66

77
You can use QueryBuilder to create and execute a query in a simple and fast way.
8-
```
8+
```julia
99
using Wasabi
1010
using SQLite
1111

@@ -25,7 +25,7 @@ QueryBuilder supports select, join, where, limit, offset, group by and order by.
2525

2626
Select can be expressed as vector of symbols or using SelectExpr object. If no arguments are passed to select then all fields of the model are selected. You can also use alias and select function like count, sum, avg and so on.
2727

28-
```
28+
```julia
2929
QueryBuilder.from(User) |> QueryBuilder.select() # Select all fields from user model
3030
QueryBuilder.from(User) |> QueryBuilder.select([:id, :name]) # SELECT user_alias.id, user_alias.name FROM user user_alias
3131
QueryBuilder.from(User) |> QueryBuilder.select(User, :id, :total, :count) # SELECT COUNT(user_alias.id) AS total FROM user user_alias
@@ -35,15 +35,15 @@ Join are expressed using source, target, type (inner, outer ...), on, select.
3535
Here's an example to join User with UserProfile using an INNER JOIN and selecting the "bio" column from UserProfile .
3636

3737

38-
```
38+
```julia
3939
query = QueryBuilder.from(User) |> QueryBuilder.select() |> QueryBuilder.join(User, UserProfile, :inner, (:id, :user_id), [:bio])
4040

4141
# SELECT user.id, user.name, user_profile.bio FROM "user" user INNER JOIN "user_profile" user_profile ON user.id = user_profile.user_id
4242
```
4343

4444
Where conditions are expressed as Julia Expr object where you can nest and/or conditions. The condition needs to be expressed as (Model, fieldname, function, params).
4545

46-
```
46+
```julia
4747
query = QueryBuilder.from(User) |> QueryBuilder.select() |> QueryBuilder.where(:(or, (User, name, like, "%mattia%"), (User, id, in, [1, 2, 3]))) |> QueryBuilder.limit(1)
4848
sql, params = QueryBuilder.build(query)
4949

@@ -57,4 +57,4 @@ Modules = [Wasabi.QueryBuilder]
5757

5858
```@autodocs
5959
Modules = [Wasabi.QueryBuilder]
60-
```
60+
```

0 commit comments

Comments
 (0)