Packages

p

io.rdbc

sapi

package sapi

Provides a Scala API for database connectivity.

Main class is a Connection that can be obtained using a ConnectionFactory.

Linear Supertypes
ImplicitsTrait, ImplicitsTrait, SqlInterpolatorTrait, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. sapi
  2. ImplicitsTrait
  3. ImplicitsTrait
  4. SqlInterpolatorTrait
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class ColumnMetadata(name: String, dbTypeId: String, cls: Option[Class[_]]) extends Product with Serializable

    Represents metadata of a database column.

    Represents metadata of a database column.

    name

    column name

    dbTypeId

    database vendor identifier of a datatype declared for the column

    cls

    JVM class that a database driver uses to represent values of the column

  2. trait Connection extends AnyRef

    Represents a database connection (session).

    Represents a database connection (session).

    Instances of implementations of this trait can be obtained using a ConnectionFactory. When clients are done with the connection, they are required to call a release method co clean up resources such as open sockets.

    Invoking any method of this trait when any previous operation has not completed yet is not allowed. Operation is considered complete when a resulting Future completes.

    Transaction management has to be done using beginTx, commitTx and rollbackTx methods. Using SQL statements to manage transaction state is not allowed.

    SqlWithParams instances passed to Connection's methods can be created using sql string interpolator, for example:

    import io.rdbc.sapi._
    
    val conn: Connection = ???
    val login = "jdoe"
    conn.statement(sql"select * from users where login = $login").executeForStream()

    Alternatively, when bare Strings are used as SQL statements, parameters are specified by name. Parameter name is an alphanumeric string starting with a letter, prefixed with a colon. Example:

    import io.rdbc.sapi._
    
    val conn: Connection = ???
    val login = "jdoe"
    conn.statement(sql"select * from users where login = :login")
        .bind("login" -> login)
        .executable.executeForStream()
  3. trait ConnectionFactory extends AnyRef

    Provides access to a database Connection.

    Provides access to a database Connection.

    Implementors must make the implementation of this trait thread-safe.

  4. implicit class Duration2Timeout extends AnyRef

    Duration to Timeout converter

    Duration to Timeout converter

    Definition Classes
    ImplicitsTrait
  5. trait ExecutableStatement extends AnyRef

    Represents an executable statement.

    Represents an executable statement.

    Executable statement is a statement that has all parameters provided and is ready to be executed.

  6. sealed trait KeyColumns extends AnyRef

    Specification of columns that generate keys

  7. case class NotNullParam[A](v: A) extends SqlParam[A] with Product with Serializable

    Not null parameter value.

  8. case class NullParam[A](cls: Class[A]) extends SqlParam[A] with Product with Serializable

    Null parameter value

  9. implicit class Opt2OptParam[A] extends AnyRef
    Definition Classes
    ImplicitsTrait
  10. class ResultSet extends Traversable[Row]

    Represents a set of rows returned by a database engine.

  11. trait Row extends AnyRef

    Represents a row of a result returned by a database engine.

    Represents a row of a result returned by a database engine.

    This class defines a set of methods that can be used to get values from the row either by a column name or by a column index. Each method has a version returning an Option to allow null-safe handling of SQL null values.

  12. case class RowMetadata(columns: ImmutIndexedSeq[ColumnMetadata]) extends Product with Serializable

    Represents a row meta data.

    Represents a row meta data.

    columns

    meta data for every row column

  13. trait RowPublisher extends Publisher[Row]

    A reactive streams specification's Publisher giving access to the rows.

    A reactive streams specification's Publisher giving access to the rows.

    When this publisher signals that it is complete clients can safely assume that a database is ready to accept new queries. If subscription is cancelled, however, clients have to wait for RowPublisher#done future to complete before issuing another query.

  14. trait SqlInterpolatorTrait extends AnyRef
  15. implicit class Sql extends AnyRef
    Definition Classes
    SqlInterpolatorTrait
  16. sealed trait SqlNumeric extends AnyRef

    General unbounded numeric type that extends BigDecimal to be able to represent NaN, positive infitnity and negative infinity.

  17. sealed trait SqlParam[A] extends AnyRef

    A statement parameter that can represent null (empty) values.

    A statement parameter that can represent null (empty) values.

    This trait is analogous to standard Option, but keeps type information for empty values. In some cases database engine cannot infer null parameter type - instances of this trait can be used then.

    An implicit conversion is provided from Option to instances of this trait - see Opt2OptParam.

    This trait does not provide any operations. It is recommended to use Option instances and at the final stage convert them to instances of this trait when passed as statement parameters.

  18. case class SqlWithParams(sql: String, params: ImmutIndexedSeq[Any]) extends Product with Serializable

    Represent a sql statement along with parameters.

    Represent a sql statement along with parameters. Instances of this class are supposed to be constructed using sql string interpolator like this:

    import io.rdbc.sapi._
    val id = 0
    val s: SqlWithParams = sql"select * from test where id = $id"

    Instances created by the interpolator can be composed:

    import io.rdbc.sapi._
    val x = 0
    val y = 0
    val s: SqlWithParams =
      sql"select * from test where x = $x" +
      sql"and y = $y"
  19. trait Statement extends AnyRef

    Represents a SQL statement

    Represents a SQL statement

    Methods of this trait allow to bind argument values to parameters either by name or index. Classes extending this trait can be used as an alternative to sql string interpolator - SqlInterpolator.

  20. final case class StatementOptions(generatedKeyCols: KeyColumns) extends Product with Serializable

    Statement options.

    Statement options.

    generatedKeyCols

    says what keys generated by the database should be returned

  21. final case class Timeout(value: Duration) extends AnyVal with Product with Serializable

    Represents a timeout

    Represents a timeout

    Annotations
    @implicitNotFound( ... )
  22. trait TypeConverter[T] extends AnyRef

    Represents a converter of values returned by database to type desired by a client.

    Represents a converter of values returned by database to type desired by a client.

    T

    conversion's target type

  23. class TypeConverterRegistry extends AnyRef

    A registry holding a map of type converters.

  24. trait TypeConvertersProvider extends AnyRef
  25. final case class Warning(msg: String, code: String) extends Product with Serializable

    Represents a warning emitted by a database engine during statement processing.

    Represents a warning emitted by a database engine during statement processing.

    msg

    database vendor specific warning message

    code

    database vendor specific warning code

Value Members

  1. object BuildInfo extends Product with Serializable

    This object was generated by sbt-buildinfo.

  2. object KeyColumns
  3. object SqlInterpolator extends SqlInterpolatorTrait
  4. object SqlNumeric
  5. object SqlParam
  6. object StatementOptions extends Serializable
  7. object Timeout extends Serializable

    Timeout companion

  8. object TypeConverterRegistry

    Factory of TypeConverterRegistry

Inherited from ImplicitsTrait

Inherited from ImplicitsTrait

Inherited from SqlInterpolatorTrait

Inherited from AnyRef

Inherited from Any

Ungrouped