o

anorm

SqlParser

object SqlParser extends FunctionAdapter

Source
SqlParser.scala
Linear Supertypes
FunctionAdapter, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SqlParser
  2. FunctionAdapter
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. def array[T](columnPosition: Int)(implicit c: Column[Array[T]]): RowParser[Array[T]]

    Parses specified array column.

    Parses specified array column.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (String, Array[String]) = SQL"SELECT a, sqlArrayOfString FROM test"
      .as(SqlParser.str("a") ~ SqlParser.array[String](2) map (
        SqlParser.flatten) single)
  5. def array[T](columnName: String)(implicit c: Column[Array[T]]): RowParser[Array[T]]

    Parses specified array column.

    Parses specified array column.

    import anorm.{ SQL, SqlParser }
    
    val t: (String, Array[String]) = SQL"SELECT a, sqlArrayOfString FROM test"
      .as(SqlParser.str("a") ~
    SqlParser.array[String]("sqlArrayOfString") map (
        SqlParser.flatten) single)
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def binaryStream(columnPosition: Int)(implicit c: Column[InputStream]): RowParser[InputStream]

    Parses specified column as binary stream.

    Parses specified column as binary stream.

    import java.io.InputStream
    import anorm.{ SQL, SqlParser }
    
    val parser = SqlParser.str(1) ~ SqlParser.binaryStream(2)
    val file: (String, InputStream) = SQL("SELECT name, data FROM files").
      as(parser.single)
  8. def binaryStream(columnName: String)(implicit c: Column[InputStream]): RowParser[InputStream]

    Parses specified column as binary stream.

    Parses specified column as binary stream.

    import java.io.InputStream
    import anorm.{ SQL, SqlParser }
    
    val parser = SqlParser.str("name") ~ SqlParser.binaryStream("data")
    val file: (String, InputStream) = SQL("SELECT name, data FROM files").
      as(parser.single)
  9. def bool(columnPosition: Int)(implicit c: Column[Boolean]): RowParser[Boolean]

    Parses specified column as boolean.

    Parses specified column as boolean.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Boolean, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.bool(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  10. def bool(columnName: String)(implicit c: Column[Boolean]): RowParser[Boolean]

    Parses specified column as boolean.

    Parses specified column as boolean.

    import anorm.{ SQL, SqlParser }
    
    val t: (Boolean, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.bool("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  11. def byte(columnPosition: Int)(implicit c: Column[Byte]): RowParser[Byte]

    Parses specified column as byte.

    Parses specified column as byte.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Byte, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.byte(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  12. def byte(columnName: String)(implicit c: Column[Byte]): RowParser[Byte]

    Parses specified column as byte.

    Parses specified column as byte.

    import anorm.{ SQL, SqlParser }
    
    val t: (Byte, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.byte("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  13. def byteArray(columnPosition: Int)(implicit c: Column[Array[Byte]]): RowParser[Array[Byte]]

    Parses specified column as binary stream.

    Parses specified column as binary stream.

    import anorm.{ SQL, SqlParser }, SqlParser.{ str, byteArray }
    
    val parser = (SqlParser.str(1) ~ SqlParser.byteArray(2)).flatten
    val file: (String, Array[Byte]) = SQL("SELECT name, data FROM files").
      as(parser.single)
  14. def byteArray(columnName: String)(implicit c: Column[Array[Byte]]): RowParser[Array[Byte]]

    Parses specified column as binary stream.

    Parses specified column as binary stream.

    import anorm.{ SQL, SqlParser }, SqlParser.{ str, byteArray }
    
    val parser = (str("name") ~ byteArray("data")).flatten
    val file: (String, Array[Byte]) = SQL("SELECT name, data FROM files").
      as(parser.single)
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  16. def date(columnPosition: Int)(implicit c: Column[Date]): RowParser[Date]

    Parses specified column as date.

    Parses specified column as date.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Date, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.date(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  17. def date(columnName: String)(implicit c: Column[Date]): RowParser[Date]

    Parses specified column as date.

    Parses specified column as date.

    import anorm.{ SQL, SqlParser }
    
    val t: (Date, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.date("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  18. def double(columnPosition: Int)(implicit c: Column[Double]): RowParser[Double]

    Parses specified column as double.

    Parses specified column as double.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Double, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.double(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  19. def double(columnName: String)(implicit c: Column[Double]): RowParser[Double]

    Parses specified column as double.

    Parses specified column as double.

    import anorm.{ SQL, SqlParser }
    
    val t: (Double, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.double("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  22. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def flatten[T1, T2, R](implicit f: TupleFlattener[(~[T1, T2]) ⇒ R]): (~[T1, T2]) ⇒ R

    Flatten columns tuple-like.

    Flatten columns tuple-like.

    import anorm.SQL
    import anorm.SqlParser.{ long, str, int }
    
    val tuple: (Long, String, Int) = SQL("SELECT a, b, c FROM Test").
      as(long("a") ~ str("b") ~ int("c") map (SqlParser.flatten) single)
  24. def float(columnPosition: Int)(implicit c: Column[Float]): RowParser[Float]

    Parses specified column as float.

    Parses specified column as float.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Float, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.float(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  25. def float(columnName: String)(implicit c: Column[Float]): RowParser[Float]

    Parses specified column as float.

    Parses specified column as float.

    import anorm.{ SQL, SqlParser }
    
    val t: (Float, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.float("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  26. def folder[T](z: T)(f: (T, Any, MetaDataItem) ⇒ Either[SqlRequestError, T]): RowParser[T]

    Returns a parser that fold over the row.

    Returns a parser that fold over the row.

    val p: RowParser[List[(Any, String)]] =
      SqlParser.folder(List.empty[(Any, String)]) { (ls, v, m) =>
        Right((v, m.clazz) :: ls)
      }
  27. def get[T](position: Int)(implicit extractor: Column[T]): RowParser[T]

    Returns row parser for column at given position.

    Returns row parser for column at given position.

    position

    Column position, from 1 to n

    import anorm.SQL
    import anorm.SqlParser.get
    
    val res: (Float, String) = // parsing columns #1 & #3
      SQL("SELECT * FROM Test").as(get[String](1) ~ get[Float](3) map {
        case str ~ f => (f -> str)
      } *)
  28. def get[T](name: String)(implicit extractor: Column[T]): RowParser[T]

    Returns row parser for column with given name.

    Returns row parser for column with given name.

    name

    Column name

    import anorm.SQL
    import anorm.SqlParser.get
    
    val title: String = SQL("SELECT title FROM Books").
      as(get[String]("title").single)
  29. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  30. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def int(columnPosition: Int)(implicit c: Column[Int]): RowParser[Int]

    Parses specified column as integer.

    Parses specified column as integer.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Int, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.int(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  32. def int(columnName: String)(implicit c: Column[Int]): RowParser[Int]

    Parses specified column as integer.

    Parses specified column as integer.

    import anorm.{ SQL, SqlParser }
    
    val t: (Int, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.int("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. def list[T](columnPosition: Int)(implicit c: Column[List[T]]): RowParser[List[T]]

    Parses specified array column as list.

    Parses specified array column as list.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (String, List[String]) = SQL("SELECT a, sqlArrayOfString FROM test")
      .as(SqlParser.str("a") ~ SqlParser.list(2) map (
        SqlParser.flatten) single)
  35. def list[T](columnName: String)(implicit c: Column[List[T]]): RowParser[List[T]]

    Parses specified array column as list.

    Parses specified array column as list.

    import anorm.{ SQL, SqlParser }
    
    val t: (String, List[String]) = SQL("SELECT a, sqlArrayOfString FROM test")
      .as(SqlParser.str("a") ~ SqlParser.list("sqlArrayOfString") map (
        SqlParser.flatten) single)
  36. def long(columnPosition: Int)(implicit c: Column[Long]): RowParser[Long]

    Parses specified column as long.

    Parses specified column as long.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Long, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.long(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  37. def long(columnName: String)(implicit c: Column[Long]): RowParser[Long]

    Parses specified column as long.

    Parses specified column as long.

    import anorm.{ SQL, SqlParser }
    
    val t: (Long, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.long("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  38. def matches[TT, T <: TT](column: String, value: T)(implicit arg0: Column[TT], c: Column[TT]): RowParser[Boolean]

    Returns row parser which true if specified column is found and matching expected value.

    Returns row parser which true if specified column is found and matching expected value.

    import anorm.SQL
    import anorm.SqlParser.matches
    
    val m: Boolean = SQL("SELECT * FROM table").as(matches("a", 1.2f).single)
    // true if column |a| is found and matching 1.2f, otherwise false
    returns

    true if matches, or false if not

  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  42. def scalar[T](implicit transformer: Column[T]): RowParser[T]

    Returns a parser for a scalar not-null value.

    Returns a parser for a scalar not-null value.

    val count = SQL("select count(*) from Country").as(scalar[Long].single)
  43. def short(columnPosition: Int)(implicit c: Column[Short]): RowParser[Short]

    Parses specified column as short.

    Parses specified column as short.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Short, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.short(1) ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  44. def short(columnName: String)(implicit c: Column[Short]): RowParser[Short]

    Parses specified column as short.

    Parses specified column as short.

    import anorm.{ SQL, SqlParser }
    
    val t: (Short, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.short("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  45. def str(columnPosition: Int)(implicit c: Column[String]): RowParser[String]

    Parses specified column as string.

    Parses specified column as string.

    columnPosition

    from 1 to n

    import anorm.{ SQL, SqlParser }
    
    val t: (Float, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.float("a") ~ SqlParser.str(1) map (
        SqlParser.flatten) single)
  46. def str(columnName: String)(implicit c: Column[String]): RowParser[String]

    Parses specified column as string.

    Parses specified column as string.

    import anorm.{ SQL, SqlParser }
    
    val t: (Float, String) = SQL("SELECT a, b FROM test")
      .as(SqlParser.float("a") ~ SqlParser.str("b") map (
        SqlParser.flatten) single)
  47. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  48. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17], T18], T19], T20], T21], T22]) ⇒ R
    Definition Classes
    FunctionAdapter
  49. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17], T18], T19], T20], T21]) ⇒ R
    Definition Classes
    FunctionAdapter
  50. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17], T18], T19], T20]) ⇒ R
    Definition Classes
    FunctionAdapter
  51. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17], T18], T19]) ⇒ R
    Definition Classes
    FunctionAdapter
  52. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17], T18]) ⇒ R
    Definition Classes
    FunctionAdapter
  53. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16], T17]) ⇒ R
    Definition Classes
    FunctionAdapter
  54. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15], T16]) ⇒ R
    Definition Classes
    FunctionAdapter
  55. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14], T15]) ⇒ R
    Definition Classes
    FunctionAdapter
  56. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13], T14]) ⇒ R
    Definition Classes
    FunctionAdapter
  57. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12], T13]) ⇒ R
    Definition Classes
    FunctionAdapter
  58. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) ⇒ R): (~[~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11], T12]) ⇒ R
    Definition Classes
    FunctionAdapter
  59. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) ⇒ R): (~[~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10], T11]) ⇒ R
    Definition Classes
    FunctionAdapter
  60. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ⇒ R): (~[~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9], T10]) ⇒ R
    Definition Classes
    FunctionAdapter
  61. def to[T1, T2, T3, T4, T5, T6, T7, T8, T9, R](f: (T1, T2, T3, T4, T5, T6, T7, T8, T9) ⇒ R): (~[~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8], T9]) ⇒ R
    Definition Classes
    FunctionAdapter
  62. def to[T1, T2, T3, T4, T5, T6, T7, T8, R](f: (T1, T2, T3, T4, T5, T6, T7, T8) ⇒ R): (~[~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7], T8]) ⇒ R
    Definition Classes
    FunctionAdapter
  63. def to[T1, T2, T3, T4, T5, T6, T7, R](f: (T1, T2, T3, T4, T5, T6, T7) ⇒ R): (~[~[~[~[~[~[T1, T2], T3], T4], T5], T6], T7]) ⇒ R
    Definition Classes
    FunctionAdapter
  64. def to[T1, T2, T3, T4, T5, T6, R](f: (T1, T2, T3, T4, T5, T6) ⇒ R): (~[~[~[~[~[T1, T2], T3], T4], T5], T6]) ⇒ R
    Definition Classes
    FunctionAdapter
  65. def to[T1, T2, T3, T4, T5, R](f: (T1, T2, T3, T4, T5) ⇒ R): (~[~[~[~[T1, T2], T3], T4], T5]) ⇒ R
    Definition Classes
    FunctionAdapter
  66. def to[T1, T2, T3, T4, R](f: (T1, T2, T3, T4) ⇒ R): (~[~[~[T1, T2], T3], T4]) ⇒ R
    Definition Classes
    FunctionAdapter
  67. def to[T1, T2, T3, R](f: (T1, T2, T3) ⇒ R): (~[~[T1, T2], T3]) ⇒ R
    Definition Classes
    FunctionAdapter
  68. def to[T1, T2, R](f: (T1, T2) ⇒ R): (~[T1, T2]) ⇒ R
    Definition Classes
    FunctionAdapter
  69. def to[T1, R](f: (T1) ⇒ R): (T1) ⇒ R
    Definition Classes
    FunctionAdapter
  70. def toString(): String
    Definition Classes
    AnyRef → Any
  71. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from FunctionAdapter

Inherited from AnyRef

Inherited from Any

Ungrouped