Skip to content

Commit b47a599

Browse files
inoasinoas
andauthored
add date support, still one bug on postgres/pog (#24)
* add date support, still one bug on postgres/pog * split tests * fix workflow * min gleam vers --------- Co-authored-by: inoas <{ID}+{username}@users.noreply.github.com>
1 parent 75a3cf3 commit b47a599

46 files changed

Lines changed: 2008 additions & 222 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/abstract_test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ name: Test
33
on:
44
workflow_call:
55
inputs:
6+
gleam_format_version:
7+
type: string
8+
required: true
9+
default: "1.13.0"
610
gleam_version:
711
type: string
812
required: true
9-
default: "1.11.1"
13+
default: "1.11.0"
1014
erlang_version:
1115
type: string
1216
default: "27"
@@ -24,7 +28,7 @@ jobs:
2428
- uses: actions/checkout@v4
2529
- uses: inoas/gleam_actions/.github/actions/install_gleam@main-on-upstream
2630
with:
27-
gleam_version: ${{inputs.gleam_version}}
31+
gleam_version: ${{inputs.gleam_format_version}}
2832
erlang_version: ${{inputs.erlang_version}}
2933
- uses: inoas/gleam_actions/.github/actions/format@main-on-upstream
3034

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ jobs:
1212
uses: ./.github/workflows/abstract_test.yml
1313
with:
1414
erlang_version: "27"
15-
gleam_version: "1.11.1"
15+
gleam_format_version: "1.13.0"
16+
gleam_version: "1.11.0"
1617
test_erlang: true
1718
test_node: false
1819
test_highest:
1920
uses: ./.github/workflows/abstract_test.yml
2021
with:
2122
erlang_version: "28"
22-
gleam_version: "1.11.1"
23+
gleam_format_version: "1.13.0"
24+
gleam_version: "1.13.0"
2325
test_erlang: true
2426
test_node: false

.tool-versions

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
erlang 28.0.2
2-
gleam 1.11.1
1+
erlang 27.3.4.3
2+
#erlang 28.0.2
3+
#rebar 3.24.0
4+
gleam 1.13.0

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
77
## [Unreleased]
88
-->
99

10+
## [2.2.0] - 2025-10-31
11+
12+
- Add `Date` support based on `gleam_time`'s `calendar.Date`.
13+
1014
## [2.1.3] - 2025-07-28
1115

1216
- Fix demos to use recent dynamic decoders and library versions.
Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
---
2-
version: 1.2.6
2+
version: 1.4.1
33
title: combined_intersect_execution_result_test
44
file: ./test/cake_test/combined_test.gleam
55
test_name: combined_intersect_execution_result_test
66
---
77
#(
8-
Ok([#("Ginny", 6, False, 3, Null)]),
9-
Ok([#("Ginny", 6, 0, 3, Undefined)]),
10-
Ok([#("Ginny", 6, 0, 3, Null)]),
11-
Ok([#("Ginny", 6, 0, 3, Null)]),
12-
)
8+
Ok([
9+
#("Ginny", 6, False, 3, Null, Null),
10+
]),
11+
Ok([
12+
#(
13+
"Ginny",
14+
6,
15+
0,
16+
3,
17+
Undefined,
18+
Undefined,
19+
),
20+
]),
21+
Ok([#("Ginny", 6, 0, 3, Null, Null)]),
22+
Ok([#("Ginny", 6, 0, 3, Null, Null)]),
23+
)
Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
11
---
2-
version: 1.2.6
2+
version: 1.4.1
33
title: combined_limit_offset_execution_result_test
44
file: ./test/cake_test/limit_offset_test.gleam
55
test_name: combined_limit_offset_execution_result_test
66
---
77
#(
8-
Ok([#("Clara", 3, True, Null, 10.0)]),
9-
Ok([#("Clara", 3, 1, Undefined, 10.0)]),
10-
Ok([#("Clara", 3, 1, Null, 10.0)]),
11-
Ok([#("Clara", 3, 1, Null, 10.0)]),
12-
)
8+
Ok([
9+
#(
10+
"Clara",
11+
3,
12+
True,
13+
Null,
14+
10.0,
15+
#(2021, 4, 13),
16+
),
17+
]),
18+
Ok([
19+
#(
20+
"Clara",
21+
3,
22+
1,
23+
Undefined,
24+
10.0,
25+
"2021-04-13",
26+
),
27+
]),
28+
Ok([
29+
#(
30+
"Clara",
31+
3,
32+
1,
33+
Null,
34+
10.0,
35+
#(2021, 4, 13),
36+
),
37+
]),
38+
Ok([
39+
#(
40+
"Clara",
41+
3,
42+
1,
43+
Null,
44+
10.0,
45+
#(2021, 4, 13),
46+
),
47+
]),
48+
)
Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: 1.2.6
2+
version: 1.4.1
33
title: combined_union_all_execution_result_test
44
file: ./test/cake_test/combined_test.gleam
55
test_name: combined_union_all_execution_result_test
@@ -12,9 +12,37 @@ test_name: combined_union_all_execution_result_test
1212
True,
1313
1,
1414
2.200000047683716,
15+
#(2000, 1, 1),
1516
),
1617
]),
17-
Ok([#("Nubi", 4, 1, 1, 2.2)]),
18-
Ok([#("Nubi", 4, 1, 1, 2.2)]),
19-
Ok([#("Nubi", 4, 1, 1, 2.2)]),
20-
)
18+
Ok([
19+
#(
20+
"Nubi",
21+
4,
22+
1,
23+
1,
24+
2.2,
25+
"2000-01-01",
26+
),
27+
]),
28+
Ok([
29+
#(
30+
"Nubi",
31+
4,
32+
1,
33+
1,
34+
2.2,
35+
#(2000, 1, 1),
36+
),
37+
]),
38+
Ok([
39+
#(
40+
"Nubi",
41+
4,
42+
1,
43+
1,
44+
2.2,
45+
#(2000, 1, 1),
46+
),
47+
]),
48+
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
version: 1.4.1
3+
title: date_execution_result_test
4+
file: ./test/cake_test/date_test.gleam
5+
test_name: date_execution_result_test
6+
---
7+
#(
8+
Ok([
9+
#(
10+
"Karl",
11+
8,
12+
True,
13+
Null,
14+
10.0,
15+
#(2016, 2, 19),
16+
),
17+
#(
18+
"Clara",
19+
3,
20+
True,
21+
Null,
22+
10.0,
23+
#(2021, 4, 13),
24+
),
25+
]),
26+
Ok([
27+
#("2016-02-19", "2016-02-19"),
28+
#("2021-04-13", "2016-02-19"),
29+
]),
30+
Ok([
31+
#(#(2016, 2, 19), "2016-02-19"),
32+
#(#(2021, 4, 13), "2016-02-19"),
33+
]),
34+
Ok([
35+
#(#(2016, 2, 19), "2016-02-19"),
36+
#(#(2021, 4, 13), "2016-02-19"),
37+
]),
38+
)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
version: 1.4.1
3+
title: date_pog_test
4+
file: ./test/cake_test/date_test.gleam
5+
test_name: date_pog_test
6+
---
7+
SelectQuery(Select(
8+
SelectAll,
9+
NoSelects,
10+
FromTable("cats"),
11+
NoJoins,
12+
OrWhere([
13+
WhereComparison(
14+
WhereColumnValue("birthday"),
15+
Equal,
16+
WhereParamValue(DateParam(Date(
17+
2016,
18+
February,
19+
19,
20+
))),
21+
),
22+
WhereBetween(
23+
WhereColumnValue("birthday"),
24+
WhereParamValue(DateParam(Date(
25+
2021,
26+
April,
27+
12,
28+
))),
29+
WhereParamValue(DateParam(Date(
30+
2021,
31+
April,
32+
14,
33+
))),
34+
),
35+
]),
36+
NoGroupBy,
37+
NoWhere,
38+
NoOrderBy,
39+
NoLimit,
40+
NoOffset,
41+
NoEpilog,
42+
NoComment,
43+
))
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
version: 1.4.1
3+
title: date_prepared_statement_test
4+
file: ./test/cake_test/date_test.gleam
5+
test_name: date_prepared_statement_test
6+
---
7+
#(
8+
PreparedStatement(
9+
"$",
10+
"SELECT * FROM cats WHERE (birthday = $1 OR birthday BETWEEN $2 AND $3)",
11+
[
12+
DateParam(Date(2016, February, 19)),
13+
DateParam(Date(2021, April, 12)),
14+
DateParam(Date(2021, April, 14)),
15+
],
16+
3,
17+
Postgres,
18+
),
19+
PreparedStatement(
20+
"?",
21+
"SELECT birthday AS kids_birthday, ?1 AS kbirthday FROM cats WHERE (birthday = ?2 OR birthday BETWEEN ?3 AND ?4)",
22+
[
23+
DateParam(Date(2016, February, 19)),
24+
DateParam(Date(2016, February, 19)),
25+
DateParam(Date(2021, April, 12)),
26+
DateParam(Date(2021, April, 14)),
27+
],
28+
4,
29+
Sqlite,
30+
),
31+
PreparedStatement(
32+
"?",
33+
"SELECT birthday AS kids_birthday, ? AS kbirthday FROM cats WHERE (birthday = ? OR birthday BETWEEN ? AND ?)",
34+
[
35+
DateParam(Date(2016, February, 19)),
36+
DateParam(Date(2016, February, 19)),
37+
DateParam(Date(2021, April, 12)),
38+
DateParam(Date(2021, April, 14)),
39+
],
40+
4,
41+
Maria,
42+
),
43+
PreparedStatement(
44+
"?",
45+
"SELECT birthday AS kids_birthday, ? AS kbirthday FROM cats WHERE (birthday = ? OR birthday BETWEEN ? AND ?)",
46+
[
47+
DateParam(Date(2016, February, 19)),
48+
DateParam(Date(2016, February, 19)),
49+
DateParam(Date(2021, April, 12)),
50+
DateParam(Date(2021, April, 14)),
51+
],
52+
4,
53+
Mysql,
54+
),
55+
)

0 commit comments

Comments
 (0)