compositeMoney

fun Table.compositeMoney(precision: Int, scale: Int, amountName: String, currencyName: String = amountName + "_C"): CompositeMoneyColumn<BigDecimal, CurrencyUnit, MonetaryAmount>

Creates a composite column made up of:

  • A numeric column, with the specified amountName, for storing numbers with the specified precision and scale.

  • A character column, with the specified currencyName, for storing currency (as javax.money.CurrencyUnit).

Samples

org.jetbrains.exposed.sql.money.MoneyDefaultsTest.TableWithDBDefault
fun Table.compositeMoney(amountColumn: Column<BigDecimal>, currencyColumn: Column<CurrencyUnit>): CompositeMoneyColumn<BigDecimal, CurrencyUnit, MonetaryAmount>

Creates a composite column made up of a decimal column and a currency column.

Samples

org.jetbrains.exposed.sql.money.MoneyBaseTest.testUsingManualCompositeMoneyColumns
@JvmName(name = "compositeMoneyNullable")
fun Table.compositeMoney(amountColumn: Column<BigDecimal?>, currencyColumn: Column<CurrencyUnit?>): CompositeMoneyColumn<BigDecimal?, CurrencyUnit?, MonetaryAmount?>

Creates a composite column made up of a nullable decimal column and a nullable currency column.

Samples

org.jetbrains.exposed.sql.money.MoneyBaseTest.testUsingManualCompositeMoneyColumns