DbCodec

com.augustnagro.magnum.DbCodec
See theDbCodec companion object
trait DbCodec[E]

Typeclass for JDBC reading & writing.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AnyCodec.type
object BooleanCodec.type
object ByteArrayCodec.type
object ByteCodec.type
object ByteIArrayCodec.type
object DoubleCodec.type
object FloatCodec.type
object IntCodec.type
object JavaBigDecimalCodec.type
object LongCodec.type
object OffsetDateTimeCodec.type
object RowIdCodec.type
object ScalaBigDecimalCodec.type
object ShortCodec.type
object SqlBlobCodec.type
object SqlClobCodec.type
object SqlDateCodec.type
object SqlNClobCodec.type
object SqlRefCodec.type
object SqlTimeCodec.type
object SqlTimestampCodec.type
object SqlXmlCodec.type
object StringCodec.type
object URLCodec.type
object UUIDCodec.type
object VarCharUUIDCodec.type
Show all
Self type
DbCodec[E]

Members list

Value members

Abstract methods

def cols: IArray[Int]

The java.sql.Types constant for every "?" in queryRepr. For mapping database-specific types, Types.JAVA_OBJECT is recommended.

The java.sql.Types constant for every "?" in queryRepr. For mapping database-specific types, Types.JAVA_OBJECT is recommended.

Attributes

def queryRepr: String

Syntax used when querying the db. For example,

Syntax used when querying the db. For example,

DbCodec[Int].queryRepr == "?"

DbCodec[(String, Boolean)].queryRepr = "(?, ?)"

case class User(id: Long, name: String) derives DbCodec DbCodec[User].queryRepr = "? ?"

Attributes

def readSingle(resultSet: ResultSet, pos: Int): E

Read an E from the ResultSet starting at position pos and ending after reading cols number of columns. Make sure the ResultSet is in a valid state (ie, ResultSet::next has been called).

Read an E from the ResultSet starting at position pos and ending after reading cols number of columns. Make sure the ResultSet is in a valid state (ie, ResultSet::next has been called).

Attributes

def writeSingle(entity: E, ps: PreparedStatement, pos: Int): Unit

Write the entity to the PreparedStatement starting at position pos

Write the entity to the PreparedStatement starting at position pos

Attributes

Concrete methods

def biMap[E2](to: E => E2, from: E2 => E): DbCodec[E2]
def read(resultSet: ResultSet): Vector[E]

Build every row in the ResultSet into a sequence of E. The ResultSet should be in its initial position before calling (ie, ResultSet::next not called).

Build every row in the ResultSet into a sequence of E. The ResultSet should be in its initial position before calling (ie, ResultSet::next not called).

Attributes

def readSingle(resultSet: ResultSet): E

Build an E from the ResultSet starting at position 1 and ending after reading cols number of columns. Make sure the ResultSet is in a valid state (ie, ResultSet::next has been called).

Build an E from the ResultSet starting at position 1 and ending after reading cols number of columns. Make sure the ResultSet is in a valid state (ie, ResultSet::next has been called).

Attributes

def write(entities: Iterable[E], ps: PreparedStatement): Unit

Writes multiple entities to the preparedStatement via PreparedStatement::addBatch

Writes multiple entities to the preparedStatement via PreparedStatement::addBatch

Attributes

def writeSingle(entity: E, ps: PreparedStatement): Unit

Write the entity to the resultSet starting at position 1

Write the entity to the resultSet starting at position 1

Attributes