I'm trying to figure out the best way to deal with optional values when inserting data.
object Groups extends SQLSyntaxSupport[Group] {
override val tableName = "group"
override val columnNames = Seq("id", "name", "parent_id")
}
Somewhere in the code:
def insertGroup(group: Group) = DB localTx { implicit s =>
val g = Groups.column
val id = withSQL {
insertInto(Groups)
.columns(
g.name, g.email, g.ownerId, g.parentId)
}.updateAndReturnGeneratedKey().apply()
group.copy(id = Some(id))
}
The question is, does ScalikeJdbc provide a way to deal with these cases?