object ValueWrites
- Alphabetic
- By Inheritance
- ValueWrites
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def by[A, B](f: (B) => A)(implicit writesA: ValueWrites[A]): ValueWrites[B]
Define a
ValueWrites[B]
in terms ofValueWrites[A]
andB => A
. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- implicit def optionWrites[T](implicit twrites: ValueWrites[T]): ValueWrites[Option[T]]
Returns a
ValueWrites[Option[T]]
that writesNULL
when the value isNone
and delegates to the underlying instance when the value isSome
. - def or[T](first: ValueWrites[T], second: ValueWrites[T]): ValueWrites[T]
If it accepts the given PgType, uses
first
to read the value, otherwise, usesecond
. - def simple[T](expect: PgType*)(write: (Writer, T) => Writer): ValueWrites[T]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- implicit def traversableWrites[F[X] <: Iterable[X], T](implicit twrites: ValueWrites[T]): ValueWrites[F[T]]
Returns a ValueWrites able to write a collection of [T] to a Postgres array type.
Returns a ValueWrites able to write a collection of [T] to a Postgres array type.
For example, this can produce ValueWrites[List[Int] for the PgType.Int4Array type.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- implicit lazy val writesBigDecimal: ValueWrites[BigDecimal]
Writes BigDecimal to PgType.Numeric.
- implicit lazy val writesBoolean: ValueWrites[Boolean]
Writes Boolean to PgType.Bool.
- implicit lazy val writesBuf: ValueWrites[Buf]
Writes Buf to PgType.Bytea.
- implicit lazy val writesByte: ValueWrites[Byte]
Writes Byte as a Short.
Writes Byte as a Short.
Postgres does not have a numeric 1-byte data type. So we use 2-byte value and check bounds. NOTE: Postgres does have a 1-byte data type (i.e.: "char" with quotes), but it's very tricky to use to store numbers, so it's unlikely to be useful in practice.
- See also
https://www.postgresql.org/docs/current/datatype-numeric.html
https://dba.stackexchange.com/questions/159090/how-to-store-one-byte-integer-in-postgresql
- implicit lazy val writesDouble: ValueWrites[Double]
Writes Double to PgType.Float8.
- implicit lazy val writesFloat: ValueWrites[Float]
Writes Float to PgType.Float4 or writesDouble.
- lazy val writesFloat4: ValueWrites[Float]
Writes Float to PgType.Float4.
- implicit lazy val writesInet: ValueWrites[Inet]
Writes Inet to PgType.Inet.
- implicit lazy val writesInstant: ValueWrites[Instant]
Writes java.time.Instant to PgType.Timestamptz or PgType.Timestamp.
- implicit lazy val writesInt: ValueWrites[Int]
Writes Int to PgType.Int4 or writesLong.
- lazy val writesInt2: ValueWrites[Short]
Writes Short to PgType.Int2.
- lazy val writesInt4: ValueWrites[Int]
Writes Int to PgType.Int4.
- implicit lazy val writesJson: ValueWrites[Json]
Writes Json to PgType.Json or PgType.Jsonb.
- implicit lazy val writesLocalDate: ValueWrites[LocalDate]
Writes java.time.LocalDate to PgType.Date.
- implicit lazy val writesLong: ValueWrites[Long]
Writes Long to PgType.Int8.
- implicit lazy val writesShort: ValueWrites[Short]
Writes Short to PgType.Int2 or writesInt
- implicit lazy val writesString: ValueWrites[String]
Writes String to any of PgType.Text, PgType.Json, PgType.Varchar, PgType.Bpchar, PgType.Name, PgType.Unknown.
- implicit lazy val writesUuid: ValueWrites[UUID]
Writes java.util.UUID to PgType.Uuid.