Current section

40 Versions

Jump to

Compare versions

18 files changed
+465 additions
-399 deletions
  @@ -4,6 +4,10 @@
4 4 [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/parrot/)
5 5 ![erlang](https://img.shields.io/badge/target-erlang-a2003e)
6 6
7 + > 🚨 **Exciting News**<br />
8 + > Parrot got listed a community project on the sqlc website! 🦜🎉<br />
9 + > Check it out here: https://docs.sqlc.dev/en/latest/reference/language-support.html
10 +
7 11 ## Table of Contents
8 12 - [🦜 Parrot / type-safe SQL in gleam](#)
9 13 * [Features](#features)
  @@ -148,7 +152,7 @@ the nature of your database of choice and sqlc.
148 152 ### Multidimensional Arrays
149 153
150 154 If you have an `INTEGER[][]` column in Postgres, `pg_dump` does not correctly identify
151 - the column as a two-dimensional array and thereby only give you a `List(Int)` instead
155 + the column as a two-dimensional array and therefore only gives you a `List(Int)` instead
152 156 of a `List(List(Int))`. If this is a problem for you, you can raise an issue and
153 157 we might come up with a solution or workaround.
  @@ -1,5 +1,5 @@
1 1 name = "parrot"
2 - version = "2.0.1"
2 + version = "2.1.0"
3 3
4 4 description = "🦜 type-safe SQL in gleam for sqlite, postgresql & mysql"
5 5 licences = ["Apache-2.0"]
  @@ -23,7 +23,7 @@ gleam_json = ">= 3.0.1 and < 4.0.0"
23 23 gleam_time = ">= 1.2.0 and < 2.0.0"
24 24 tom = ">= 2.0.0 and < 3.0.0"
25 25 envoy = ">= 1.0.2 and < 2.0.0"
26 - given = ">= 5.0.4 and < 6.0.0"
26 + given = ">= 6.0.0 and < 7.0.0"
27 27 gleam_http = ">= 4.0.0 and < 5.0.0"
28 28 glearray = ">= 2.1.0 and < 3.0.0"
29 29 repeatedly = ">= 2.1.2 and < 3.0.0"
  @@ -1,6 +1,6 @@
1 1 {<<"name">>, <<"parrot">>}.
2 2 {<<"app">>, <<"parrot">>}.
3 - {<<"version">>, <<"2.0.1">>}.
3 + {<<"version">>, <<"2.1.0">>}.
4 4 {<<"description">>, <<"🦜 type-safe SQL in gleam for sqlite, postgresql & mysql"/utf8>>}.
5 5 {<<"licenses">>, [<<"Apache-2.0">>]}.
6 6 {<<"build_tools">>, [<<"gleam">>]}.
  @@ -8,45 +8,25 @@
8 8 {<<"Repository">>, <<"https://github.com/daniellionel01/parrot">>}
9 9 ]}.
10 10 {<<"requirements">>, [
11 - {<<"gleam_httpc">>, [
12 - {<<"app">>, <<"gleam_httpc">>},
11 + {<<"gleam_stdlib">>, [
12 + {<<"app">>, <<"gleam_stdlib">>},
13 13 {<<"optional">>, false},
14 - {<<"requirement">>, <<">= 5.0.0 and < 6.0.0">>}
14 + {<<"requirement">>, <<">= 0.34.0 and < 2.0.0">>}
15 15 ]},
16 16 {<<"gleam_regexp">>, [
17 17 {<<"app">>, <<"gleam_regexp">>},
18 18 {<<"optional">>, false},
19 19 {<<"requirement">>, <<">= 1.1.1 and < 2.0.0">>}
20 20 ]},
21 - {<<"gleam_crypto">>, [
22 - {<<"app">>, <<"gleam_crypto">>},
21 + {<<"gleam_httpc">>, [
22 + {<<"app">>, <<"gleam_httpc">>},
23 23 {<<"optional">>, false},
24 - {<<"requirement">>, <<">= 1.5.1 and < 2.0.0">>}
24 + {<<"requirement">>, <<">= 5.0.0 and < 6.0.0">>}
25 25 ]},
26 - {<<"given">>, [
27 - {<<"app">>, <<"given">>},
26 + {<<"gleam_json">>, [
27 + {<<"app">>, <<"gleam_json">>},
28 28 {<<"optional">>, false},
29 - {<<"requirement">>, <<">= 5.0.4 and < 6.0.0">>}
30 - ]},
31 - {<<"envoy">>, [
32 - {<<"app">>, <<"envoy">>},
33 - {<<"optional">>, false},
34 - {<<"requirement">>, <<">= 1.0.2 and < 2.0.0">>}
35 - ]},
36 - {<<"filepath">>, [
37 - {<<"app">>, <<"filepath">>},
38 - {<<"optional">>, false},
39 - {<<"requirement">>, <<">= 1.1.0 and < 2.0.0">>}
40 - ]},
41 - {<<"argv">>, [
42 - {<<"app">>, <<"argv">>},
43 - {<<"optional">>, false},
44 - {<<"requirement">>, <<">= 1.0.2 and < 2.0.0">>}
45 - ]},
46 - {<<"gleam_http">>, [
47 - {<<"app">>, <<"gleam_http">>},
48 - {<<"optional">>, false},
49 - {<<"requirement">>, <<">= 4.0.0 and < 5.0.0">>}
29 + {<<"requirement">>, <<">= 3.0.1 and < 4.0.0">>}
50 30 ]},
51 31 {<<"glearray">>, [
52 32 {<<"app">>, <<"glearray">>},
  @@ -58,35 +38,55 @@
58 38 {<<"optional">>, false},
59 39 {<<"requirement">>, <<">= 2.2.0 and < 3.0.0">>}
60 40 ]},
41 + {<<"argv">>, [
42 + {<<"app">>, <<"argv">>},
43 + {<<"optional">>, false},
44 + {<<"requirement">>, <<">= 1.0.2 and < 2.0.0">>}
45 + ]},
46 + {<<"filepath">>, [
47 + {<<"app">>, <<"filepath">>},
48 + {<<"optional">>, false},
49 + {<<"requirement">>, <<">= 1.1.0 and < 2.0.0">>}
50 + ]},
61 51 {<<"exception">>, [
62 52 {<<"app">>, <<"exception">>},
63 53 {<<"optional">>, false},
64 54 {<<"requirement">>, <<">= 2.0.0 and < 3.0.0">>}
65 55 ]},
66 - {<<"tom">>, [
67 - {<<"app">>, <<"tom">>},
56 + {<<"given">>, [
57 + {<<"app">>, <<"given">>},
68 58 {<<"optional">>, false},
69 - {<<"requirement">>, <<">= 2.0.0 and < 3.0.0">>}
59 + {<<"requirement">>, <<">= 6.0.0 and < 7.0.0">>}
60 + ]},
61 + {<<"gleam_time">>, [
62 + {<<"app">>, <<"gleam_time">>},
63 + {<<"optional">>, false},
64 + {<<"requirement">>, <<">= 1.2.0 and < 2.0.0">>}
70 65 ]},
71 66 {<<"repeatedly">>, [
72 67 {<<"app">>, <<"repeatedly">>},
73 68 {<<"optional">>, false},
74 69 {<<"requirement">>, <<">= 2.1.2 and < 3.0.0">>}
75 70 ]},
76 - {<<"gleam_json">>, [
77 - {<<"app">>, <<"gleam_json">>},
71 + {<<"envoy">>, [
72 + {<<"app">>, <<"envoy">>},
78 73 {<<"optional">>, false},
79 - {<<"requirement">>, <<">= 3.0.1 and < 4.0.0">>}
74 + {<<"requirement">>, <<">= 1.0.2 and < 2.0.0">>}
80 75 ]},
81 - {<<"gleam_stdlib">>, [
82 - {<<"app">>, <<"gleam_stdlib">>},
76 + {<<"gleam_http">>, [
77 + {<<"app">>, <<"gleam_http">>},
83 78 {<<"optional">>, false},
84 - {<<"requirement">>, <<">= 0.34.0 and < 2.0.0">>}
79 + {<<"requirement">>, <<">= 4.0.0 and < 5.0.0">>}
85 80 ]},
86 - {<<"gleam_time">>, [
87 - {<<"app">>, <<"gleam_time">>},
81 + {<<"tom">>, [
82 + {<<"app">>, <<"tom">>},
88 83 {<<"optional">>, false},
89 - {<<"requirement">>, <<">= 1.2.0 and < 2.0.0">>}
84 + {<<"requirement">>, <<">= 2.0.0 and < 3.0.0">>}
85 + ]},
86 + {<<"gleam_crypto">>, [
87 + {<<"app">>, <<"gleam_crypto">>},
88 + {<<"optional">>, false},
89 + {<<"requirement">>, <<">= 1.5.1 and < 2.0.0">>}
90 90 ]}
91 91 ]}.
92 92 {<<"files">>, [
  @@ -1,5 +1,5 @@
1 1 {application, parrot, [
2 - {vsn, "2.0.1"},
2 + {vsn, "2.1.0"},
3 3 {applications, [argv,
4 4 envoy,
5 5 exception,
  @@ -54,8 +54,7 @@ cmd_gen(Engine, Db) ->
54 54 ),
55 55 parrot@internal@spinner:start(_pipe@3)
56 56 end,
57 - Download_res = parrot@internal@sqlc:download_binary(),
58 - case Download_res of
57 + _ = case parrot@internal@sqlc:download_binary() of
59 58 {error, _} ->
60 59 parrot@internal@spinner:complete_current(
61 60 Spinner,
  @@ -72,8 +71,7 @@ cmd_gen(Engine, Db) ->
72 71 _pipe@4 = parrot@internal@spinner:new(<<"verifying sqlc binary"/utf8>>),
73 72 parrot@internal@spinner:start(_pipe@4)
74 73 end,
75 - Verify_res = parrot@internal@sqlc:verify_binary(),
76 - case Verify_res of
74 + _ = case parrot@internal@sqlc:verify_binary() of
77 75 {error, _} ->
78 76 parrot@internal@spinner:complete_current(
79 77 Spinner@1,
  @@ -113,12 +111,12 @@ cmd_gen(Engine, Db) ->
113 111 file => <<?FILEPATH/utf8>>,
114 112 module => <<"parrot"/utf8>>,
115 113 function => <<"cmd_gen"/utf8>>,
116 - line => 124,
114 + line => 122,
117 115 value => _assert_fail,
118 - start => 3328,
119 - 'end' => 3419,
120 - pattern_start => 3339,
121 - pattern_end => 3345})
116 + start => 3282,
117 + 'end' => 3373,
118 + pattern_start => 3293,
119 + pattern_end => 3299})
122 120 end,
123 121 Schema@2 = gleam_regexp_ffi:replace(
124 122 Re@1,
  @@ -149,42 +147,26 @@ cmd_gen(Engine, Db) ->
149 147 ),
150 148 parrot@internal@spinner:start(_pipe@6)
151 149 end,
152 - Gen_attempt = parrot@internal@shellout:command(
150 + Gen_result = parrot@internal@shellout:command(
153 151 <<"./sqlc"/utf8>>,
154 152 [<<"generate"/utf8>>],
155 153 Sqlc_dir,
156 154 []
157 155 ),
158 - Gen_attempt@1 = case Gen_attempt of
159 - {error, _} ->
160 - parrot@internal@shellout:command(
161 - <<"sqlc"/utf8>>,
162 - [<<"generate"/utf8>>],
163 - Sqlc_dir,
164 - []
165 - );
166 -
167 - {ok, Val} ->
168 - {ok, Val}
169 - end,
170 - given:ok(
171 - Gen_attempt@1,
172 - fun(Err) ->
173 - {_, Err@1} = Err,
174 - {error, {sqlc_generate_error, Err@1}}
175 - end,
156 + given:error(
157 + Gen_result,
176 158 fun(_) ->
177 159 Project_name = parrot@internal@project:project_name(),
178 160 Config = {config,
179 161 Queries_file,
180 162 <<Project_name/binary, "/sql.gleam"/utf8>>},
181 - Gen_result = parrot@internal@codegen:codegen_from_config(
163 + Gen_result@1 = parrot@internal@codegen:codegen_from_config(
182 164 Config
183 165 ),
184 166 given:ok(
185 - Gen_result,
167 + Gen_result@1,
186 168 fun(_) -> {error, codegen_error} end,
187 - fun(Gen_result@1) ->
169 + fun(Gen_result@2) ->
188 170 parrot@internal@spinner:complete_current(
189 171 Spinner@3,
190 172 parrot@internal@spinner:green_checkmark()
  @@ -205,12 +187,8 @@ cmd_gen(Engine, Db) ->
205 187 parrot@internal@project:root(),
206 188 []
207 189 ),
208 - given:ok(
190 + given:error(
209 191 Stdout_format,
210 - fun(Err@2) ->
211 - {_, Err@3} = Err@2,
212 - {error, {gleam_format_error, Err@3}}
213 - end,
214 192 fun(_) ->
215 193 parrot@internal@spinner:complete_current(
216 194 Spinner@4,
  @@ -218,7 +196,7 @@ cmd_gen(Engine, Db) ->
218 196
219 197 )
220 198 ),
221 - _pipe@8 = erlang:element(2, Gen_result@1),
199 + _pipe@8 = erlang:element(2, Gen_result@2),
222 200 _pipe@9 = gleam@list:unique(_pipe@8),
223 201 gleam@list:each(
224 202 _pipe@9,
  @@ -233,10 +211,18 @@ cmd_gen(Engine, Db) ->
233 211 ),
234 212 gleam_stdlib:println(<<""/utf8>>),
235 213 {ok, nil}
214 + end,
215 + fun(Err) ->
216 + {_, Err@1} = Err,
217 + {error, {gleam_format_error, Err@1}}
236 218 end
237 219 )
238 220 end
239 221 )
222 + end,
223 + fun(Err@2) ->
224 + {_, Err@3} = Err@2,
225 + {error, {sqlc_generate_error, Err@3}}
240 226 end
241 227 )
242 228 end).
  @@ -348,7 +334,7 @@ main() ->
348 334 {error, E@1} ->
349 335 gleam_stdlib:println(
350 336 parrot@internal@lib:red(
351 - <<"Error: "/utf8,
337 + <<"\nError: "/utf8,
352 338 (parrot@internal@errors:err_to_string(
353 339 E@1
354 340 ))/binary>>
Loading more files…