Skip to content

Commit

Permalink
feat: move to erlandono (#81)
Browse files Browse the repository at this point in the history
* feat: (server) move to erlandono and ignore types related to postgres_m
  • Loading branch information
schonfinkel authored Jan 28, 2025
1 parent 52d8c23 commit 917f080
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 30 deletions.
9 changes: 7 additions & 2 deletions server/apps/server/src/registry.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

-compile({parse_transform, do}).

-spec check_user(map(), epgsql:connection()) -> Result
when Email :: string(),
%% TODO: fix this type
-dialyzer({nowarn_function, [check_user/2]}).

-spec check_user(Map, epgsql:connection()) -> Result
when
Map :: #{'password':=_, 'username':=_, _=>_},
Email :: string(),
Message :: string(),
Result :: {ok, Email} | {ok, any(), any()} | {ok, any(), any(), any()} | {error, Message}.
check_user(#{username := Username, password := Password}, Connection) ->
Expand Down
2 changes: 1 addition & 1 deletion server/apps/server/src/server.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
sasl,
csv,
epgsql,
erlando
erlandono
]},
{env, []},
{modules, []},
Expand Down
2 changes: 1 addition & 1 deletion server/lib/database/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
{deps, [
{pure_migrations, "1.3.0"},
{epgsql, "4.7.1"},
{erlando, "3.1.1"}
{erlandono, "3.1.3"}
]}.
2 changes: 1 addition & 1 deletion server/lib/database/src/database.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
stdlib,
epgsql,
sasl,
erlando
erlandono
]},
{env, []},
{modules, [database, database_utils, postgres_m]},
Expand Down
21 changes: 12 additions & 9 deletions server/lib/database/src/postgres_m.erl
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
-module(postgres_m).

%% TODO: Create our own behaviour that has better epgsql types
%% to feed it into return, fail and >>=.
-behaviour(monad).

-export(['>>='/2, return/1, fail/1]).

-dialyzer({nowarn_function, '>>='/2}).
%% TODO: fix these types
-dialyzer({nowarn_function, ['>>='/2, return/1, fail/1]}).

%-type monad(_A) ::
% {{ok, any(), any()}, select} |
% {{ok, any()}, delete} |
% {{ok, any()}, insert} |
% {{ok, any(), any(), any()}, insert} |
% {{ok, any()}, update} |
% {{error, any()}, any()}.
-type monad(_A) ::
{{ok, any(), any()}, select} |
{{ok, any()}, delete} |
{{ok, any()}, insert} |
{{ok, any(), any(), any()}, insert} |
{{ok, any()}, update} |
{{error, any()}, any()}.

%-include_lib("erlando/include/monad_specs.hrl").
-include_lib("erlandono/include/monad_specs.hrl").

return(X) ->
{ok, X}.
Expand Down
25 changes: 13 additions & 12 deletions server/rebar-deps.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Generated by rebar3_nix
let
fetchOnly = { src, ... }: src;
in
{
builder ? fetchOnly,
fetchHex,
fetchgit,
fetchFromGitHub,
overrides ? (x: y: { }),
}:
let fetchOnly = { src, ... }: src;
in { builder ? fetchOnly, fetchHex, fetchgit, fetchFromGitHub, overrides ? (x: y: { }) }:
let
self = packages // (overrides self packages);
packages = with self; {
Expand All @@ -32,6 +24,16 @@ let
};
beamDeps = [ ];
};
erlandono = builder {
name = "erlandono";
version = "3.1.3";
src = fetchHex {
pkg = "erlandono";
version = "3.1.3";
sha256 = "sha256-K/yvZZwAMsW1zv1ILrvbohqyAdFXmlRIXgkZX8IJJXc=";
};
beamDeps = [ ];
};
erlando = builder {
name = "erlando";
version = "3.1.1";
Expand Down Expand Up @@ -63,5 +65,4 @@ let
beamDeps = [ pc ];
};
};
in
self
in self
2 changes: 1 addition & 1 deletion server/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{deps, [
{epgsql, "4.7.1"},
{pc, "1.15.0"},
{erlando, "3.1.1"},
{erlandono, "3.1.3"},
{csv, "3.0.3", {pkg, csve}}
]}.

Expand Down
6 changes: 3 additions & 3 deletions server/rebar.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{"1.2.0",
[{<<"csv">>,{pkg,<<"csve">>,<<"3.0.3">>},0},
{<<"epgsql">>,{pkg,<<"epgsql">>,<<"4.7.1">>},0},
{<<"erlando">>,{pkg,<<"erlando">>,<<"3.1.1">>},0},
{<<"erlandono">>,{pkg,<<"erlandono">>,<<"3.1.3">>},0},
{<<"pc">>,{pkg,<<"pc">>,<<"1.15.0">>},0},
{<<"pure_migrations">>,{pkg,<<"pure_migrations">>,<<"1.3.0">>},0}]}.
[
{pkg_hash,[
{<<"csv">>, <<"69E7D9B3FDC72016644368762C6A3E6CBFEB85BCCADBF1BD99AB6C827E360E04">>},
{<<"epgsql">>, <<"D4E47CAE46C18C8AFA88E34D59A9B4BAE16368D7CE1EB3DA24FA755EB28393EB">>},
{<<"erlando">>, <<"50E54F9A9DFEC564DDFEB7FC7129F80F491856F5E07686F405CEF4E970BDFE46">>},
{<<"erlandono">>, <<"8B5562D3DDC3A89EB513973D727B585513DC0A3A95E65A0E343957DD0ED655B9">>},
{<<"pc">>, <<"0DE7D4DF1BB23897E27965FC134DC63156DD2E5B512A9536CB7004D984400A45">>},
{<<"pure_migrations">>, <<"B758A62A9EDD6C1B40B668F4D6CE9E5588DBD4D99A4469BCE46BC7089B594AF7">>}]},
{pkg_hash_ext,[
{<<"csv">>, <<"741D1A55AABADAA3E0FE13051050101A73E90C4570B9F9403A939D9546813521">>},
{<<"epgsql">>, <<"B6D86B7DC42C8555B1D4E20880E5099D6D6D053148000E188E548F98E4E01836">>},
{<<"erlando">>, <<"9633CB4978DBD78827FA76EA4C3B0BD24CFBD4DD9AF48088E922E7115494A344">>},
{<<"erlandono">>, <<"2BFCAF659C0032C5B5CEFD482EBBDBA21AB201D1579A54485E09195FC2092577">>},
{<<"pc">>, <<"4C0FAD4F6437CAE353D517DA218FE78347B8FFA44B9817887494CAAAE54595B3">>},
{<<"pure_migrations">>, <<"00269DE0A1A9BBE1B7681EC1F3FA59EE9D8081582226A94C633E6F94B5C88BC3">>}]}
].

0 comments on commit 917f080

Please sign in to comment.