-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 03c98f0
Showing
23 changed files
with
4,275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: "26.0.2" | ||
gleam-version: "1.4.0-rc1" | ||
rebar3-version: "3" | ||
# elixir-version: "1.15.4" | ||
- run: gleam deps download | ||
- run: gleam test | ||
- run: gleam format --check src test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.beam | ||
*.ez | ||
/build | ||
erl_crash.dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# squirrel | ||
|
||
[](https://hex.pm/packages/squirrel) | ||
[](https://hexdocs.pm/squirrel/) | ||
|
||
```gleam | ||
import squirrel | ||
pub fn main() { | ||
// TODO: An example of the project in use | ||
} | ||
``` | ||
|
||
Further documentation can be found at <https://hexdocs.pm/squirrel>. | ||
|
||
## Development | ||
|
||
```sh | ||
gleam run # Run the project | ||
gleam test # Run the tests | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: bool decoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: bool_decoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: Bool) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.bool) | ||
|
||
"select true as res" | ||
|> pgo.execute(db, [], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: bool encoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: bool_encoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: Bool) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db, arg_1) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.bool) | ||
|
||
"select true as res where $1 = true" | ||
|> pgo.execute(db, [pgo.bool(arg_1)], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: int decoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: int_decoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: Int) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.int) | ||
|
||
"select 11 as res" | ||
|> pgo.execute(db, [], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: int encoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: int_encoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: Bool) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db, arg_1) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.bool) | ||
|
||
"select true as res where $1 = 11" | ||
|> pgo.execute(db, [pgo.int(arg_1)], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
version: 1.1.8 | ||
title: query with comment | ||
file: ./test/squirrel_test.gleam | ||
test_name: query_with_comment_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(name: String, acorns: Option(Int)) | ||
} | ||
|
||
/// This is a comment | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db) { | ||
let decoder = | ||
decode.into({ | ||
use name <- decode.parameter | ||
use acorns <- decode.parameter | ||
QueryRow(name: name, acorns: acorns) | ||
}) | ||
|> decode.field(0, decode.string) | ||
|> decode.field(1, decode.optional(decode.int)) | ||
|
||
" | ||
-- This is a comment | ||
select * from squirrel | ||
" | ||
|> pgo.execute(db, [], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
version: 1.1.8 | ||
title: query with multiline comment | ||
file: ./test/squirrel_test.gleam | ||
test_name: query_with_multiline_comment_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(name: String, acorns: Option(Int)) | ||
} | ||
|
||
/// This is a comment | ||
/// that goes over multiple lines! | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db) { | ||
let decoder = | ||
decode.into({ | ||
use name <- decode.parameter | ||
use acorns <- decode.parameter | ||
QueryRow(name: name, acorns: acorns) | ||
}) | ||
|> decode.field(0, decode.string) | ||
|> decode.field(1, decode.optional(decode.int)) | ||
|
||
" | ||
-- This is a comment | ||
-- that goes over multiple lines! | ||
select * from squirrel | ||
" | ||
|> pgo.execute(db, [], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: string decoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: string_decoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: String) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.string) | ||
|
||
"select 'wibble' as res" | ||
|> pgo.execute(db, [], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
version: 1.1.8 | ||
title: string encoding | ||
file: ./test/squirrel_test.gleam | ||
test_name: string_encoding_test | ||
--- | ||
/// A row you get from running the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This type definition was generated automatically using v-test of the | ||
/// > [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub type QueryRow { | ||
QueryRow(res: Bool) | ||
} | ||
|
||
/// Runs the `query` query | ||
/// defined in `file.sql`. | ||
/// | ||
/// > 🐿️ This function was generated automatically using v-test of | ||
/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel). | ||
/// | ||
pub fn query(db, arg_1) { | ||
let decoder = | ||
decode.into({ | ||
use res <- decode.parameter | ||
QueryRow(res: res) | ||
}) | ||
|> decode.field(0, decode.bool) | ||
|
||
"select true as res where $1 = 'wibble'" | ||
|> pgo.execute(db, [pgo.text(arg_1)], decode.from(decoder, _)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name = "squirrel" | ||
version = "0.1.0" | ||
description = "🐿️ Type safe SQL in Gleam" | ||
licences = ["Apache-2.0"] | ||
repository = { type = "github", user = "giacomocavalieri", repo = "squirrel" } | ||
|
||
[dependencies] | ||
gleam_stdlib = ">= 0.34.0 and < 2.0.0" | ||
simplifile = ">= 2.0.1 and < 3.0.0" | ||
eval = ">= 1.0.0 and < 2.0.0" | ||
gleam_json = ">= 1.0.0 and < 2.0.0" | ||
mug = ">= 1.1.0 and < 2.0.0" | ||
glam = ">= 2.0.1 and < 3.0.0" | ||
justin = ">= 1.0.1 and < 2.0.0" | ||
filepath = ">= 1.0.0 and < 2.0.0" | ||
gleam_community_ansi = ">= 1.4.0 and < 2.0.0" | ||
term_size = ">= 1.0.1 and < 2.0.0" | ||
argv = ">= 1.0.2 and < 2.0.0" | ||
envoy = ">= 1.0.1 and < 2.0.0" | ||
|
||
[dev-dependencies] | ||
gleeunit = ">= 1.0.0 and < 2.0.0" | ||
birdie = ">= 1.1.8 and < 2.0.0" | ||
temporary = ">= 1.0.0 and < 2.0.0" | ||
gleam_pgo = ">= 0.13.0 and < 1.0.0" |
Oops, something went wrong.