View Source Ecto.Druid.Util (ecto_druid v0.3.0)

Utility functions to generate SQL fragments.

Summary

Functions

Defines a SQL function that can be used in queries.

Defines a SQL function body that can be used in queries.

Functions

Link to this macro

sql_function(arg, opts \\ [])

View Source (macro)

Defines a SQL function that can be used in queries.

Example

defmodule MyApp.Query do
  import Ecto.Druid.Util

  sql_function :my_function, [:arg1, :arg2], type: :integer
end

Look at Ecto.Druid.Query's source for more examples.

Link to this function

sql_function_body(fun, placeholders, args, type \\ nil, wrapper \\ {"(", ")"})

View Source

Defines a SQL function body that can be used in queries.

Example

defmodule MyApp.Query do
  defmacro my_function(arg1, arg2) do
    Ecto.Druid.Util.sql_function_body("MY_FUNCTION", "?, ?", [arg1, arg2])
  end
end

Look at Ecto.Druid.Query's source for more examples.