From 82592549b85082118054851e6b8cb586a259f5b6 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:55:37 -0700 Subject: [PATCH 1/6] add julia formatting to doc --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 225de71..088efc4 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -7,7 +7,7 @@ CurrentModule = Wasabi Wasabi is a simple ORM for Julia. It currently supports PostgreSQL and SQLite. 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. -``` +```julia using Wasabi using SQLite From 2ee81fa2709ba13452936f6cf877a775193dd266 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:56:21 -0700 Subject: [PATCH 2/6] Update customtype.md --- docs/src/customtype.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/customtype.md b/docs/src/customtype.md index e330f60..d837ce9 100644 --- a/docs/src/customtype.md +++ b/docs/src/customtype.md @@ -10,7 +10,7 @@ You can implement a new custom type just implementing some functions. Suppose you want to create a JSON type called CustomType that is converted as TEXT on the database. -``` +```julia using SQLite struct CustomType @@ -30,4 +30,4 @@ model = TestModel(1, CustomType(Dict("key" => "value"))) Wasabi.insert!(conn, model) model = Wasabi.first(conn, TestModel, 1) # model.custom.value["key"] == "value" -``` \ No newline at end of file +``` From 296d6e885db251770ecf05e689aa00c1138b234a Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:56:38 -0700 Subject: [PATCH 3/6] Update index.md --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 225de71..088efc4 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -7,7 +7,7 @@ CurrentModule = Wasabi Wasabi is a simple ORM for Julia. It currently supports PostgreSQL and SQLite. 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. -``` +```julia using Wasabi using SQLite From 96e29e8d9021063684b096ca6538f32939e406e9 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:56:54 -0700 Subject: [PATCH 4/6] Update migrations.md --- docs/src/migrations.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/migrations.md b/docs/src/migrations.md index 1aa1d87..1e407f0 100644 --- a/docs/src/migrations.md +++ b/docs/src/migrations.md @@ -4,7 +4,7 @@ Migrations are an easy way to keep track of database schema updates. This will generate a folder containing the first migration which create the migration table and keep track of the current status of the database. -``` +```julia using Wasbi path = "migrations/" @@ -12,10 +12,10 @@ Migrations.generate(path) ``` Next you can update (upgrade/downgrade) the database to the required version doing -``` +```julia using Wasbi using SQLite version = "xxx" # using Migrations.get_last_version(path) gives you the latest available migration Migrations.execute(db, path, version) -``` \ No newline at end of file +``` From 7995513d380b4174b1f1e3f80319bcfabb1a81e1 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:57:12 -0700 Subject: [PATCH 5/6] Update querybuilder.md --- docs/src/querybuilder.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/querybuilder.md b/docs/src/querybuilder.md index 0b0c237..7513717 100644 --- a/docs/src/querybuilder.md +++ b/docs/src/querybuilder.md @@ -5,7 +5,7 @@ CurrentModule = Wasabi.QueryBuilder # QueryBuilder You can use QueryBuilder to create and execute a query in a simple and fast way. -``` +```julia using Wasabi using SQLite @@ -25,7 +25,7 @@ QueryBuilder supports select, join, where, limit, offset, group by and order by. 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. -``` +```julia QueryBuilder.from(User) |> QueryBuilder.select() # Select all fields from user model QueryBuilder.from(User) |> QueryBuilder.select([:id, :name]) # SELECT user_alias.id, user_alias.name FROM user user_alias QueryBuilder.from(User) |> QueryBuilder.select(User, :id, :total, :count) # SELECT COUNT(user_alias.id) AS total FROM user user_alias @@ -35,7 +35,7 @@ Join are expressed using source, target, type (inner, outer ...), on, select. Here's an example to join User with UserProfile using an INNER JOIN and selecting the "bio" column from UserProfile . -``` +```julia query = QueryBuilder.from(User) |> QueryBuilder.select() |> QueryBuilder.join(User, UserProfile, :inner, (:id, :user_id), [:bio]) # SELECT user.id, user.name, user_profile.bio FROM "user" user INNER JOIN "user_profile" user_profile ON user.id = user_profile.user_id @@ -43,7 +43,7 @@ query = QueryBuilder.from(User) |> QueryBuilder.select() |> QueryBuilder.join(Us 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). -``` +```julia query = QueryBuilder.from(User) |> QueryBuilder.select() |> QueryBuilder.where(:(or, (User, name, like, "%mattia%"), (User, id, in, [1, 2, 3]))) |> QueryBuilder.limit(1) sql, params = QueryBuilder.build(query) @@ -57,4 +57,4 @@ Modules = [Wasabi.QueryBuilder] ```@autodocs Modules = [Wasabi.QueryBuilder] -``` \ No newline at end of file +``` From ca1fadf08c5239173b6a46391209f8e70c374fe6 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Wed, 3 Apr 2024 09:58:53 -0700 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3bed7e..ad91687 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Wasabi is a simple yet powerful ORM for the Julia Language. It currently support ### Getting Started -``` +```julia using Wasabi using SQLite