final class CassandraSession extends NoSerializationVerificationNeeded
Data Access Object for Cassandra. The statements are expressed in Apache Cassandra Query Language (CQL) syntax.
See even CQL for Datastax Enterprise.
The init
hook is called before the underlying session is used by other methods,
so it can be used for things like creating the keyspace and tables.
All methods are non-blocking.
- Source
- CassandraSession.scala
- Alphabetic
- By Inheritance
- CassandraSession
- NoSerializationVerificationNeeded
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CassandraSession(system: ActorSystem, sessionProvider: CqlSessionProvider, executionContext: ExecutionContext, log: LoggingAdapter, metricsCategory: String, init: (CqlSession) ⇒ Future[Done], onClose: () ⇒ Unit)
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
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
close(executionContext: ExecutionContext): Future[Done]
Closes the underlying Cassandra session.
Closes the underlying Cassandra session.
- executionContext
when used after actor system termination, the a different execution context must be provided
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
executeDDL(stmt: String): Future[Done]
Execute CQL commands to manage database resources (create, replace, alter, and drop tables, indexes, user-defined types, etc).
Execute CQL commands to manage database resources (create, replace, alter, and drop tables, indexes, user-defined types, etc).
The returned
Future
is completed when the command is done, or if the statement fails. -
def
executeWrite(stmt: String, bindValues: AnyRef*): Future[Done]
Prepare, bind and execute one statement in one go.
Prepare, bind and execute one statement in one go.
See Inserting and updating data.
The configured write consistency level is used.
The returned
Future
is completed when the statement has been successfully executed, or if it fails. -
def
executeWrite(stmt: Statement[_]): Future[Done]
Execute one statement.
Execute one statement. First you must
prepare
the statement and bind its parameters.See Inserting and updating data.
The configured write consistency level is used if a specific consistency level has not been set on the
Statement
.The returned
Future
is completed when the statement has been successfully executed, or if it fails. -
def
executeWriteBatch(batch: BatchStatement): Future[Done]
Execute several statements in a batch.
Execute several statements in a batch. First you must
prepare
the statements and bind its parameters.See Batching data insertion and updates.
The configured write consistency level is used if a specific consistency level has not been set on the
BatchStatement
.The returned
Future
is completed when the batch has been successfully executed, or if it fails. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
prepare(stmt: String): Future[PreparedStatement]
Create a
PreparedStatement
that can be bound and used inexecuteWrite
orselect
multiple times. -
def
select(stmt: String, bindValues: AnyRef*): Source[Row, NotUsed]
Prepare, bind and execute a select statement in one go.
Prepare, bind and execute a select statement in one go.
See Querying data.
The configured read consistency level is used.
Note that you have to connect a
Sink
that consumes the messages from thisSource
and thenrun
the stream. -
def
select(stmt: Future[Statement[_]]): Source[Row, NotUsed]
Execute a select statement created by
prepare
.Execute a select statement created by
prepare
.See Querying data.
The configured read consistency level is used if a specific consistency level has not been set on the
Statement
.Note that you have to connect a
Sink
that consumes the messages from thisSource
and thenrun
the stream. -
def
select(stmt: Statement[_]): Source[Row, NotUsed]
Execute a select statement.
Execute a select statement. First you must
prepare
the statement and bind its parameters.See Querying data.
The configured read consistency level is used if a specific consistency level has not been set on the
Statement
.Note that you have to connect a
Sink
that consumes the messages from thisSource
and thenrun
the stream. -
def
selectAll(stmt: String, bindValues: AnyRef*): Future[Seq[Row]]
Prepare, bind and execute a select statement in one go.
Prepare, bind and execute a select statement in one go. Only use this method when you know that the result is small, e.g. includes a
LIMIT
clause. Otherwise you should use theselect
method that returns aSource
.The configured read consistency level is used.
The returned
Future
is completed with the found rows. -
def
selectAll(stmt: Statement[_]): Future[Seq[Row]]
Execute a select statement.
Execute a select statement. First you must
prepare
the statement and bind its parameters. Only use this method when you know that the result is small, e.g. includes aLIMIT
clause. Otherwise you should use theselect
method that returns aSource
.The configured read consistency level is used if a specific consistency level has not been set on the
Statement
.The returned
Future
is completed with the found rows. -
def
selectOne(stmt: String, bindValues: AnyRef*): Future[Option[Row]]
Prepare, bind and execute a select statement that returns one row.
Prepare, bind and execute a select statement that returns one row.
The configured read consistency level is used.
The returned
Future
is completed with the first row, if any. -
def
selectOne(stmt: Statement[_]): Future[Option[Row]]
Execute a select statement that returns one row.
Execute a select statement that returns one row. First you must
prepare
the statement and bind its parameters.The configured read consistency level is used if a specific consistency level has not been set on the
Statement
.The returned
Future
is completed with the first row, if any. -
def
serverMetaData: Future[CassandraServerMetaData]
Meta data about the Cassandra server, such as its version.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
underlying(): Future[CqlSession]
The
Session
of the underlying Datastax Java Driver.The
Session
of the underlying Datastax Java Driver. Can be used in case you need to do something that is not provided by the API exposed by this class. Be careful to not use blocking calls. -
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
executeCreateTable(stmt: String): Future[Done]
See Creating a table.
See Creating a table.
The returned
Future
is completed when the table has been created, or if the statement fails.- Annotations
- @deprecated
- Deprecated
(Since version 0.100) Use executeDDL instead.
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.