package models // AUTO-GENERATED Slick data model /** Stand-alone Slick data model for immediate use */ object Tables extends { val profile = scala.slick.driver.PostgresDriver } with Tables /** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ trait Tables { val profile: scala.slick.driver.JdbcProfile import profile.simple._ import scala.slick.model.ForeignKeyAction // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns. import scala.slick.jdbc.{GetResult => GR} /** DDL for all tables. Call .create to execute. */ lazy val ddl = Bids.ddl ++ Charges.ddl ++ Items.ddl ++ Transactions.ddl ++ Users.ddl /** Entity class storing rows of table Bids * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true) * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) * @param bidDate Database column bid_date DBType(timestamptz) * @param offer Database column offer DBType(numeric) */ case class Bid(uuid: String, itemUuid: String, userUuid: String, bidDate: java.sql.Timestamp, offer: scala.math.BigDecimal) /** GetResult implicit for fetching Bid objects using plain SQL queries */ implicit def GetResultBid(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Bid] = GR { prs => import prs._ Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal])) } /** Table description of table bids. Objects of this class serve as prototypes for rows in queries. */ class Bids(_tableTag: Tag) extends Table[Bid](_tableTag, "bids") { def * = (uuid, itemUuid, userUuid, bidDate, offer) <>(Bid.tupled, Bid.unapply) /** Maps whole row to an option. Useful for outer joins. */ def ? = (uuid.?, itemUuid.?, userUuid.?, bidDate.?, offer.?).shaped.<>({ r => import r._; _1.map(_ => Bid.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) /** Database column item_uuid DBType(varchar), Length(36,true) */ val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36, varying = true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) /** Database column bid_date DBType(timestamptz) */ val bidDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("bid_date") /** Database column offer DBType(numeric) */ val offer: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("offer") /** Foreign key referencing Items (database name bids_items_fk) */ lazy val itemsFk = foreignKey("bids_items_fk", itemUuid, Items)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) /** Foreign key referencing Users (database name bids_users_fk) */ lazy val usersFk = foreignKey("bids_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) } /** Collection-like TableQuery object for table Bids */ lazy val Bids = new TableQuery(tag => new Bids(tag)) /** Entity class storing rows of table Charges * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) * @param startDate Database column start_date DBType(timestamptz) * @param endDate Database column end_date DBType(timestamptz) * @param fee Database column fee DBType(numeric) * @param rate Database column rate DBType(numeric) */ case class Charge(uuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, fee: scala.math.BigDecimal, rate: scala.math.BigDecimal) /** GetResult implicit for fetching Charge objects using plain SQL queries */ implicit def GetResultCharge(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Charge] = GR { prs => import prs._ Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal])) } /** Table description of table charges. Objects of this class serve as prototypes for rows in queries. */ class Charges(_tableTag: Tag) extends Table[Charge](_tableTag, "charges") { def * = (uuid, startDate, endDate, fee, rate) <>(Charge.tupled, Charge.unapply) /** Maps whole row to an option. Useful for outer joins. */ def ? = (uuid.?, startDate.?, endDate.?, fee.?, rate.?).shaped.<>({ r => import r._; _1.map(_ => Charge.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) /** Database column start_date DBType(timestamptz) */ val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") /** Database column end_date DBType(timestamptz) */ val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") /** Database column fee DBType(numeric) */ val fee: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("fee") /** Database column rate DBType(numeric) */ val rate: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("rate") } /** Collection-like TableQuery object for table Charges */ lazy val Charges = new TableQuery(tag => new Charges(tag)) /** Entity class storing rows of table Items * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) * @param startDate Database column start_date DBType(timestamptz) * @param endDate Database column end_date DBType(timestamptz) * @param itemName Database column item_name DBType(varchar), Length(20,true) * @param shortDesc Database column short_desc DBType(varchar), Length(30,true) * @param longDesc Database column long_desc DBType(text), Length(2147483647,true) * @param initialPrice Database column initial_price DBType(numeric) */ case class Item(uuid: String, userUuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, itemName: String, shortDesc: String, longDesc: String, initialPrice: scala.math.BigDecimal) /** GetResult implicit for fetching Item objects using plain SQL queries */ implicit def GetResultItem(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Item] = GR { prs => import prs._ Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal])) } /** Table description of table items. Objects of this class serve as prototypes for rows in queries. */ class Items(_tableTag: Tag) extends Table[Item](_tableTag, "items") { def * = (uuid, userUuid, startDate, endDate, itemName, shortDesc, longDesc, initialPrice) <>(Item.tupled, Item.unapply) /** Maps whole row to an option. Useful for outer joins. */ def ? = (uuid.?, userUuid.?, startDate.?, endDate.?, itemName.?, shortDesc.?, longDesc.?, initialPrice.?).shaped.<>({ r => import r._; _1.map(_ => Item.tupled((_1.get, _2.get, _3.get, _4.get, _5.get, _6.get, _7.get, _8.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) /** Database column start_date DBType(timestamptz) */ val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") /** Database column end_date DBType(timestamptz) */ val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") /** Database column item_name DBType(varchar), Length(20,true) */ val itemName: Column[String] = column[String]("item_name", O.Length(20, varying = true)) /** Database column short_desc DBType(varchar), Length(30,true) */ val shortDesc: Column[String] = column[String]("short_desc", O.Length(30, varying = true)) /** Database column long_desc DBType(text), Length(2147483647,true) */ val longDesc: Column[String] = column[String]("long_desc", O.Length(2147483647, varying = true)) /** Database column initial_price DBType(numeric) */ val initialPrice: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("initial_price") /** Foreign key referencing Users (database name items_users_fk) */ lazy val usersFk = foreignKey("items_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) } /** Collection-like TableQuery object for table Items */ lazy val Items = new TableQuery(tag => new Items(tag)) /** Entity class storing rows of table Transactions * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) * @param transactionDate Database column transaction_date DBType(timestamptz) * @param amount Database column amount DBType(numeric) * @param label Database column label DBType(varchar), Length(255,true) */ case class Transaction(uuid: String, userUuid: String, transactionDate: java.sql.Timestamp, amount: scala.math.BigDecimal, label: String) /** GetResult implicit for fetching Transaction objects using plain SQL queries */ implicit def GetResultTransaction(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Transaction] = GR { prs => import prs._ Transaction.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[String])) } /** Table description of table transactions. Objects of this class serve as prototypes for rows in queries. */ class Transactions(_tableTag: Tag) extends Table[Transaction](_tableTag, "transactions") { def * = (uuid, userUuid, transactionDate, amount, label) <>(Transaction.tupled, Transaction.unapply) /** Maps whole row to an option. Useful for outer joins. */ def ? = (uuid.?, userUuid.?, transactionDate.?, amount.?, label.?).shaped.<>({ r => import r._; _1.map(_ => Transaction.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) /** Database column transaction_date DBType(timestamptz) */ val transactionDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("transaction_date") /** Database column amount DBType(numeric) */ val amount: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("amount") /** Database column label DBType(varchar), Length(255,true) */ val label: Column[String] = column[String]("label", O.Length(255, varying = true)) /** Foreign key referencing Users (database name transactions_users_fk) */ lazy val usersFk = foreignKey("transactions_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) } /** Collection-like TableQuery object for table Transactions */ lazy val Transactions = new TableQuery(tag => new Transactions(tag)) /** Entity class storing rows of table Users * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) * @param username Database column username DBType(varchar), Length(20,true) * @param email Database column email DBType(varchar), Length(255,true) * @param userPassword Database column user_password DBType(varchar), Length(255,true) * @param firstName Database column first_name DBType(varchar), Length(255,true) * @param lastName Database column last_name DBType(varchar), Length(255,true) * @param countryCode Database column country_code DBType(varchar), Length(2,true) * @param postalCode Database column postal_code DBType(varchar), Length(20,true) * @param address Database column address DBType(varchar), Length(255,true) * @param phone Database column phone DBType(varchar), Length(20,true) * @param birthdate Database column birthdate DBType(timestamptz) */ case class User(uuid: String, username: String, email: String, userPassword: String, firstName: String, lastName: String, countryCode: String, postalCode: String, address: String, phone: String, birthdate: java.sql.Timestamp) /** GetResult implicit for fetching User objects using plain SQL queries */ implicit def GetResultUser(implicit e0: GR[String], e1: GR[java.sql.Timestamp]): GR[User] = GR { prs => import prs._ User.tupled((<<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[java.sql.Timestamp])) } /** Table description of table users. Objects of this class serve as prototypes for rows in queries. */ class Users(_tableTag: Tag) extends Table[User](_tableTag, "users") { def * = (uuid, username, email, userPassword, firstName, lastName, countryCode, postalCode, address, phone, birthdate) <>(User.tupled, User.unapply) /** Maps whole row to an option. Useful for outer joins. */ def ? = (uuid.?, username.?, email.?, userPassword.?, firstName.?, lastName.?, countryCode.?, postalCode.?, address.?, phone.?, birthdate.?).shaped.<>({ r => import r._; _1.map(_ => User.tupled((_1.get, _2.get, _3.get, _4.get, _5.get, _6.get, _7.get, _8.get, _9.get, _10.get, _11.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) /** Database column username DBType(varchar), Length(20,true) */ val username: Column[String] = column[String]("username", O.Length(20, varying = true)) /** Database column email DBType(varchar), Length(255,true) */ val email: Column[String] = column[String]("email", O.Length(255, varying = true)) /** Database column user_password DBType(varchar), Length(255,true) */ val userPassword: Column[String] = column[String]("user_password", O.Length(255, varying = true)) /** Database column first_name DBType(varchar), Length(255,true) */ val firstName: Column[String] = column[String]("first_name", O.Length(255, varying = true)) /** Database column last_name DBType(varchar), Length(255,true) */ val lastName: Column[String] = column[String]("last_name", O.Length(255, varying = true)) /** Database column country_code DBType(varchar), Length(2,true) */ val countryCode: Column[String] = column[String]("country_code", O.Length(2, varying = true)) /** Database column postal_code DBType(varchar), Length(20,true) */ val postalCode: Column[String] = column[String]("postal_code", O.Length(20, varying = true)) /** Database column address DBType(varchar), Length(255,true) */ val address: Column[String] = column[String]("address", O.Length(255, varying = true)) /** Database column phone DBType(varchar), Length(20,true) */ val phone: Column[String] = column[String]("phone", O.Length(20, varying = true)) /** Database column birthdate DBType(timestamptz) */ val birthdate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("birthdate") /** Uniqueness Index over (username) (database name username_unique) */ val index1 = index("username_unique", username, unique = true) } /** Collection-like TableQuery object for table Users */ lazy val Users = new TableQuery(tag => new Users(tag)) }