package types
- Alphabetic
- Public
- Protected
Type Members
- case class Json(value: Buf, charset: Charset) extends Product with Serializable
A simple wrapper for json data (either JSON or JSONB).
A simple wrapper for json data (either JSON or JSONB).
This is meant to allow json libraries to parse out json without incurring the cost of going through its
String
representation.Most libraries should be able to extract their AST from this, but care must be taken in regards to the character set.
- sealed trait Kind extends AnyRef
- case class PgType(name: String, oid: Oid, kind: Kind) extends Product with Serializable
- trait ValueReads[T] extends AnyRef
Typeclass for decoding wire values to Scala/Java types.
Typeclass for decoding wire values to Scala/Java types.
Postgres has its own type system, so the mapping of postgres types to scala types is not 1:1. Furthermore, postgres allows creating custom types (i.e.: commonly enums, but any arbitrary type can effectively be created) which also require their own mapping to scala types.
The following built-in types and their corresponding scala / java types are provided (read this table as "Postgres Type X can be read into Scala / Java Type Y"):
Postgres Type
Scala / Java Type
BIGINT (int8)
Long
BOOL
Boolean
BYTEA (byte[])
Buf
CHARACTER(n)
String
DATE (date)
DOUBLE (float8)
Double
INET
Inet (java.net.InetAddress and a subnet)
INTEGER (int, int4)
Int and Long
JSON
String or Json
JSONB
NUMERIC (decimal)
BigDecimal
REAL (float4)
Float and Double
SMALLINT (int2)
Short, Int and Long. As well as Byte (bounds are checked), since Postgres doesn't have
int1
.TEXT
String
TIMESTAMP
TIMESTAMP WITH TIME ZONE
UUID
VARCHAR
String
- Note
numeric types don't have the same correspondence for reading and writing.
- See also
- trait ValueWrites[T] extends AnyRef
Typeclass for encoding Scala/Java types to Postgres wire values.
Typeclass for encoding Scala/Java types to Postgres wire values.
Postgres has its own type system, so the mapping of postgres types to scala types is not 1:1. Furthermore, postgres allows creating custom types (i.e.: commonly enums, but any arbitrary type can effectively be created) which also require their own mapping to scala types.
The following built-in types and their corresponding scala / java types are provided * (read this table as "Postgres Type X can be written from Scala / Java Type Y"):
Postgres Type
Scala / Java Type
BIGINT (int8)
Long, Int, Short, Byte
BOOL
Boolean
BYTEA (byte[])
Buf
CHARACTER(n)
String
DATE (date)
DOUBLE (float8)
Double, Float
INET
Inet (java.net.InetAddress and a subnet)
INTEGER (int, int4)
Int, Short, Byte
JSON
String or Json
JSONB
NUMERIC (decimal)
BigDecimal
REAL (float4)
Float
SMALLINT (int2)
Short and Byte
TEXT
String
TIMESTAMP
TIMESTAMP WITH TIME ZONE
UUID
VARCHAR
String
- Note
numeric types don't have the same correspondence for reading and writing.
- See also
Value Members
- object Kind
- object PgDate
Some utilities to deal with Postgres' internal date representations and boundaries.
- object PgNumeric
Some utilities to deal with Postgres' internal numeric representation.
- object PgTime
Some utilities to deal with Postgres' internal timestamp representations and boundaries.
- object PgType extends Serializable
- object ValueReads
- object ValueWrites