View Source HypeLib.Prelude (HypeLib v2.4.1)
The Prelude module contains utility functions for working with
external dependencies like TypeCheck, the Elixir Logger moudle etc.
Link to this section Summary
Functions
Imports TypeCheck and requires the Erlang logger
Imports the Ecto schema functions and all changeset functions
Imports the Absinthe notation module
Imports the graphql AST and uses the Absinthe.Schema
Imports the HypeLib.Utils.String module as StringUtils into the current context.
Changelog
2.3.1
Link to this section Functions
Imports TypeCheck and requires the Erlang logger
changelog
Changelog
1-0-0
1.0.0
Initial release
Imports the Ecto schema functions and all changeset functions
usage
Usage
This macro adds an module attribute to the calling module for defining
ecto timestamps as DateTime structs instead of NaiveDateTime.
Hint: Do not forget to configure your application to use timestamps with timezone information:
config :my_app,
MyApp.Repo,
migration_timestamps: [
type: :utc_datetime
]You might want to install Timex for DateTime convenience functions like creating and manipulating the date or time.
Run the following command to view the latest version of Timex:
mix hex.info timex
changelog
Changelog
2-2-0
2.2.0
- Added the
Databasealias - Added timezone support
- Added the
Usagesection
1-0-0
1.0.0
Initial release
Imports the Absinthe notation module
changelog
Changelog
2-2-0
2.2.0
- Added the
GraphQLalias
1-0-0
1.0.0
Initial release
Imports the graphql AST and uses the Absinthe.Schema
changelog
Changelog
2-2-0
2.2.0
Initial release
Imports the HypeLib.Utils.String module as StringUtils into the current context.
examples
Examples
iex> defmodule TokenGenerator do
...> use HypeLib.Prelude, :string
...>
...> @spec! generate_token() :: String.t()
...> def generate_token() do
...> StringUtils.Generator.generate_string!(1, ~w(a))
...> end
...> end
...>
...> TokenGenerator.generate_token()
"a"
changelog
Changelog
1-0-0
1.0.0
Initial release