public interface SpannerOperations
| Modifier and Type | Method and Description |
|---|---|
long |
count(Class entityClass)
Count how many objects are stored of the given type.
|
void |
delete(Class entityClass,
com.google.cloud.spanner.Key key)
Deletes an object based on a key.
|
void |
delete(Class entityClass,
com.google.cloud.spanner.KeySet keys)
Deletes objects given a set of keys.
|
void |
delete(Object object)
Deletes an object from storage.
|
void |
deleteAll(Iterable objects)
Deletes objects from storage in a batch.
|
long |
executeDmlStatement(com.google.cloud.spanner.Statement statement)
Execute a DML statement on Cloud Spanner.
|
void |
insert(Object object)
Insert an object into storage.
|
void |
insertAll(Iterable objects)
Insert objects into storage in batch.
|
<T> T |
performReadOnlyTransaction(Function<SpannerTemplate,T> operations,
SpannerReadOptions readOptions)
Performs multiple read-only operations in a single transaction.
|
<T> T |
performReadWriteTransaction(Function<SpannerTemplate,T> operations)
Performs multiple read and write operations in a single transaction.
|
<T> List<T> |
query(Class<T> entityClass,
com.google.cloud.spanner.Statement statement,
SpannerQueryOptions options)
Finds objects by using an SQL statement.
|
<A> List<A> |
query(Function<com.google.cloud.spanner.Struct,A> rowFunc,
com.google.cloud.spanner.Statement statement,
SpannerQueryOptions options)
Executes a given query string with tags and parameters and applies a given function to
each row of the result.
|
<T> List<T> |
queryAll(Class<T> entityClass,
SpannerPageableQueryOptions options)
Finds all objects of the given type.
|
<T> T |
read(Class<T> entityClass,
com.google.cloud.spanner.Key key)
Finds a single stored object using a key.
|
<T> List<T> |
read(Class<T> entityClass,
com.google.cloud.spanner.KeySet keys)
Finds objects stored from their keys.
|
<T> List<T> |
read(Class<T> entityClass,
com.google.cloud.spanner.KeySet keys,
SpannerReadOptions options)
Finds objects stored from their keys.
|
<T> T |
read(Class<T> entityClass,
com.google.cloud.spanner.Key key,
SpannerReadOptions options)
Finds a single stored object using a key.
|
<T> List<T> |
readAll(Class<T> entityClass)
Finds all objects of the given type.
|
<T> List<T> |
readAll(Class<T> entityClass,
SpannerReadOptions options)
Finds all objects of the given type.
|
void |
update(Object object)
Update an object already in storage.
|
void |
update(Object object,
Set<String> includeProperties)
Update an object in storage.
|
void |
update(Object object,
String... includeProperties)
Update an object in storage.
|
void |
updateAll(Iterable objects)
Update objects in batch.
|
void |
upsert(Object object)
Update or insert an object into storage.
|
void |
upsert(Object object,
Set<String> includeProperties)
Update or insert an object into storage.
|
void |
upsert(Object object,
String... includeProperties)
Update or insert an object into storage.
|
void |
upsertAll(Iterable objects)
Update or insert objects into storage in batch.
|
long executeDmlStatement(com.google.cloud.spanner.Statement statement)
statement - the DML statement to execute.<T> T read(Class<T> entityClass, com.google.cloud.spanner.Key key)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.key - the key of the object.<T> T read(Class<T> entityClass, com.google.cloud.spanner.Key key, SpannerReadOptions options)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.key - the key of the object.options - the Cloud Spanner read options with which to conduct the read operation.<T> List<T> read(Class<T> entityClass, com.google.cloud.spanner.KeySet keys, SpannerReadOptions options)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.keys - the keys of the objects to retrieve.options - the Cloud Spanner read options with which to conduct the read operation.<T> List<T> read(Class<T> entityClass, com.google.cloud.spanner.KeySet keys)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.keys - the keys of the objects to retrieve.<A> List<A> query(Function<com.google.cloud.spanner.Struct,A> rowFunc, com.google.cloud.spanner.Statement statement, SpannerQueryOptions options)
A - the type to convert each row Struct into.rowFunc - the function to apply to each row of the result.statement - the SQL statement used to select the objects.options - the options with which to run this query.<T> List<T> query(Class<T> entityClass, com.google.cloud.spanner.Statement statement, SpannerQueryOptions options)
T - the type of object to retrieve.entityClass - the type of object to retrieve.statement - the SQL statement used to select the objects.options - the Cloud Spanner read options with which to conduct the read operation.<T> List<T> readAll(Class<T> entityClass, SpannerReadOptions options)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.options - the Cloud Spanner read options with which to conduct the read operation.<T> List<T> readAll(Class<T> entityClass)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.<T> List<T> queryAll(Class<T> entityClass, SpannerPageableQueryOptions options)
T - the type of the object to retrieve.entityClass - the type of the object to retrieve.options - the Cloud Spanner query options with which to conduct the query operation.void delete(Class entityClass, com.google.cloud.spanner.Key key)
entityClass - the type of the object to delete.key - the key of the object to delete from storage.void delete(Object object)
object - the object to delete from storage.void deleteAll(Iterable objects)
objects - the objects to delete from storage.void delete(Class entityClass, com.google.cloud.spanner.KeySet keys)
entityClass - the type of object to delete.keys - the keys of the objects to delete.void insert(Object object)
object - the object to insert.void insertAll(Iterable objects)
objects - the objects to insert.void update(Object object)
object - the object to update.void updateAll(Iterable objects)
objects - the objects to update.void update(Object object, String... includeProperties)
object - the object to update.includeProperties - the properties to upsert. if none are given then all
properties are usedvoid update(Object object, Set<String> includeProperties)
object - the object to update.includeProperties - the properties to update. If null is given, then all
properties are used. Note that an empty Set means that no properties will
be used.void upsert(Object object)
object - the object to update or insert.void upsertAll(Iterable objects)
objects - the objects to update or insert.void upsert(Object object, String... includeProperties)
object - the object to update or insert.includeProperties - the properties to upsert. if none are given then all
properties are upserted.void upsert(Object object, Set<String> includeProperties)
object - the object to update or insert.includeProperties - the properties to update. If null is given, then all
properties are used. Note that an empty Set means that no properties will
be used.long count(Class entityClass)
entityClass - the type of object to count.<T> T performReadWriteTransaction(Function<SpannerTemplate,T> operations)
T - the final return type of the operations.operations - the function representing the operations to perform using a
SpannerOperations based on a single transaction.<T> T performReadOnlyTransaction(Function<SpannerTemplate,T> operations, SpannerReadOptions readOptions)
T - the final return type of the operations.operations - the function representing the operations to perform using a
SpannerOperations based on a single transaction.readOptions - allows the user to specify staleness for the read transactionCopyright © 2019 Pivotal Software, Inc.. All rights reserved.