Glific v0.3.1 Glific View Source
Glific keeps the contexts that define your domain and business logic.
Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others.
For now we'll keep some commonly used functions here, until we need a new file
Link to this section Summary
Functions
Return a time object where you go back x units. We introduce the notion of hour and minute
See if the current time is within the past time units
Wrapper to return :ok/:error when parsing strings to potential integers
Lets get rid of all non valid characters. We are assuming any language and hence using unicode syntax and not restricting ourselves to alphanumeric
Validates inputed shortcode, if shortcode is invalid it returns message that the shortcode is invalid along with the valid shortcode.
Link to this section Functions
Specs
go_back_time(integer(), DateTime.t(), atom()) :: DateTime.t()
Return a time object where you go back x units. We introduce the notion of hour and minute
Specs
in_past_time(DateTime.t(), atom(), integer()) :: boolean()
See if the current time is within the past time units
Specs
Wrapper to return :ok/:error when parsing strings to potential integers
Specs
Lets get rid of all non valid characters. We are assuming any language and hence using unicode syntax and not restricting ourselves to alphanumeric
Specs
validate_shortcode(Ecto.Changeset.t()) :: Ecto.Changeset.t() | Ecto.Changeset.t()
Validates inputed shortcode, if shortcode is invalid it returns message that the shortcode is invalid along with the valid shortcode.