// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final String DRIVER_NAME = "cloudspanner";
// 
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final Option<String> INSTANCE = Option.valueOf("instance");


import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.DRIVER_NAME;
import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.INSTANCE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DATABASE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DRIVER;
import com.google.cloud.ServiceOptions;
import io.r2dbc.spi.Connection;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactory;
import io.r2dbc.spi.ConnectionFactoryOptions;
import io.r2dbc.spi.Option;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
    int suffix = Math.abs(this.random.nextInt());
    Mono.from(
        this.connection
            .createStatement(INSERT_DATA_QUERY)
            .bind("uuid", "autoinserted-" + suffix)
            .bind("title", title)
            .bind("category", category)
            .execute())
        .flatMapMany(rs -> rs.getRowsUpdated())
        .blockLast();
  }

  public void clearTestData() {

    Mono.from(
        this.connection.createStatement("DELETE FROM BOOKS WHERE true").execute())
        .flatMap(rs -> Mono.from(rs.getRowsUpdated()))
        .block();
  }

  public void close() {
    Mono.from(this.connection.close()).block();
  }

  public static void main(String[] args) {
    ConnectionFactory cf =
        ConnectionFactories.get(
            ConnectionFactoryOptions.builder()
                .option(Option.valueOf("project"), ServiceOptions.getDefaultProjectId())
                .option(DRIVER, DRIVER_NAME)
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final String DRIVER_NAME = "cloudspanner";
// 
// Path: cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/SpannerConnectionFactoryProvider.java
// public static final Option<String> INSTANCE = Option.valueOf("instance");


// Path: cloud-spanner-r2dbc/src/test/java/com/google/cloud/spanner/r2dbc/it/TestDatabaseHelper.java
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.DRIVER_NAME;
import static com.google.cloud.spanner.r2dbc.SpannerConnectionFactoryProvider.INSTANCE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DATABASE;
import static io.r2dbc.spi.ConnectionFactoryOptions.DRIVER;
import com.google.cloud.ServiceOptions;
import io.r2dbc.spi.Connection;
import io.r2dbc.spi.ConnectionFactories;
import io.r2dbc.spi.ConnectionFactory;
import io.r2dbc.spi.ConnectionFactoryOptions;
import io.r2dbc.spi.Option;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

    int suffix = Math.abs(this.random.nextInt());
    Mono.from(
        this.connection
            .createStatement(INSERT_DATA_QUERY)
            .bind("uuid", "autoinserted-" + suffix)
            .bind("title", title)
            .bind("category", category)
            .execute())
        .flatMapMany(rs -> rs.getRowsUpdated())
        .blockLast();
  }

  public void clearTestData() {

    Mono.from(
        this.connection.createStatement("DELETE FROM BOOKS WHERE true").execute())
        .flatMap(rs -> Mono.from(rs.getRowsUpdated()))
        .block();
  }

  public void close() {
    Mono.from(this.connection.close()).block();
  }

  public static void main(String[] args) {
    ConnectionFactory cf =
        ConnectionFactories.get(
            ConnectionFactoryOptions.builder()
                .option(Option.valueOf("project"), ServiceOptions.getDefaultProjectId())
                .option(DRIVER, DRIVER_NAME)
                .option(INSTANCE, DatabaseProperties.INSTANCE)