Packages

A delightful ORM (?) for Gleam! 🍳

Current section

2 Versions

Jump to

Compare versions

24 files changed
+1322 additions
-170 deletions
  @@ -5,11 +5,15 @@ Ormlette is a delightful ORM (?) for Gleam. It's features include but are not li
5 5 - A (pretty awesome) schema DSL
6 6 - A powerful query DSL that can be exported to `gleam-cake` Select statements, and used directly with `cake`
7 7 - A CLI to automatically generate easy-use types
8 + - Changesets (like Ecto!)
8 9
9 10 > Ormlette is currently in the very early stages of development, so advice/feature requests/bug reports are super helpful!
10 11
11 12 > [!NOTE]
12 - > THESE DOCS ARE NOT COMPLETE YET!
13 + > THESE DOCS ARE NOT COMPLETE YET! SOME MIGHT BE OUTDATED, IF SOMETHING DOESNT WORK JUST LEAVE AN ISSUE
14 +
15 + ## Installation
16 + run `gleam add ormlette` in your project.
13 17
14 18 ## Schema DSL
15 19
  @@ -28,7 +32,7 @@ pub fn users_table() {
28 32 }
29 33 ```
30 34
31 - To generate everything you need to work with databases, run `gleam run -m ormlette` and look in the `src/eggs` directory.
35 + To generate everything you need to work with databases, run `gleam run -m ormlette -- orm` and look in the `src/eggs` directory.
32 36
33 37 ## Query DSL
  @@ -1,5 +1,5 @@
1 1 name = "ormlette"
2 - version = "1.0.1"
2 + version = "1.0.2"
3 3
4 4 # Fill out these fields if you intend to generate HTML documentation or publish
5 5 # your project to the Hex package manager.
  @@ -13,7 +13,7 @@ repository = { type = "github", user = "ashercn97", repo = "ormlette" }
13 13 # https://gleam.run/writing-gleam/gleam-toml/.
14 14
15 15 [dependencies]
16 - gleam_stdlib = ">= 0.34.0 and < 2.0.0"
16 + gleam_stdlib = ">= 0.40.0 and < 1.0.0"
17 17 cake = ">= 1.1.2 and < 2.0.0"
18 18 simplifile = ">= 2.2.0 and < 3.0.0"
19 19 filepath = ">= 1.0.0 and < 2.0.0"
  @@ -22,6 +22,8 @@ globlin_fs = ">= 2.0.0 and < 3.0.0"
22 22 shellout = ">= 1.6.0 and < 2.0.0"
23 23 decode = ">= 0.2.1 and < 1.0.0"
24 24 gleam_pgo = ">= 0.14.0 and < 1.0.0"
25 + clip = ">= 0.5.0 and < 1.0.0"
26 + argv = ">= 1.0.2 and < 2.0.0"
25 27
26 28 [dev-dependencies]
27 29 gleeunit = ">= 1.0.0 and < 2.0.0"
  @@ -1,6 +1,6 @@
1 1 {<<"name">>, <<"ormlette">>}.
2 2 {<<"app">>, <<"ormlette">>}.
3 - {<<"version">>, <<"1.0.1">>}.
3 + {<<"version">>, <<"1.0.2">>}.
4 4 {<<"description">>, <<"A delightful ORM (?) for Gleam! 🍳"/utf8>>}.
5 5 {<<"licenses">>, [<<"Apache-2.0">>]}.
6 6 {<<"build_tools">>, [<<"gleam">>]}.
  @@ -8,55 +8,67 @@
8 8 {<<"Repository">>, <<"https://github.com/ashercn97/ormlette">>}
9 9 ]}.
10 10 {<<"requirements">>, [
11 - {<<"gleam_stdlib">>, [
12 - {<<"app">>, <<"gleam_stdlib">>},
11 + {<<"filepath">>, [
12 + {<<"app">>, <<"filepath">>},
13 13 {<<"optional">>, false},
14 - {<<"requirement">>, <<">= 0.34.0 and < 2.0.0">>}
15 - ]},
16 - {<<"simplifile">>, [
17 - {<<"app">>, <<"simplifile">>},
18 - {<<"optional">>, false},
19 - {<<"requirement">>, <<">= 2.2.0 and < 3.0.0">>}
20 - ]},
21 - {<<"globlin">>, [
22 - {<<"app">>, <<"globlin">>},
23 - {<<"optional">>, false},
24 - {<<"requirement">>, <<">= 2.0.2 and < 3.0.0">>}
14 + {<<"requirement">>, <<">= 1.0.0 and < 2.0.0">>}
25 15 ]},
26 16 {<<"globlin_fs">>, [
27 17 {<<"app">>, <<"globlin_fs">>},
28 18 {<<"optional">>, false},
29 19 {<<"requirement">>, <<">= 2.0.0 and < 3.0.0">>}
30 20 ]},
21 + {<<"argv">>, [
22 + {<<"app">>, <<"argv">>},
23 + {<<"optional">>, false},
24 + {<<"requirement">>, <<">= 1.0.2 and < 2.0.0">>}
25 + ]},
26 + {<<"cake">>, [
27 + {<<"app">>, <<"cake">>},
28 + {<<"optional">>, false},
29 + {<<"requirement">>, <<">= 1.1.2 and < 2.0.0">>}
30 + ]},
31 + {<<"simplifile">>, [
32 + {<<"app">>, <<"simplifile">>},
33 + {<<"optional">>, false},
34 + {<<"requirement">>, <<">= 2.2.0 and < 3.0.0">>}
35 + ]},
31 36 {<<"shellout">>, [
32 37 {<<"app">>, <<"shellout">>},
33 38 {<<"optional">>, false},
34 39 {<<"requirement">>, <<">= 1.6.0 and < 2.0.0">>}
35 40 ]},
36 - {<<"filepath">>, [
37 - {<<"app">>, <<"filepath">>},
38 - {<<"optional">>, false},
39 - {<<"requirement">>, <<">= 1.0.0 and < 2.0.0">>}
40 - ]},
41 41 {<<"decode">>, [
42 42 {<<"app">>, <<"decode">>},
43 43 {<<"optional">>, false},
44 44 {<<"requirement">>, <<">= 0.2.1 and < 1.0.0">>}
45 45 ]},
46 + {<<"globlin">>, [
47 + {<<"app">>, <<"globlin">>},
48 + {<<"optional">>, false},
49 + {<<"requirement">>, <<">= 2.0.2 and < 3.0.0">>}
50 + ]},
51 + {<<"gleam_stdlib">>, [
52 + {<<"app">>, <<"gleam_stdlib">>},
53 + {<<"optional">>, false},
54 + {<<"requirement">>, <<">= 0.40.0 and < 1.0.0">>}
55 + ]},
56 + {<<"clip">>, [
57 + {<<"app">>, <<"clip">>},
58 + {<<"optional">>, false},
59 + {<<"requirement">>, <<">= 0.5.0 and < 1.0.0">>}
60 + ]},
46 61 {<<"gleam_pgo">>, [
47 62 {<<"app">>, <<"gleam_pgo">>},
48 63 {<<"optional">>, false},
49 64 {<<"requirement">>, <<">= 0.14.0 and < 1.0.0">>}
50 - ]},
51 - {<<"cake">>, [
52 - {<<"app">>, <<"cake">>},
53 - {<<"optional">>, false},
54 - {<<"requirement">>, <<">= 1.1.2 and < 2.0.0">>}
55 65 ]}
56 66 ]}.
57 67 {<<"files">>, [
58 68 <<"README.md">>,
59 69 <<"gleam.toml">>,
70 + <<"include/ormlette@changesets@changesets_Changeset.hrl">>,
71 + <<"include/ormlette@changesets@changesets_FieldError.hrl">>,
60 72 <<"include/ormlette@ir@ir_ColumnIR.hrl">>,
61 73 <<"include/ormlette@ir@ir_ForeignKey.hrl">>,
62 74 <<"include/ormlette@ir@ir_TableIR.hrl">>,
  @@ -68,6 +80,7 @@
68 80 <<"src/ormlette.app.src">>,
69 81 <<"src/ormlette.erl">>,
70 82 <<"src/ormlette.gleam">>,
83 + <<"src/ormlette/changesets/changesets.gleam">>,
71 84 <<"src/ormlette/cli/generate.gleam">>,
72 85 <<"src/ormlette/cli/schema.gleam">>,
73 86 <<"src/ormlette/ir/ir.gleam">>,
  @@ -75,6 +88,8 @@
75 88 <<"src/ormlette/query/helpers.gleam">>,
76 89 <<"src/ormlette/query/query.gleam">>,
77 90 <<"src/ormlette/query/run.gleam">>,
91 + <<"src/ormlette/repo/insert.gleam">>,
92 + <<"src/ormlette/repo/utils.gleam">>,
78 93 <<"src/ormlette/schema/create.gleam">>,
79 94 <<"src/ormlette/templates/decoder_type.gleam">>,
80 95 <<"src/ormlette/templates/generate.gleam">>,
  @@ -82,6 +97,8 @@
82 97 <<"src/ormlette/templates/utils/combine.gleam">>,
83 98 <<"src/ormlette/templates/utils/listy.gleam">>,
84 99 <<"src/ormlette/templates/utils/to_string.gleam">>,
100 + <<"src/ormlette/utils/dynamic.gleam">>,
101 + <<"src/ormlette@changesets@changesets.erl">>,
85 102 <<"src/ormlette@cli@generate.erl">>,
86 103 <<"src/ormlette@cli@schema.erl">>,
87 104 <<"src/ormlette@ir@ir.erl">>,
  @@ -89,11 +106,16 @@
89 106 <<"src/ormlette@query@helpers.erl">>,
90 107 <<"src/ormlette@query@query.erl">>,
91 108 <<"src/ormlette@query@run.erl">>,
109 + <<"src/ormlette@repo@insert.erl">>,
110 + <<"src/ormlette@repo@utils.erl">>,
92 111 <<"src/ormlette@schema@create.erl">>,
93 112 <<"src/ormlette@templates@decoder_type.erl">>,
94 113 <<"src/ormlette@templates@generate.erl">>,
95 114 <<"src/ormlette@templates@tables.erl">>,
96 115 <<"src/ormlette@templates@utils@combine.erl">>,
97 116 <<"src/ormlette@templates@utils@listy.erl">>,
98 - <<"src/ormlette@templates@utils@to_string.erl">>
117 + <<"src/ormlette@templates@utils@to_string.erl">>,
118 + <<"src/ormlette@utils@dynamic.erl">>,
119 + <<"src/ormlette_validate/valid.gleam">>,
120 + <<"src/ormlette_validate@valid.erl">>
99 121 ]}.
  @@ -0,0 +1,6 @@
1 + -record(changeset, {
2 + table :: binary(),
3 + data :: gleam@dict:dict(binary(), gleam@dynamic:dynamic_()),
4 + errors :: list(ormlette@changesets@changesets:error()),
5 + valid :: boolean()
6 + }).
  @@ -0,0 +1 @@
1 + -record(field_error, {field :: binary(), message :: binary()}).
Loading more files…