Haruki
01/26/2023, 5:08 PMobject DatabaseFactory {
fun init() {
Database.connect(
"jdbc:<postgresql://host>:port/5432",
driver = "org.postgresql.Driver",
user = "user",
password = "password"
)
}
}
object ShoppingListItems: Table() {
val id = integer("id").autoIncrement().primaryKey()
val name = varchar("name", length = 255)
val owners = varchar("owners", length = 255)
}
get {
call.respond(ShoppingListItems.select { ShoppingListItems.owners like user }.toList())
}
I am also wondering if we need to create a table. Instead, I want to use a data class like this: val collection = database.getCollection<ShoppingListItem>().
Thank you in advance for your help!