google-cloud-spanner 0.34.1-preview

Google Cloud Client Libraries for Rust - Spanner
Documentation
// Copyright 2026 Google LLC
//
// 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
//
//     https://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.
//
// Code generated by sidekick. DO NOT EDIT.

/// A dyn-compatible, crate-private version of [super::Spanner].
#[async_trait::async_trait]
pub trait Spanner: std::fmt::Debug + Send + Sync {
    async fn create_session(
        &self,
        req: crate::model::CreateSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Session>>;

    async fn batch_create_sessions(
        &self,
        req: crate::model::BatchCreateSessionsRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::BatchCreateSessionsResponse>>;

    async fn get_session(
        &self,
        req: crate::model::GetSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Session>>;

    async fn list_sessions(
        &self,
        req: crate::model::ListSessionsRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ListSessionsResponse>>;

    async fn delete_session(
        &self,
        req: crate::model::DeleteSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<()>>;

    async fn execute_sql(
        &self,
        req: crate::model::ExecuteSqlRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ResultSet>>;

    async fn execute_batch_dml(
        &self,
        req: crate::model::ExecuteBatchDmlRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ExecuteBatchDmlResponse>>;

    async fn read(
        &self,
        req: crate::model::ReadRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ResultSet>>;

    async fn begin_transaction(
        &self,
        req: crate::model::BeginTransactionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Transaction>>;

    async fn commit(
        &self,
        req: crate::model::CommitRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::CommitResponse>>;

    async fn rollback(
        &self,
        req: crate::model::RollbackRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<()>>;

    async fn partition_query(
        &self,
        req: crate::model::PartitionQueryRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::PartitionResponse>>;

    async fn partition_read(
        &self,
        req: crate::model::PartitionReadRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::PartitionResponse>>;
}

/// All implementations of [super::Spanner] also implement [Spanner].
#[async_trait::async_trait]
impl<T: super::Spanner> Spanner for T {
    /// Forwards the call to the implementation provided by `T`.
    async fn create_session(
        &self,
        req: crate::model::CreateSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Session>> {
        T::create_session(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn batch_create_sessions(
        &self,
        req: crate::model::BatchCreateSessionsRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::BatchCreateSessionsResponse>> {
        T::batch_create_sessions(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn get_session(
        &self,
        req: crate::model::GetSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Session>> {
        T::get_session(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn list_sessions(
        &self,
        req: crate::model::ListSessionsRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ListSessionsResponse>> {
        T::list_sessions(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn delete_session(
        &self,
        req: crate::model::DeleteSessionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<()>> {
        T::delete_session(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn execute_sql(
        &self,
        req: crate::model::ExecuteSqlRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ResultSet>> {
        T::execute_sql(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn execute_batch_dml(
        &self,
        req: crate::model::ExecuteBatchDmlRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ExecuteBatchDmlResponse>> {
        T::execute_batch_dml(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn read(
        &self,
        req: crate::model::ReadRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::ResultSet>> {
        T::read(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn begin_transaction(
        &self,
        req: crate::model::BeginTransactionRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::Transaction>> {
        T::begin_transaction(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn commit(
        &self,
        req: crate::model::CommitRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::CommitResponse>> {
        T::commit(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn rollback(
        &self,
        req: crate::model::RollbackRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<()>> {
        T::rollback(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn partition_query(
        &self,
        req: crate::model::PartitionQueryRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::PartitionResponse>> {
        T::partition_query(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn partition_read(
        &self,
        req: crate::model::PartitionReadRequest,
        options: crate::RequestOptions,
    ) -> crate::Result<crate::Response<crate::model::PartitionResponse>> {
        T::partition_read(self, req, options).await
    }
}