asobi_repo (asobi v0.35.4)

View Source

Summary

Functions

all(Kura_query)

-spec all(#kura_query{from :: atom() | module() | undefined,
                      select :: [atom() | term()] | {exprs, [term()]},
                      wheres :: [term()],
                      joins :: [term()],
                      order_bys :: [term()],
                      group_bys :: [atom()],
                      havings :: [term()],
                      limit :: non_neg_integer() | undefined,
                      offset :: non_neg_integer() | undefined,
                      distinct :: boolean() | [atom()],
                      lock :: binary() | undefined,
                      prefix :: binary() | undefined,
                      preloads :: [atom() | {atom(), list()}],
                      ctes :: [{binary(), #kura_query{}}],
                      combinations :: [{union | union_all | intersect | except, #kura_query{}}],
                      include_deleted :: boolean()}) ->
             {ok, [map()]} | {error, term()}.

delete(Kura_changeset)

-spec delete(#kura_changeset{valid :: boolean(),
                             schema :: module() | undefined,
                             data :: map(),
                             params :: map(),
                             changes :: map(),
                             errors :: [{atom(), binary()}],
                             types :: #{atom() => kura_types:kura_type()},
                             required :: [atom()],
                             action :: atom() | undefined,
                             constraints ::
                                 [#kura_constraint{type :: unique | foreign_key | check | exclusion,
                                                   constraint :: binary(),
                                                   field :: atom(),
                                                   message :: binary()}],
                             assoc_changes :: #{atom() => #kura_changeset{} | [#kura_changeset{}]},
                             prepare :: [fun((#kura_changeset{}) -> #kura_changeset{})],
                             optimistic_lock :: atom() | undefined}) ->
                {ok, map()} | {error, term()}.

delete(Schema, Record)

-spec delete(module(), map()) -> {ok, map()} | {error, term()}.

delete_all(Kura_query)

-spec delete_all(#kura_query{from :: atom() | module() | undefined,
                             select :: [atom() | term()] | {exprs, [term()]},
                             wheres :: [term()],
                             joins :: [term()],
                             order_bys :: [term()],
                             group_bys :: [atom()],
                             havings :: [term()],
                             limit :: non_neg_integer() | undefined,
                             offset :: non_neg_integer() | undefined,
                             distinct :: boolean() | [atom()],
                             lock :: binary() | undefined,
                             prefix :: binary() | undefined,
                             preloads :: [atom() | {atom(), list()}],
                             ctes :: [{binary(), #kura_query{}}],
                             combinations :: [{union | union_all | intersect | except, #kura_query{}}],
                             include_deleted :: boolean()}) ->
                    {ok, non_neg_integer()} | {error, term()}.

exists(Kura_query)

-spec exists(#kura_query{from :: atom() | module() | undefined,
                         select :: [atom() | term()] | {exprs, [term()]},
                         wheres :: [term()],
                         joins :: [term()],
                         order_bys :: [term()],
                         group_bys :: [atom()],
                         havings :: [term()],
                         limit :: non_neg_integer() | undefined,
                         offset :: non_neg_integer() | undefined,
                         distinct :: boolean() | [atom()],
                         lock :: binary() | undefined,
                         prefix :: binary() | undefined,
                         preloads :: [atom() | {atom(), list()}],
                         ctes :: [{binary(), #kura_query{}}],
                         combinations :: [{union | union_all | intersect | except, #kura_query{}}],
                         include_deleted :: boolean()}) ->
                {ok, boolean()} | {error, term()}.

get(Schema, Id)

-spec get(module(), term()) -> {ok, map()} | {error, term()}.

insert(Kura_changeset)

-spec insert(#kura_changeset{valid :: boolean(),
                             schema :: module() | undefined,
                             data :: map(),
                             params :: map(),
                             changes :: map(),
                             errors :: [{atom(), binary()}],
                             types :: #{atom() => kura_types:kura_type()},
                             required :: [atom()],
                             action :: atom() | undefined,
                             constraints ::
                                 [#kura_constraint{type :: unique | foreign_key | check | exclusion,
                                                   constraint :: binary(),
                                                   field :: atom(),
                                                   message :: binary()}],
                             assoc_changes :: #{atom() => #kura_changeset{} | [#kura_changeset{}]},
                             prepare :: [fun((#kura_changeset{}) -> #kura_changeset{})],
                             optimistic_lock :: atom() | undefined}) ->
                {ok, map()} | {error, term()}.

insert(Kura_changeset, Opts)

-spec insert(#kura_changeset{valid :: boolean(),
                             schema :: module() | undefined,
                             data :: map(),
                             params :: map(),
                             changes :: map(),
                             errors :: [{atom(), binary()}],
                             types :: #{atom() => kura_types:kura_type()},
                             required :: [atom()],
                             action :: atom() | undefined,
                             constraints ::
                                 [#kura_constraint{type :: unique | foreign_key | check | exclusion,
                                                   constraint :: binary(),
                                                   field :: atom(),
                                                   message :: binary()}],
                             assoc_changes :: #{atom() => #kura_changeset{} | [#kura_changeset{}]},
                             prepare :: [fun((#kura_changeset{}) -> #kura_changeset{})],
                             optimistic_lock :: atom() | undefined},
             map()) ->
                {ok, map()} | {error, term()}.

insert_all(Schema, Entries)

-spec insert_all(module(), [map()]) -> {ok, non_neg_integer()} | {error, term()}.

multi(M)

-spec multi(term()) -> {ok, map()} | {error, atom(), term(), map()}.

otp_app()

-spec otp_app() -> asobi.

preload(Schema, Records, Assocs)

-spec preload(module(), map() | [map()], [atom()]) -> map() | [map()].

reload(Schema, Record)

-spec reload(module(), map()) -> {ok, map()} | {error, term()}.

transaction(Fun)

-spec transaction(fun()) -> term().

update(Kura_changeset)

-spec update(#kura_changeset{valid :: boolean(),
                             schema :: module() | undefined,
                             data :: map(),
                             params :: map(),
                             changes :: map(),
                             errors :: [{atom(), binary()}],
                             types :: #{atom() => kura_types:kura_type()},
                             required :: [atom()],
                             action :: atom() | undefined,
                             constraints ::
                                 [#kura_constraint{type :: unique | foreign_key | check | exclusion,
                                                   constraint :: binary(),
                                                   field :: atom(),
                                                   message :: binary()}],
                             assoc_changes :: #{atom() => #kura_changeset{} | [#kura_changeset{}]},
                             prepare :: [fun((#kura_changeset{}) -> #kura_changeset{})],
                             optimistic_lock :: atom() | undefined}) ->
                {ok, map()} | {error, term()}.

update_all(Kura_query, Updates)

-spec update_all(#kura_query{from :: atom() | module() | undefined,
                             select :: [atom() | term()] | {exprs, [term()]},
                             wheres :: [term()],
                             joins :: [term()],
                             order_bys :: [term()],
                             group_bys :: [atom()],
                             havings :: [term()],
                             limit :: non_neg_integer() | undefined,
                             offset :: non_neg_integer() | undefined,
                             distinct :: boolean() | [atom()],
                             lock :: binary() | undefined,
                             prefix :: binary() | undefined,
                             preloads :: [atom() | {atom(), list()}],
                             ctes :: [{binary(), #kura_query{}}],
                             combinations :: [{union | union_all | intersect | except, #kura_query{}}],
                             include_deleted :: boolean()},
                 map()) ->
                    {ok, non_neg_integer()} | {error, term()}.