View Source Tempus.SQL (Tempus SQL v0.1.0)

The set of functions bringing DB support to Tempus library.

Start with adding the tempus_sql dependency to your project.

def deps do
  [
    {:tempus_sql, "~> 0.1"}
  ]
end

Generate a migration to add a custom type to your Postgres DB.

$ mix tempus.gen.postgres.tempus_slot

Create a schema which would use the type.

schema "meetings" do
  field :name,  :string
  field :slot,  Tempus.Ecto.Composite.Type
  timestamps()
end

def changeset(meeting, params \\ %{}),
  do: cast(meeting, params, [:slot])

For custom queries see Tempus.Ecto.Query.API.