Packages

o

anorm.RowParser

successful

object successful extends RowParser[Row]

Row parser that result in successfully unchanged row.

Source
SqlParser.scala
Linear Supertypes
RowParser[Row], (Row) ⇒ SqlResult[Row], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. successful
  2. RowParser
  3. Function1
  4. AnyRef
  5. 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. def *: ResultSetParser[List[Row]]

    Returns possibly empty list parsed from result.

    Returns possibly empty list parsed from result.

    val price = 125
    SQL"SELECT name FROM item WHERE price < \$price".as(scalar[String].*)
    Definition Classes
    RowParser
  4. def +: ResultSetParser[List[Row]]

    Returns non empty list parse from result, or raise error if there is no result.

    Returns non empty list parse from result, or raise error if there is no result.

    import anorm.SQL
    import anorm.SqlParser.str
    
    val parser = str("title") ~ str("descr")
    SQL("SELECT title, descr FROM pages").as(parser.+) // at least 1 page
    Definition Classes
    RowParser
  5. def <~[B](p: RowParser[B]): RowParser[Row]

    Combines this current parser with the one given as argument p, if and only if the current parser can first successfully parse a row, without keeping the values of the parser p.

    Combines this current parser with the one given as argument p, if and only if the current parser can first successfully parse a row, without keeping the values of the parser p.

    import anorm.{ SQL, SqlParser }, SqlParser.{ int, str }
    
    val Int = SQL("SELECT * FROM test").
      as((int("id") <~ str("val")).single)
    // row has to have an int column 'id' and a string 'val' one,
    // keeping only 'id' in result
    Definition Classes
    RowParser
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def >>[B](f: (Row) ⇒ RowParser[B]): RowParser[B]

    Alias for flatMap

    Alias for flatMap

    Definition Classes
    RowParser
  8. def ?: RowParser[Option[Row]]

    Returns a row parser for optional column, that will turn missing or null column as None.

    Returns a row parser for optional column, that will turn missing or null column as None.

    Definition Classes
    RowParser
  9. def andThen[A](g: (SqlResult[Row]) ⇒ A): (Row) ⇒ A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  10. def apply(row: Row): SqlResult[Row]
    Definition Classes
    successful → Function1
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  13. def collect[B](otherwise: String)(f: PartialFunction[Row, B]): RowParser[B]

    Returns parser which collects information from already parsed row data using f.

    Returns parser which collects information from already parsed row data using f.

    otherwise

    Message returned as error if nothing can be collected using f.

    f

    Collecting function

    Definition Classes
    RowParser
  14. def compose[A](g: (A) ⇒ Row): (A) ⇒ SqlResult[Row]
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def flatMap[B](k: (Row) ⇒ RowParser[B]): RowParser[B]
    Definition Classes
    RowParser
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. def map[B](f: (Row) ⇒ B): RowParser[B]

    Returns a parser that will apply given function f to the result of this first parser.

    Returns a parser that will apply given function f to the result of this first parser. If the current parser is not successful, the new one will return encountered Error.

    f

    Function applied on the successful parser result

    import anorm.{ RowParser, SQL, SqlParser }
    
    val parser: RowParser[Int] = SqlParser.str("col").map(_.length)
    // Prepares a parser that first get 'col' string value,
    // and then returns the length of that
    Definition Classes
    RowParser
  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. def single: ResultSetParser[Row]

    Returns a result set parser expecting exactly one row to parse.

    Returns a result set parser expecting exactly one row to parse.

    val b: Boolean = SQL("SELECT flag FROM Test WHERE id = :id").
      on("id" -> 1).as(scalar[Boolean].single)
    Definition Classes
    RowParser
    See also

    #singleOpt

  27. def singleOpt: ResultSetParser[Option[Row]]

    Returns a result set parser for none or one parsed row.

    Returns a result set parser for none or one parsed row.

    val name: Option[String] =
      SQL("SELECT name FROM Country WHERE lang = :lang")
      .on("lang" -> "notFound").as(scalar[String].singleOpt)
    Definition Classes
    RowParser
  28. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  33. def |[B >: Row](p: RowParser[B]): RowParser[B]
    Definition Classes
    RowParser
  34. def ~[B](p: RowParser[B]): RowParser[~[Row, B]]

    Combines this parser on the left of the parser p given as argument.

    Combines this parser on the left of the parser p given as argument.

    p

    Parser on the right

    val populations: List[String ~ Int] =
      SQL("SELECT * FROM Country").as((str("name") ~ int("population")).*)
    Definition Classes
    RowParser
  35. def ~>[B](p: RowParser[B]): RowParser[B]

    Combines this current parser with the one given as argument p, if and only if the current parser can first/on left side successfully parse a row, without keeping these values in parsed result.

    Combines this current parser with the one given as argument p, if and only if the current parser can first/on left side successfully parse a row, without keeping these values in parsed result.

    import anorm.{ SQL, SqlParser }, SqlParser.{ int, str }
    
    val String = SQL("SELECT * FROM test").
      as((int("id") ~> str("val")).single)
    // row has to have an int column 'id' and a string 'val' one,
    // keeping only 'val' in result
    Definition Classes
    RowParser

Inherited from RowParser[Row]

Inherited from (Row) ⇒ SqlResult[Row]

Inherited from AnyRef

Inherited from Any

Ungrouped