Advertisement
Guest User

Slick profile

a guest
Jul 24th, 2017
16
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trait DatabaseProfile extends ExPostgresProfile with PgArraySupport with PgDate2Support with PgRangeSupport
  2. with PgHStoreSupport with PgPlayJsonSupport with PgSearchSupport with PgNetSupport with PgLTreeSupport
  3. with CIDRAddress.CIDRAddressSupport {
  4.   def pgjson = "jsonb"
  5.  
  6.   override protected def computeCapabilities: Set[Capability] =
  7.     super.computeCapabilities + JdbcCapabilities.insertOrUpdate
  8.  
  9.   trait API extends super.API with ArrayImplicits with DateTimeImplicits with JsonImplicits with NetImplicits
  10.   with LTreeImplicits with RangeImplicits with HStoreImplicits with SearchImplicits with SearchAssistants
  11.   with CIDRImplicits {
  12.     implicit class QueryExtensions[E, U, C[X] <: Seq[X]](val q: Query[E, U, C]) {
  13.       def resultFirst(implicit ec: ExecutionContext): DBIOAction[Option[U], NoStream, Effect.Read] =
  14.         q.result.map(_.headOption)
  15.     }
  16.   }
  17. }
  18.  
  19. object DatabaseProfile extends DatabaseProfile {
  20.   object MyAPI extends API
  21.   override val api = MyAPI
  22. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement