Bolt.Sips v2.0.5 Bolt.Sips.Types.Duration View Source
a Duration type, as introduced in bolt V2.
Composed of months, days, seconds and nanoseconds, it can be used in date operations
Link to this section Summary
Functions
Create a Duration struct from data returned by Neo4j.
Convert a %Duration in a cypher-compliant string. To know everything about duration format, please see: https://neo4j.com/docs/cypher-manual/current/syntax/temporal/#cypher-temporal-durations
Link to this section Types
t()
View Sourcet() :: %Bolt.Sips.Types.Duration{ days: non_neg_integer(), hours: non_neg_integer(), minutes: non_neg_integer(), months: non_neg_integer(), nanoseconds: non_neg_integer(), seconds: non_neg_integer(), weeks: non_neg_integer(), years: non_neg_integer() }
Link to this section Functions
create(months, days, seconds, nanoseconds)
View Sourcecreate(integer(), integer(), integer(), integer()) :: Bolt.Sips.Types.Duration.t()
Create a Duration struct from data returned by Neo4j.
Neo4j returns a list of 4 integers:
- months
- days
- seconds
- nanoseconds
Struct elements are computed in a logical way, then for exmple 65 seconds is 1min and 5 seconds. Beware that you may not retrieve the same data you send! Note: days are not touched as they are not a fixed number of days for each month.
Example:
iex> Duration.create(15, 53, 125, 54)
%Bolt.Sips.Types.Duration{
days: 53,
hours: 0,
minutes: 2,
months: 3,
nanoseconds: 54,
seconds: 5,
weeks: 0,
years: 1
}
format_param(duration)
View Sourceformat_param(Bolt.Sips.Types.Duration.t()) :: {:ok, String.t()} | {:error, any()}
Convert a %Duration in a cypher-compliant string. To know everything about duration format, please see: https://neo4j.com/docs/cypher-manual/current/syntax/temporal/#cypher-temporal-durations