Package

wangzx.scala_commons

sql

Permalink

package sql

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. sql
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class CaseClassResultSetMapper[T] extends ResultSetMapper[T]

    Permalink

    the base class used in automate generated ResultSetMapper.

  2. trait DbEnum extends AnyRef

    Permalink

  3. class DbEnumJdbcValueAccessor[T <: DbEnum] extends JdbcValueAccessor[T]

    Permalink
  4. sealed case class JdbcValue[T](value: T)(implicit evidence$2: JdbcValueAccessor[T]) extends Product with Serializable

    Permalink
  5. trait JdbcValueAccessor[T] extends AnyRef

    Permalink

    for values(of type T) to passed into Statement or passed out from ResultSet, it should has a contxt bound of JdbcValueAccessor[T]

    for values(of type T) to passed into Statement or passed out from ResultSet, it should has a contxt bound of JdbcValueAccessor[T]

    package wangzx.scala_commons.sql prdefined a lot of pre-defined implementation for the jdbc value types:

    • boolean, byte, short, Int, Long, Float, Double, BigDecimal, scala.BigDecimal
    • String
    • Date, Time, Timestamp
    • Blob, Clob, byte[]
    • Option[T] if T has JdbcValueAccessor context bounded

    developer can define your's value type such as a MyDate which stored as database Date, you need only define an implicit value of JdbcValueAccessor[MyDate], then you can:

    • pass in statement using sql"... where date_field = $myDate"
    • passout from ResultSet, using rs.get[MyDate](field index or name)
    • mapping to a field of other CaseClass such as User, and then using rows[User](sql)
    • mapping to a Row object and rows[Row](sql), and then using row.get[MyDate](field index of name).
  6. class JdbcValueAccessor_Option[T] extends JdbcValueAccessor[Option[T]]

    Permalink
  7. implicit class ResultSetEx extends AnyRef

    Permalink
  8. trait ResultSetMapper[T] extends AnyRef

    Permalink

    any record level(a table row) having a ResultSetMapper context bound can used in rows[T](sql)

    any record level(a table row) having a ResultSetMapper context bound can used in rows[T](sql)

    the scala-sql library provide a Macro to automate generate the implementation for a given case class T if all it's field is JdbcValueAccess-able(having a JdbcValueAccess context bound).

    since the macro will generate a ResultSetMapper class for you anytime if there is not an explicit imported implicit value, maybe a lot of anonymous class will be generated. that is no problem but a bigger jar. to avoid this problem, you can define a implicit ResultSetMappper value in the Case Class's companion object.

      case class User(name: String, age: Int)
      object User {
        implicit val resultSetmapper = ResultSetMapper.material[User]
      }
    

  9. class RichConnection extends AnyRef

    Permalink
  10. class RichDataSource extends AnyRef

    Permalink
  11. class Row extends ResultSet

    Permalink
  12. implicit class SQLStringContext extends AnyRef

    Permalink
  13. case class SQLWithArgs(sql: String, args: Seq[JdbcValue[_]]) extends Product with Serializable

    Permalink

    wrap a sql"select * from table where id = $id" object

  14. class db extends Annotation with StaticAnnotation

    Permalink

Value Members

  1. object BeanBuilder

    Permalink

    TODO support camel and underscore name mapping like doSomething <-> do_something

  2. object Functions

    Permalink
  3. object JdbcValue extends Serializable

    Permalink
  4. object JdbcValueAccessor

    Permalink
  5. implicit object JdbcValueAccessor_ArrayBytes extends JdbcValueAccessor[Array[Byte]]

    Permalink
  6. implicit object JdbcValueAccessor_BigDecimal extends JdbcValueAccessor[BigDecimal]

    Permalink
  7. implicit object JdbcValueAccessor_Blob extends JdbcValueAccessor[Blob]

    Permalink
  8. implicit object JdbcValueAccessor_Boolean extends JdbcValueAccessor[Boolean]

    Permalink
  9. implicit object JdbcValueAccessor_Byte extends JdbcValueAccessor[Byte]

    Permalink
  10. implicit object JdbcValueAccessor_Clob extends JdbcValueAccessor[Clob]

    Permalink
  11. implicit object JdbcValueAccessor_Date extends JdbcValueAccessor[Date]

    Permalink
  12. implicit object JdbcValueAccessor_Date2 extends JdbcValueAccessor[Date]

    Permalink
  13. implicit object JdbcValueAccessor_Double extends JdbcValueAccessor[Double]

    Permalink
  14. implicit object JdbcValueAccessor_Float extends JdbcValueAccessor[Float]

    Permalink
  15. implicit object JdbcValueAccessor_Int extends JdbcValueAccessor[Int]

    Permalink
  16. implicit object JdbcValueAccessor_Long extends JdbcValueAccessor[Long]

    Permalink
  17. implicit object JdbcValueAccessor_ScalaBigDecimal extends JdbcValueAccessor[BigDecimal]

    Permalink
  18. implicit object JdbcValueAccessor_Short extends JdbcValueAccessor[Short]

    Permalink
  19. implicit object JdbcValueAccessor_String extends JdbcValueAccessor[String]

    Permalink
  20. implicit object JdbcValueAccessor_Timestamp extends JdbcValueAccessor[Timestamp]

    Permalink
  21. object Macros

    Permalink
  22. implicit object ResulSetMapper_Double extends ResultSetMapper[Double]

    Permalink
  23. implicit object ResulSetMapper_Short extends ResultSetMapper[Short]

    Permalink
  24. object ResultSetMapper

    Permalink
  25. implicit object ResultSetMapper_BigDecimal extends ResultSetMapper[BigDecimal]

    Permalink
  26. implicit object ResultSetMapper_Boolean extends ResultSetMapper[Boolean]

    Permalink
  27. implicit object ResultSetMapper_Byte extends ResultSetMapper[Byte]

    Permalink
  28. implicit object ResultSetMapper_Date extends ResultSetMapper[Date]

    Permalink
  29. implicit object ResultSetMapper_Date2 extends ResultSetMapper[Date]

    Permalink
  30. implicit object ResultSetMapper_Float extends ResultSetMapper[Float]

    Permalink
  31. implicit object ResultSetMapper_Int extends ResultSetMapper[Int]

    Permalink
  32. implicit object ResultSetMapper_Long extends ResultSetMapper[Long]

    Permalink
  33. implicit object ResultSetMapper_ScalaBigDecimal extends ResultSetMapper[BigDecimal]

    Permalink
  34. implicit object ResultSetMapper_String extends ResultSetMapper[String]

    Permalink
  35. implicit object ResultSetMapper_Timestamp extends ResultSetMapper[Timestamp]

    Permalink
  36. object RichConnection

    Permalink
  37. object Row

    Permalink

    provide a offline Box for ResultSet which is scrollable and only valid with an open connection.

  38. object Shell

    Permalink
  39. implicit def enhanceConnection(conn: Connection): RichConnection

    Permalink
  40. implicit def enhanceDataSource(datasource: DataSource): RichDataSource

    Permalink
  41. implicit def enhancePlainSql(stmt: String): SQLWithArgs

    Permalink
  42. object mysql

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped