View Source Money.DDL (Money SQL v1.11.0)

Functions to return SQL DDL commands that support the creation and deletion of the money_with_currency database type and associated aggregate functions.

Summary

Functions

Returns the SQL string which when executed will define the money_with_currency data type.

Returns the SQL string which when executed will define min and max functions for the money_with_currency data type.

Returns the SQL string which when executed will define an infix - operator for the money_with_currency data type.

Returns the SQL string which when executed will define a unary - operator for the money_with_currency data type.

Returns the SQL string which when executed will define a + operator for the money_with_currency data type.

Returns the SQL string which when executed will define sum functions for the money_with_currency data type.

Returns the SQL string which when executed will drop the min and max functions for the money_with_currency data type.

Returns the SQL string which when executed will drop the infix - operator for the money_with_currency data type.

Returns the SQL string which when executed will drop the money_with_currency data type.

Returns the SQL string which when executed will drop the unary - operator for the money_with_currency data type.

Returns the SQL string which when executed will drop the + operator for the money_with_currency data type.

Returns the SQL string which when executed will drop the sum functions for the money_with_currency data type.

Returns a string that will Ecto execute a single SQL command.

Returns a string that will Ecto execute each SQL command.

Functions

Link to this function

create_money_with_currency(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

define_minmax_functions(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define min and max functions for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

define_minus_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define an infix - operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

define_negate_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define a unary - operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

define_plus_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define a + operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

define_sum_function(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will define sum functions for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_minmax_functions(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the min and max functions for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_minus_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the infix - operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_money_with_currency(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_negate_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the unary - operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_plus_operator(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the + operator for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

drop_sum_function(db_type \\ :postgres)

View Source

Returns the SQL string which when executed will drop the sum functions for the money_with_currency data type.

Arguments

  • db_type: the type of the database for which the SQL string should be returned. Defaults to :postgres which is currently the only supported database type.
Link to this function

execute(sql, append \\ "")

View Source

Returns a string that will Ecto execute a single SQL command.

Arguments

  • sql is a single SQL command

Example

iex> Money.DDL.execute "SELECT name FROM customers;"
"execute "SELECT name FROM customers;""
Link to this function

execute_each(sql, append \\ "")

View Source

Returns a string that will Ecto execute each SQL command.

Arguments

  • sql is a string of SQL commands that are separated by three newlines ("\n"), that is to say two blank lines between commands in the file.

Example

iex> Money.DDL.execute "SELECT name FROM customers;

SELECT id FROM orders;"

"execute """

SELECT name FROM customers;

SELECT id FROM orders; """"