Trait

anorm

PGJson

Related Doc: package anorm

Permalink

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. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit object JsObjectParameterMetaData extends ParameterMetaData[JsObject]

    Permalink
  5. implicit object JsValueParameterMetaData extends ParameterMetaData[JsValue]

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def asJson[T](value: T)(implicit w: Writes[T]): ParameterValue

    Permalink

    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()
  8. def asNullableJson[T](value: Option[T])(implicit w: Writes[T]): ParameterValue

    Permalink

    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()
  9. def clone(): AnyRef

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def fromJson[T](implicit r: Reads[T]): Column[T]

    Permalink

    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)
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  17. implicit val jsObjectColumn: Column[JsObject]

    Permalink

    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)
  18. implicit val jsValueColumn: Column[JsValue]

    Permalink

    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)
  19. implicit def jsValueToStatement[J <: JsValue]: ToStatement[J]

    Permalink

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

  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped