abstract class CRUD[T, PrimaryKeyType] extends CRUDAction[T, PrimaryKeyType] with JdbcProfileComponent[DbAppConfig]

Created by chris on 9/8/16. This is an abstract actor that can be used to implement any sort of actor that accesses a Postgres database. It creates read, update, upsert, and delete methods for your actor to call. You are responsible for the create function. You also need to specify the table and the database you are connecting to.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CRUD
  2. CRUDAction
  3. JdbcProfileComponent
  4. Logging
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CRUD()(implicit ec: ExecutionContext, appConfig: DbAppConfig)

Abstract Value Members

  1. abstract def createAll(ts: Vector[T]): Future[Vector[T]]
  2. abstract def createAllAction(ts: Vector[T]): slick.jdbc.JdbcProfile.API.DBIOAction[Vector[T], slick.jdbc.JdbcProfile.API.NoStream, Write]
    Definition Classes
    CRUDAction
  3. abstract def findAll(ts: Vector[T]): slick.jdbc.JdbcProfile.API.Query[slick.jdbc.JdbcProfile.API.Table[T], T, Seq]
    Attributes
    protected
    Definition Classes
    CRUDAction
  4. abstract def findByPrimaryKeys(ids: Vector[PrimaryKeyType]): slick.jdbc.JdbcProfile.API.Query[slick.jdbc.JdbcProfile.API.Table[T], T, Seq]

    Finds the rows that correlate to the given primary keys

    Finds the rows that correlate to the given primary keys

    Attributes
    protected
    Definition Classes
    CRUDAction
  5. abstract val table: slick.jdbc.JdbcProfile.API.TableQuery[_ <: slick.jdbc.JdbcProfile.API.Table[T]]

    The table inside our database we are inserting into

    The table inside our database we are inserting into

    Definition Classes
    CRUDAction

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. implicit val appConfig: DbAppConfig
    Definition Classes
    CRUD → CRUDAction → JdbcProfileComponent
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def count(): Future[Int]

    Returns number of rows in the table

  8. def countAction: slick.jdbc.JdbcProfile.API.DBIOAction[Int, slick.jdbc.JdbcProfile.API.NoStream, Read]
    Definition Classes
    CRUDAction
  9. def create(t: T): Future[T]

    create a record in the database

    create a record in the database

    t

    - the record to be inserted

    returns

    the inserted record

  10. def createAction(t: T): slick.jdbc.JdbcProfile.API.DBIOAction[T, slick.jdbc.JdbcProfile.API.NoStream, Write]
    Definition Classes
    CRUDAction
  11. lazy val database: slick.jdbc.JdbcProfile.API.Database

    The database we are connecting to

    The database we are connecting to

    Definition Classes
    JdbcProfileComponent
  12. lazy val dbConfig: DatabaseConfig[JdbcProfile]

    The configuration details for connecting/using the database for our projects that require database connections

    The configuration details for connecting/using the database for our projects that require database connections

    Definition Classes
    JdbcProfileComponent
  13. def debug(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  14. def debug(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  15. def debug(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  16. def delete(t: T): Future[Int]

    delete the corresponding record in the database

    delete the corresponding record in the database

    t

    - the record to be deleted

    returns

    int - the number of rows affected by the deletion

  17. def deleteAction(t: T): slick.jdbc.JdbcProfile.API.DBIOAction[Int, slick.jdbc.JdbcProfile.API.NoStream, Write]
    Definition Classes
    CRUDAction
  18. def deleteAll(): Future[Int]

    delete all records from the table

  19. def deleteAll(ts: Vector[T]): Future[Int]
  20. def deleteAllAction(): slick.jdbc.JdbcProfile.API.DBIOAction[Int, slick.jdbc.JdbcProfile.API.NoStream, Write with Transactional]

    WARNING: Deletes all rows in table, use with care

    WARNING: Deletes all rows in table, use with care

    Definition Classes
    CRUDAction
  21. def deleteAllAction(ts: Vector[T]): slick.jdbc.JdbcProfile.API.DBIOAction[Int, slick.jdbc.JdbcProfile.API.NoStream, Write]
    Definition Classes
    CRUDAction
  22. implicit val ec: ExecutionContext
    Definition Classes
    CRUD → CRUDAction
  23. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  25. def error(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. def error(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  27. def error(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  28. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  29. def find(t: T): slick.jdbc.JdbcProfile.API.Query[slick.jdbc.JdbcProfile.API.Table[T], T, Seq]
    Attributes
    protected
    Definition Classes
    CRUDAction
  30. def findAll(): Future[Vector[T]]

    Finds all elements in the table

  31. def findAllAction(): slick.jdbc.JdbcProfile.API.DBIOAction[Vector[T], slick.jdbc.JdbcProfile.API.NoStream, Read]
    Definition Classes
    CRUDAction
  32. def findByPrimaryKey(id: PrimaryKeyType): slick.jdbc.JdbcProfile.API.Query[slick.jdbc.JdbcProfile.API.Table[T], T, Seq]

    return all rows that have a certain primary key

    return all rows that have a certain primary key

    id

    primary key of the row to return

    returns

    Query object corresponding to the selected rows

    Attributes
    protected
    Definition Classes
    CRUDAction
  33. def findByPrimaryKeyAction(id: PrimaryKeyType): slick.jdbc.JdbcProfile.API.DBIOAction[Option[T], slick.jdbc.JdbcProfile.API.NoStream, Read]
    Definition Classes
    CRUDAction
  34. def findByPrimaryKeysAction(ids: Vector[PrimaryKeyType]): slick.jdbc.JdbcProfile.API.DBIOAction[Vector[T], slick.jdbc.JdbcProfile.API.NoStream, Read]
    Definition Classes
    CRUDAction
  35. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  36. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  37. def info(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  38. def info(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  39. def info(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  40. def isDebugEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  41. def isErrorEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  42. def isInfoEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  43. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  44. def isTraceEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  45. def isWarnEnabled: Boolean
    Attributes
    protected
    Definition Classes
    Logging
  46. def logger: Logger
    Attributes
    protected
    Definition Classes
    Logging
  47. def loggerName: String
    Attributes
    protected
    Definition Classes
    Logging
  48. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  49. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  50. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  51. lazy val numThreads: Int
    Definition Classes
    JdbcProfileComponent
  52. lazy val profile: JdbcProfile
    Definition Classes
    JdbcProfileComponent
  53. def read(id: PrimaryKeyType): Future[Option[T]]

    read a record from the database

    read a record from the database

    id

    - the id of the record to be read

    returns

    Option[T] - the record if found, else none

  54. def safeDatabase: SafeDatabase

    Binding to the actual database itself, this is what is used to run querys

  55. val schemaName: Option[String]
  56. def startHikariLogger(interval: Duration): HikariLogging

    Starts the background logger for hikari

    Starts the background logger for hikari

    interval

    - how often hikari logs database connection pool information

    Attributes
    protected
    Definition Classes
    JdbcProfileComponent
  57. def stopHikariLogger(): Unit
    Attributes
    protected
    Definition Classes
    JdbcProfileComponent
  58. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  59. implicit def tableQuerySafeSubtypeCast[SpecificT <: AbstractTable[_], SomeT <: SpecificT](tableQuery: slick.jdbc.JdbcProfile.API.TableQuery[SomeT]): slick.jdbc.JdbcProfile.API.TableQuery[SpecificT]

    We need to cast from TableQuery's of internal types (e.g.

    We need to cast from TableQuery's of internal types (e.g. AddressDAO#AddressTable) to external versions of them (e.g. AddressDAO().table). You'll notice that although the latter is a subtype of the first, this requires a cast since TableQuery is not covariant in its type parameter.

    However, since Query is covariant in its first type parameter, I believe the cast from TableQuery[T1] to TableQuery[T2] will always be safe so long as T1 is a subtype of T2 AND T1#TableElementType is equal to T2#TableElementType.

    The above conditions are always the case when this is called within DAOs as it is only ever used for things of the form TableQuery[XDAO().table] -> TableQuery[XDAO#XTable].

    Attributes
    protected
  60. def toString(): String
    Definition Classes
    AnyRef → Any
  61. def trace(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  62. def trace(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  63. def trace(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging
  64. def update(t: T): Future[T]

    Update the corresponding record in the database

  65. def updateAction(t: T): slick.jdbc.JdbcProfile.API.DBIOAction[T, slick.jdbc.JdbcProfile.API.NoStream, Write]
    Definition Classes
    CRUDAction
  66. def updateAll(ts: Vector[T]): Future[Vector[T]]
  67. def updateAllAction(ts: Vector[T]): slick.jdbc.JdbcProfile.API.DBIOAction[Vector[T], slick.jdbc.JdbcProfile.API.NoStream, Write]

    Updates all of the given ts.

    Updates all of the given ts. Returns all ts that actually existed in the database and got updated This method discards things that did not exist in the database, thus could not be updated

    Definition Classes
    CRUDAction
  68. def upsert(t: T): Future[T]

    insert the record if it does not exist, update it if it does

    insert the record if it does not exist, update it if it does

    t

    - the record to inserted / updated

    returns

    t - the record that has been inserted / updated

  69. def upsertAction(t: T): slick.jdbc.JdbcProfile.API.DBIOAction[T, slick.jdbc.JdbcProfile.API.NoStream, Write with Read]
    Definition Classes
    CRUDAction
  70. def upsertAll(ts: Vector[T]): Future[Vector[T]]

    Upserts all of the given ts in the database, then returns the upserted values

  71. def upsertAllAction(ts: Vector[T]): slick.jdbc.JdbcProfile.API.DBIOAction[Vector[T], slick.jdbc.JdbcProfile.API.NoStream, Write with Read]

    Upsert all of the given ts.

    Upsert all of the given ts. Returns all ts that were inserted or updated

    Definition Classes
    CRUDAction
    See also

    https://scala-slick.org/doc/3.3.3/queries.html#upserting

  72. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  73. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  74. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  75. def warn(mkr: Marker, msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  76. def warn(msg: => Any, t: => Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  77. def warn(msg: => Any): Unit
    Attributes
    protected
    Definition Classes
    Logging

Inherited from CRUDAction[T, PrimaryKeyType]

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped