// 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/main/java/com/google/cloud/spanner/r2dbc/v2/JsonWrapper.java
// public class JsonWrapper {
//   private String jsonString;
// 
//   public JsonWrapper(String jsonString) {
//     this.jsonString = jsonString;
//   }
// 
//   protected Value getJsonVal() {
//     return Value.json(this.jsonString);
//   }
// 
//   public static JsonWrapper of(String jsonString) {
//     return new JsonWrapper(jsonString);
//   }
// 
//   @Override
//   public String toString() {
//     return this.jsonString;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
//     JsonWrapper that = (JsonWrapper) o;
//     return Objects.equal(this.jsonString, that.jsonString);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(this.jsonString);
//   }
// }


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.spanner.r2dbc.v2.JsonWrapper;
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 io.r2dbc.spi.Row;
import io.r2dbc.spi.RowMetadata;
import io.r2dbc.spi.Statement;
            + "  TITLE STRING(MAX) NOT NULL,"
            + "  EXTRADETAILS JSON"
            + ") PRIMARY KEY (ID)").execute())
        .doOnSuccess(x -> System.out.println("Table creation completed."))
        .block();
  }

  /**
   * Saves two books.
   */
  public void saveBooks() {
    Statement statement = this.connection.createStatement(
        "INSERT BOOKS "
            + "(ID, TITLE)"
            + " VALUES "
            + "(@id, @title)")
        .bind("id", "book1")
        .bind("title", "Book One")
        .add()
        .bind("id", "book2")
        .bind("title", "Book Two");


    Statement statement2 = this.connection.createStatement(
            "INSERT BOOKS "
                    + "(ID, TITLE, EXTRADETAILS)"
                    + " VALUES "
                    + "(@id, @title, @extradetails)")
            .bind("id", "book3")
            .bind("title", "Book Three")
// 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/main/java/com/google/cloud/spanner/r2dbc/v2/JsonWrapper.java
// public class JsonWrapper {
//   private String jsonString;
// 
//   public JsonWrapper(String jsonString) {
//     this.jsonString = jsonString;
//   }
// 
//   protected Value getJsonVal() {
//     return Value.json(this.jsonString);
//   }
// 
//   public static JsonWrapper of(String jsonString) {
//     return new JsonWrapper(jsonString);
//   }
// 
//   @Override
//   public String toString() {
//     return this.jsonString;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
//     JsonWrapper that = (JsonWrapper) o;
//     return Objects.equal(this.jsonString, that.jsonString);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(this.jsonString);
//   }
// }


// Path: cloud-spanner-r2dbc-samples/cloud-spanner-r2dbc-sample/src/main/java/com/example/BookExampleApp.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.spanner.r2dbc.v2.JsonWrapper;
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 io.r2dbc.spi.Row;
import io.r2dbc.spi.RowMetadata;
import io.r2dbc.spi.Statement;

            + "  TITLE STRING(MAX) NOT NULL,"
            + "  EXTRADETAILS JSON"
            + ") PRIMARY KEY (ID)").execute())
        .doOnSuccess(x -> System.out.println("Table creation completed."))
        .block();
  }

  /**
   * Saves two books.
   */
  public void saveBooks() {
    Statement statement = this.connection.createStatement(
        "INSERT BOOKS "
            + "(ID, TITLE)"
            + " VALUES "
            + "(@id, @title)")
        .bind("id", "book1")
        .bind("title", "Book One")
        .add()
        .bind("id", "book2")
        .bind("title", "Book Two");


    Statement statement2 = this.connection.createStatement(
            "INSERT BOOKS "
                    + "(ID, TITLE, EXTRADETAILS)"
                    + " VALUES "
                    + "(@id, @title, @extradetails)")
            .bind("id", "book3")
            .bind("title", "Book Three")
            .bind("extradetails", new JsonWrapper("{\"rating\":9,\"series\":true}"));