com.google.api.services.spanner.v1.model.Mutation Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.spanner.v1.model;
/**
* A modification to one or more Cloud Spanner rows. Mutations can be applied to a Cloud Spanner
* database by sending them in a Commit call.
*
* This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Spanner API. For a detailed explanation see:
* https://developers.google.com/api-client-library/java/google-http-java-client/json
*
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class Mutation extends com.google.api.client.json.GenericJson {
/**
* Delete rows from a table. Succeeds whether or not the named rows were present.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private Delete delete;
/**
* Insert new rows in a table. If any of the rows already exist, the write or transaction fails
* with error `ALREADY_EXISTS`.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private Write insert;
/**
* Like insert, except that if the row already exists, then its column values are overwritten with
* the ones provided. Any column values not explicitly written are preserved. When using
* insert_or_update, just as when using insert, all `NOT NULL` columns in the table must be given
* a value. This holds true even when the row already exists and will therefore actually be
* updated.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private Write insertOrUpdate;
/**
* Like insert, except that if the row already exists, it is deleted, and the column values
* provided are inserted instead. Unlike insert_or_update, this means any values not explicitly
* written become `NULL`. In an interleaved table, if you create the child table with the `ON
* DELETE CASCADE` annotation, then replacing a parent row also deletes the child rows. Otherwise,
* you must delete the child rows before you replace the parent row.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private Write replace;
/**
* Update existing rows in a table. If any of the rows does not already exist, the transaction
* fails with error `NOT_FOUND`.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private Write update;
/**
* Delete rows from a table. Succeeds whether or not the named rows were present.
* @return value or {@code null} for none
*/
public Delete getDelete() {
return delete;
}
/**
* Delete rows from a table. Succeeds whether or not the named rows were present.
* @param delete delete or {@code null} for none
*/
public Mutation setDelete(Delete delete) {
this.delete = delete;
return this;
}
/**
* Insert new rows in a table. If any of the rows already exist, the write or transaction fails
* with error `ALREADY_EXISTS`.
* @return value or {@code null} for none
*/
public Write getInsert() {
return insert;
}
/**
* Insert new rows in a table. If any of the rows already exist, the write or transaction fails
* with error `ALREADY_EXISTS`.
* @param insert insert or {@code null} for none
*/
public Mutation setInsert(Write insert) {
this.insert = insert;
return this;
}
/**
* Like insert, except that if the row already exists, then its column values are overwritten with
* the ones provided. Any column values not explicitly written are preserved. When using
* insert_or_update, just as when using insert, all `NOT NULL` columns in the table must be given
* a value. This holds true even when the row already exists and will therefore actually be
* updated.
* @return value or {@code null} for none
*/
public Write getInsertOrUpdate() {
return insertOrUpdate;
}
/**
* Like insert, except that if the row already exists, then its column values are overwritten with
* the ones provided. Any column values not explicitly written are preserved. When using
* insert_or_update, just as when using insert, all `NOT NULL` columns in the table must be given
* a value. This holds true even when the row already exists and will therefore actually be
* updated.
* @param insertOrUpdate insertOrUpdate or {@code null} for none
*/
public Mutation setInsertOrUpdate(Write insertOrUpdate) {
this.insertOrUpdate = insertOrUpdate;
return this;
}
/**
* Like insert, except that if the row already exists, it is deleted, and the column values
* provided are inserted instead. Unlike insert_or_update, this means any values not explicitly
* written become `NULL`. In an interleaved table, if you create the child table with the `ON
* DELETE CASCADE` annotation, then replacing a parent row also deletes the child rows. Otherwise,
* you must delete the child rows before you replace the parent row.
* @return value or {@code null} for none
*/
public Write getReplace() {
return replace;
}
/**
* Like insert, except that if the row already exists, it is deleted, and the column values
* provided are inserted instead. Unlike insert_or_update, this means any values not explicitly
* written become `NULL`. In an interleaved table, if you create the child table with the `ON
* DELETE CASCADE` annotation, then replacing a parent row also deletes the child rows. Otherwise,
* you must delete the child rows before you replace the parent row.
* @param replace replace or {@code null} for none
*/
public Mutation setReplace(Write replace) {
this.replace = replace;
return this;
}
/**
* Update existing rows in a table. If any of the rows does not already exist, the transaction
* fails with error `NOT_FOUND`.
* @return value or {@code null} for none
*/
public Write getUpdate() {
return update;
}
/**
* Update existing rows in a table. If any of the rows does not already exist, the transaction
* fails with error `NOT_FOUND`.
* @param update update or {@code null} for none
*/
public Mutation setUpdate(Write update) {
this.update = update;
return this;
}
@Override
public Mutation set(String fieldName, Object value) {
return (Mutation) super.set(fieldName, value);
}
@Override
public Mutation clone() {
return (Mutation) super.clone();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy