Packages

t

anorm

PGJson

sealed trait PGJson extends AnyRef

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

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def asJson[T](value: T)(implicit w: Writes[T]): ParameterValue

    Sets a value as a JSON parameter.

    Sets a value as a JSON parameter.

    value

    the value to be passed as a JSON parameter

    w

    the Play writes to be used to serialized the value as JSON

    import play.api.libs.json._
    import anorm._, postgresql._
    
    case class Foo(bar: String)
    implicit val w: Writes[Foo] = Json.writes[Foo]
    
    implicit def con: java.sql.Connection = ???
    
    val value = asJson(Foo("lorem"))
    SQL("INSERT INTO test(id, json) VALUES({id}, {json})").
      on("id" -> "bar", "json" -> value).executeUpdate()
  6. def asNullableJson[T](value: Option[T])(implicit w: Writes[T]): ParameterValue

    Sets an optional value as a JSON parameters.

    Sets an optional value as a JSON parameters.

    value

    the optional value to be passed as a JSON parameter

    w

    the Play writes to be used to serialized the value as JSON

    import play.api.libs.json._
    import anorm._, postgresql._
    
    case class Foo(bar: String)
    implicit val w: Writes[Foo] = Json.writes[Foo]
    
    val someVal = asNullableJson(Some(Foo("lorem")))
    val noVal = asNullableJson(Option.empty[Foo])
    
    implicit def con: java.sql.Connection = ???
    
    SQL("INSERT INTO test(id, json) VALUES({id}, {json})").
      on("id" -> "bar", "json" -> someVal).executeUpdate()
    
    SQL("INSERT INTO test(id, json) VALUES({id}, {json})").
      on("id" -> "bar", "json" -> noVal).executeUpdate()
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. def fromJson[T](implicit r: Reads[T]): Column[T]

    r

    the Play reader to be used from the selected JSONB value

    import play.api.libs.json.Reads
    
    import anorm._, postgresql._
    
    case class Foo(bar: String)
    
    def foo(implicit con: java.sql.Connection, r: Reads[Foo]): Foo =
      SQL"SELECT json FROM test".
        as(SqlParser.scalar(fromJson[Foo]).single)
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. implicit val jsObjectColumn: Column[JsObject]

    import play.api.libs.json.JsObject
    
    import anorm._, postgresql._
    
    def foo(implicit con: java.sql.Connection) =
      SQL"SELECT json FROM test".as(SqlParser.scalar[JsObject].single)
  16. implicit val jsValueColumn: Column[JsValue]

    import play.api.libs.json.JsValue
    
    import anorm._, postgresql._
    
    def foo(implicit con: java.sql.Connection) =
      SQL"SELECT json FROM test".as(SqlParser.scalar[JsValue].single)
  17. implicit def jsValueToStatement[J <: JsValue]: ToStatement[J]

    Allows to pass a JsValue as parameter to be stored as PGobject.

  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. implicit object JsObjectParameterMetaData extends ParameterMetaData[JsObject]
  27. implicit object JsValueParameterMetaData extends ParameterMetaData[JsValue]

Inherited from AnyRef

Inherited from Any

Ungrouped