androidx.room3
Interfaces
PooledConnection |
A wrapper of |
Cmn
|
RoomDatabaseConstructor |
Defines a class that can instantiate the Room generated implementation of an 'abstract' |
Cmn
|
RoomOpenDelegateMarker |
Marker interface for Room's code generated delegate. |
Cmn
|
TransactionScope |
A |
Cmn
|
Transactor |
A |
Cmn
|
Classes
InvalidationTracker |
The invalidation tracker keeps track of tables modified by queries and notifies its created |
Cmn
android
N
|
MultiInstanceInvalidationService |
A |
android
|
RoomDatabase |
Base class for all Room databases. |
Cmn
android
N
|
RoomDatabase.Builder |
Builder for |
Cmn
android
N
|
RoomDatabase.Callback |
Callback for |
Cmn
android
N
|
RoomDatabase.MigrationContainer |
A container to hold migrations. |
Cmn
android
N
|
RoomDatabase.PrepackagedDatabaseCallback |
Callback for |
android
|
RoomRawQuery |
A query with an argument binding function. |
Cmn
|
Objects
FtsOptions |
Available option values that can be used with |
Cmn
|
Room |
Entry point for building and initializing a |
Cmn
android
N
JS
|
RoomWarnings |
The list of warnings that are produced by Room. |
Cmn
|
Annotations
AutoMigration |
Declares an automatic migration on a |
Cmn
|
BuiltInColumnTypeConverters |
Control flags for built-in column type converters. |
Cmn
|
ColumnInfo |
Allows specific customization about the column associated with the annotated property. |
Cmn
|
ColumnInfo.Collate |
Cmn
|
|
ColumnInfo.SQLiteTypeAffinity |
The SQLite column type constants that can be used in |
Cmn
|
ColumnTypeConverter |
Marks a function as a column type converter. |
Cmn
|
ColumnTypeConverters |
Registers additional |
Cmn
|
ConstructedBy |
Defines the |
Cmn
android
N
JS
|
Dao |
Marks the class as a Data Access Object. |
Cmn
|
DaoReturnTypeConverter |
Marks a function as a DAO function return type converter. |
Cmn
|
DaoReturnTypeConverters |
Specifies the classes that contain DAO return type converters that a RoomDatabase can use. |
Cmn
|
Database |
Marks a class as a |
Cmn
|
DatabaseView |
Marks a class as an SQLite view. |
Cmn
|
Delete |
Marks a function in a |
Cmn
|
DeleteColumn |
Repeatable annotation declaring the deleted columns in the |
Cmn
android
|
DeleteColumn.Entries |
Container annotation for the repeatable annotation |
android
|
DeleteTable |
Repeatable annotation declaring the deleted tables in the |
Cmn
android
|
DeleteTable.Entries |
Container annotation for the repeatable annotation |
android
|
Embedded |
Marks a property of an |
Cmn
|
Entity |
Marks a class as an entity. |
Cmn
|
ExperimentalRoomApi |
Marks declarations that are experimental in Room's APIs, which means that the design of the corresponding declarations may (or may not) lead to their changes in the future. |
Cmn
|
ForeignKey |
Declares a foreign key on another |
Cmn
|
ForeignKey.Action |
Constants definition for values that can be used in |
Cmn
|
Fts3 |
Marks an |
Cmn
|
Fts4 |
Marks an |
Cmn
|
Fts5 |
Marks an |
Cmn
|
Ignore |
Ignores the marked element from Room's processing logic. |
Cmn
|
Index |
Declares an index on an |
Cmn
|
Insert |
Marks a function in a |
Cmn
|
Junction |
Declares a junction to be used for joining a relationship. |
Cmn
|
MapColumn |
Declares which column is used to build a map or multimap return value in a |
Cmn
|
OnConflictStrategy |
Set of conflict handling strategies for various |
Cmn
|
PrimaryKey |
Marks a property in an |
Cmn
|
ProvidedAutoMigrationSpec |
Marks a |
Cmn
|
ProvidedColumnTypeConverter |
Marks a class containing |
Cmn
|
ProvidedDaoReturnTypeConverter |
Marks a class containing |
Cmn
|
Query |
Marks a function in a |
Cmn
|
RawQuery |
Marks a function in a |
Cmn
|
Relation |
A convenience annotation which can be used in a data object class to automatically fetch relation entities. |
Cmn
|
RenameColumn |
Repeatable annotation declaring the renamed columns in the |
Cmn
android
|
RenameColumn.Entries |
Container annotation for the repeatable annotation |
android
|
RenameTable |
Repeatable annotation declaring the renamed tables in the new version of an auto migration. |
Cmn
android
|
RenameTable.Entries |
Container annotation for the repeatable annotation |
android
|
RewriteQueriesToDropUnusedColumns |
When present, |
Cmn
|
SkipQueryVerification |
Skips database verification for the annotated element. |
Cmn
|
Transaction |
Marks a function in a |
Cmn
|
Update |
Marks a function in a |
Cmn
|
Upsert |
Marks a function in a |
Cmn
|
Enums
BuiltInColumnTypeConverters.State |
Control flags for built-in converters. |
Cmn
|
FtsOptions.Detail |
Cmn
|
|
FtsOptions.MatchInfo |
Cmn
|
|
FtsOptions.Order |
Cmn
|
|
Index.Order |
Cmn
|
|
OperationType |
Describes the type of database operation a |
Cmn
|
PrimaryKey.Algorithm |
The |
Cmn
|
RoomDatabase.JournalMode |
Journal modes for SQLite database. |
Cmn
android
N
|
Transactor.SQLiteTransactionType |
Transaction types. |
Cmn
|
Extension functions summary
suspend R |
<R : Any?> Transactor.deferredTransaction(block: suspend TransactionScope<R>.() -> R)Performs a |
Cmn
|
suspend R |
<R : Any?> Transactor.exclusiveTransaction(block: suspend TransactionScope<R>.() -> R)Performs a |
Cmn
|
suspend Unit |
PooledConnection.executeSQL(sql: String)Executes a single SQL statement that returns no values. |
Cmn
|
suspend R |
<R : Any?> Transactor.immediateTransaction(block: suspend TransactionScope<R>.() -> R)Performs a |
Cmn
|
suspend R |
<R : Any?> RoomDatabase.useReaderConnection(block: suspend (Transactor) -> R)Acquires a READ connection, suspending while waiting if none is available and then calling the |
Cmn
|
suspend R |
<R : Any?> RoomDatabase.useWriterConnection(block: suspend (Transactor) -> R)Acquires a WRITE connection, suspending while waiting if none is available and then calling the |
Cmn
|
suspend R |
<R : Any?> RoomDatabase.withReadTransaction(block: suspend TransactionScope<R>.() -> R)Acquire a READ connection and start a |
Cmn
|
suspend R |
<R : Any?> RoomDatabase.withWriteTransaction(block: suspend TransactionScope<R>.() -> R)Acquire a WRITE connection and start a |
Cmn
|
Extension functions
Transactor.deferredTransaction
suspend fun <R : Any?> Transactor.deferredTransaction(block: suspend TransactionScope<R>.() -> R): R
Performs a SQLiteTransactionType.DEFERRED within the block.
Transactor.exclusiveTransaction
suspend fun <R : Any?> Transactor.exclusiveTransaction(block: suspend TransactionScope<R>.() -> R): R
Performs a SQLiteTransactionType.EXCLUSIVE within the block.
PooledConnection.executeSQL
suspend fun PooledConnection.executeSQL(sql: String): Unit
Executes a single SQL statement that returns no values.
Transactor.immediateTransaction
suspend fun <R : Any?> Transactor.immediateTransaction(block: suspend TransactionScope<R>.() -> R): R
Performs a SQLiteTransactionType.IMMEDIATE within the block.
RoomDatabase.useReaderConnection
suspend fun <R : Any?> RoomDatabase.useReaderConnection(block: suspend (Transactor) -> R): R
Acquires a READ connection, suspending while waiting if none is available and then calling the block to use the connection once it is acquired. A RoomDatabase will have one or more READ connections. The connection to use in the block is an instance of Transactor that provides the capabilities for performing nested transactions.
Using the connection after block completes is prohibited.
The connection will be confined to the coroutine on which block executes, attempting to use the connection from a different coroutine will result in an error.
If the current coroutine calling this function already has a confined connection, then that connection is used.
A connection is a limited resource and should not be held for more than it is needed. The best practice in using connections is to avoid executing long-running computations within the block. If a caller has to wait too long to acquire a connection a SQLiteException will be thrown due to a timeout.
| Parameters | |
|---|---|
block: suspend (Transactor) -> R |
The code to use the connection. |
| Throws | |
|---|---|
SQLiteException |
when the database is closed or a thread confined connection needs to be upgraded or there is a timeout acquiring a connection. |
| See also | |
|---|---|
useWriterConnection |
RoomDatabase.useWriterConnection
suspend fun <R : Any?> RoomDatabase.useWriterConnection(block: suspend (Transactor) -> R): R
Acquires a WRITE connection, suspending while waiting if none is available and then calling the block to use the connection once it is acquired. A RoomDatabase will have only one WRITE connection. The connection to use in the block is an instance of Transactor that provides the capabilities for performing nested transactions.
Using the connection after block completes is prohibited.
The connection will be confined to the coroutine on which block executes, attempting to use the connection from a different coroutine will result in an error.
If the current coroutine calling this function already has a confined connection, then that connection is used as long as it isn't required to be upgraded to a writer. If an upgrade is required then a SQLiteException is thrown.
A connection is a limited resource and should not be held for more than it is needed. The best practice in using connections is to avoid executing long-running computations within the block. If a caller has to wait too long to acquire a connection a SQLiteException will be thrown due to a timeout.
| Parameters | |
|---|---|
block: suspend (Transactor) -> R |
The code to use the connection. |
| Throws | |
|---|---|
SQLiteException |
when the database is closed or a thread confined connection needs to be upgraded or there is a timeout acquiring a connection. |
| See also | |
|---|---|
useReaderConnection |
RoomDatabase.withReadTransaction
suspend fun <R : Any?> RoomDatabase.withReadTransaction(block: suspend TransactionScope<R>.() -> R): R
Acquire a READ connection and start a Transactor.SQLiteTransactionType.DEFERRED transaction to execute the given block within the transaction.
This function is a shorthand of:
roomDatabase.useReaderConnection { it.withTransaction(DEFERRED) { block() } }
RoomDatabase.withWriteTransaction
suspend fun <R : Any?> RoomDatabase.withWriteTransaction(block: suspend TransactionScope<R>.() -> R): R
Acquire a WRITE connection and start a Transactor.SQLiteTransactionType.IMMEDIATE transaction to execute the given block within the transaction.
This function is a shorthand of:
roomDatabase.useWriterConnection { it.withTransaction(IMMEDIATE) { block() } }