How To Insert Returning Generated Keys?

This method inserts the rows and returns autogenerated keys (AUTOINCREMENT, SERIAL etc).

def insertCustomer: Seq[Int] = ctx.run {
  sql"INSERT INTO customers(name) VALUES('my_customer')".insertReturningGenKeys[Int]()
}

There are also variations that return a single result, depending if you want an Option[T] or T (throws if no row returned):

sql"SELECT ...".insertReturningGenKeyOpt[T]() : Option[T] // first result, if present
sql"SELECT ...".insertReturningGenKey[T]() : T            // first result, or exception