com.websudos.morpheus.query

Query

class Query[T <: BaseTable[T, _], R, Type <: QueryType, Group <: GroupBind, Ord <: OrderBind, Lim <: LimitBind, Chain <: ChainBind, AC <: AssignBind, Status <: StatusBind] extends SQLQuery[T, R]

This bit of magic allows all extending sub-classes to implement the "where" and "and" SQL clauses with all the necessary operators, in a type safe way. By providing the third type argument and a custom way to subclass with the predetermined set of arguments, all queries such as UPDATE, DELETE, ALTER and so on can use the same root implementation of clauses and therefore avoid the violation of DRY.

The reason why the "clause" and "andClause" methods below are protected is so that extending classes can decide when and how to expose "where" and "and" SQL methods to the DSL user. Used mainly to make queries like "select.where(_.a = b).where(_.c = d)" impossible, or in other words make illegal programming states unrepresentable. There is an awesome book about how to do this in Scala, I will link to it as soon as the book is published.

T

The type of the table owning the record.

R

The type of the record held in the table.

Linear Supertypes
SQLQuery[T, R], ResultSetOperations, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Query
  2. SQLQuery
  3. ResultSetOperations
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Query(table: T, query: SQLBuiltQuery, rowFunc: (Row) ⇒ R)

    table

    The table owning the record.

    query

    The root SQL query to start building from.

    rowFunc

    The function mapping a row to a record.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def and(condition: QueryCondition)(implicit ev: =:=[Chain, Chainned]): Query[T, R, Type, Group, Ord, Lim, Chainned, AC, Status]

    Annotations
    @implicitNotFound( ... )
  7. final def and(condition: (T) ⇒ QueryCondition)(implicit ev: =:=[Chain, Chainned]): Query[T, R, Type, Group, Ord, Lim, Chainned, AC, Status]

    Annotations
    @implicitNotFound( ... )
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def execute[DBRow <: Row, DBResult <: Result]()(implicit client: Client[DBRow, DBResult]): Future[DBResult]

    This method is used when the query is not returning a data result, such as an UPDATE query.

    This method is used when the query is not returning a data result, such as an UPDATE query. While it will accurately monitor the execution of the query and the Future will complete when the task is "done" in SQL, the type-safe mapping of the result is not necessary at this point.

    The below implementation will pass type arguments explicitly to the covariant constructor.

    client

    The Finagle MySQL client in the scope of which to execute the query.

    returns

    A Scala Future wrapping a default Finagle MySQL query result object.

    Definition Classes
    SQLQuery
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def fromRow(row: Row): R

  15. def future[DBRow <: Row, DBResult <: Result]()(implicit client: Client[DBRow, DBResult]): Future[DBResult]

    This method is used when the query is not returning a data result, such as an UPDATE query.

    This method is used when the query is not returning a data result, such as an UPDATE query. While it will accurately monitor the execution of the query and the Future will complete when the task is "done" in SQL, the type-safe mapping of the result is not necessary at this point.

    This method duplicates the API to provide an alternative to people who don't use Twitter Futures or any Twitter libraries in their stack. Until now anyway. Twitter has been gossiping about making com.twitter.util.Future extend scala.concurrent.Future, but until such times a dual API is best.

    The below implementation will pass type arguments explicitly to the covariant constructor.

    client

    The Finagle MySQL client in the scope of which to execute the query.

    returns

    A Scala Future wrapping a default Finagle MySQL query result object.

    Definition Classes
    SQLQuery
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. final def groupBy(columns: (T) ⇒ SelectColumn[_]*)(implicit ev1: =:=[Group, Ungroupped], ev2: =:=[Ord, Unordered]): Query[T, _, Type, Groupped, Ord, Lim, Chain, AC, Status]

    Annotations
    @implicitNotFound( ... )
  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  20. final def limit(value: Int)(implicit ev: =:=[Lim, Unlimited]): Query[T, R, Type, Group, Ord, Limited, Chain, AC, Status]

    Annotations
    @implicitNotFound( ... )
  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  24. final def orderBy(conditions: (T) ⇒ QueryOrder*)(implicit ev: =:=[Ord, Unordered]): Query[T, R, Type, Group, Ordered, Lim, Chain, AC, Status]

    Annotations
    @implicitNotFound( ... )
  25. val query: SQLBuiltQuery

    The root SQL query to start building from.

    The root SQL query to start building from.

    Definition Classes
    QuerySQLQuery
  26. def queryString: String

    A simple forwarding method to prevent some extra boiler-plate during tests.

    A simple forwarding method to prevent some extra boiler-plate during tests. This will serialise an existing query to the relevant SQL string.

    returns

    A string representing the query encoded in SQL.

    Definition Classes
    SQLQuery
  27. def queryToFuture[DBRow <: Row, DBResult <: Result](query: String)(implicit client: Client[DBRow, DBResult]): Future[DBResult]

    Attributes
    protected[this]
    Definition Classes
    ResultSetOperations
  28. def queryToScalaFuture[DBRow <: Row, DBResult <: Result](query: String)(implicit client: Client[DBRow, DBResult]): Future[DBResult]

    Attributes
    protected[this]
    Definition Classes
    ResultSetOperations
  29. val rowFunc: (Row) ⇒ R

    The function mapping a row to a record.

  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  31. val table: T

    The table owning the record.

  32. def toString(): String

    Definition Classes
    AnyRef → Any
  33. def twitterToScala[A](future: Future[A]): Future[A]

    Attributes
    protected[this]
    Definition Classes
    ResultSetOperations
  34. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def where(condition: QueryCondition)(implicit ev: =:=[Chain, Unchainned]): Query[T, R, Type, Group, Ord, Lim, Chainned, AC, Status]

    Annotations
    @implicitNotFound( ... )
  38. final def where(condition: (T) ⇒ QueryCondition)(implicit ev: =:=[Chain, Unchainned]): Query[T, R, Type, Group, Ord, Lim, Chainned, AC, Status]

    Annotations
    @implicitNotFound( ... )

Inherited from SQLQuery[T, R]

Inherited from ResultSetOperations

Inherited from AnyRef

Inherited from Any

Ungrouped