Fulib v0.1.3 Fulib View Source

Documentation for Fulib.

Link to this section Summary

Functions

不让value大于max_value

不让value小于min_value

不让value小于min_value, 大于max_value

如果条件符合的时候,执行true_fn方法,否则返回自己。 eg: queryable |> Fulib.if_call(not is_nil(params[:age]), fn queryable -> Ecto.Query.where(queryable, age: params[:age]) end) |> Fulib.if_call(not is_nil(params[:name]), fn queryable -> Ecto.Query.where(queryable, name: params[:name]) end)

如果条件不符合的时候,执行false_fn方法,否则返回自己。 eg: queryable |> Fulib.not_call(is_nil(params[:age]), fn queryable -> Ecto.Query.where(queryable, age: params[:age]) end) |> Fulib.not_call(is_nil(params[:name]), fn queryable -> Ecto.Query.where(queryable, name: params[:name]) end)

Link to this section Functions

Link to this function

as_max(value, max_value) View Source

不让value大于max_value

Link to this function

as_min(value, min_value) View Source

不让value小于min_value

Link to this function

as_range(value, min_value, max_value) View Source

不让value小于min_value, 大于max_value

Link to this function

bench_log(args, call_fn) View Source

Link to this function

compact(list \\ [], opts \\ []) View Source

Link to this macro

cond_pipe(q, list) View Source (macro)

Link to this function

from_json(term, options \\ []) View Source

Link to this function

from_yaml(term, opts \\ []) View Source

Link to this function

get(map_or_list, key, default \\ nil, when_nil \\ nil) View Source

Link to this function

get_in(data, keys, when_nil) View Source

Link to this function

get_or(map_or_list, keys, default \\ nil, when_nil \\ nil) View Source

Link to this function

handle_empty(value, fill \\ "-") View Source

Link to this function

hmac_sha256(secret, value) View Source

Link to this function

hmac_sha512(secret, value) View Source

Link to this function

i18n(msgid, bindings \\ %{}) View Source

Link to this function

if_call(q, condition \\ true, true_fn) View Source

如果条件符合的时候,执行true_fn方法,否则返回自己。 eg: queryable |> Fulib.if_call(not is_nil(params[:age]), fn queryable -> Ecto.Query.where(queryable, age: params[:age]) end) |> Fulib.if_call(not is_nil(params[:name]), fn queryable -> Ecto.Query.where(queryable, name: params[:name]) end)

Link to this function

in_groups_of(list, key, opts \\ []) View Source

Link to this function

log(info \\ nil, opts \\ []) View Source

Link to this function

log_debug(info \\ nil, opts \\ []) View Source

Link to this function

log_error(info \\ nil, opts \\ []) View Source

Link to this function

log_exception(exception \\ nil, opts \\ []) View Source

Link to this function

log_info(info \\ nil, opts \\ []) View Source

Link to this function

log_inspect(info \\ nil, opts \\ []) View Source

Link to this function

log_warn(info \\ nil, opts \\ []) View Source

Link to this function

merge(original, initial) View Source

Link to this function

not_call(q, condition \\ false, false_fn) View Source

如果条件不符合的时候,执行false_fn方法,否则返回自己。 eg: queryable |> Fulib.not_call(is_nil(params[:age]), fn queryable -> Ecto.Query.where(queryable, age: params[:age]) end) |> Fulib.not_call(is_nil(params[:name]), fn queryable -> Ecto.Query.where(queryable, name: params[:name]) end)

Link to this function

pmap(collection, func, timeout \\ 5000) View Source

Link to this function

reverse_merge(original, initial) View Source

Link to this function

to_json(term, options \\ []) View Source

Link to this function

to_yaml(term, opts \\ []) View Source