Skip to content

Commit

Permalink
fix detekt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vnikolova committed Jul 24, 2024
1 parent ef0164d commit c208fb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ fun main() {
// print sql to std-out
addLogger(StdOutSqlLogger)

//...
// ...

SchemaUtils.create (Tasks)
SchemaUtils.create(Tasks)

val taskId = Tasks.insert {
it[title] = "Learn Exposed"
Expand All @@ -32,11 +32,11 @@ fun main() {

println("Created new tasks with ids $taskId and $secondTaskId.")

Tasks.select(Tasks.id.count(), Tasks.isCompleted).groupBy(Tasks.isCompleted).forEach{
Tasks.select(Tasks.id.count(), Tasks.isCompleted).groupBy(Tasks.isCompleted).forEach {
println("${it[Tasks.isCompleted]}: ${it[Tasks.id.count()]} ")
}

//Update a task
// Update a task
Tasks.update({ Tasks.id eq taskId }) {
it[isCompleted] = true
}
Expand All @@ -45,7 +45,7 @@ fun main() {

println("Updated task details: $updatedTask")

//Delete a task
// Delete a task
Tasks.deleteWhere { id eq secondTaskId }

println("Remaining tasks: ${Tasks.selectAll().toList()}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import org.jetbrains.exposed.sql.Table

const val MAX_VARCHAR_LENGTH = 128

object Tasks : Table("tasks") {
val id = integer("id").autoIncrement()
val title = varchar("name", 128)
val description = varchar("description", 128)
val title = varchar("name", MAX_VARCHAR_LENGTH)
val description = varchar("description", MAX_VARCHAR_LENGTH)
val isCompleted = bool("completed").default(false)
}

This file was deleted.

0 comments on commit c208fb4

Please sign in to comment.