Java Code Examples for io.vertx.sqlclient.Tuple#of()

The following examples show how to use io.vertx.sqlclient.Tuple#of() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PgClientExamples.java    From vertx-sql-client with Apache License 2.0 6 votes vote down vote up
public void jsonExample() {

    // Create a tuple
    Tuple tuple = Tuple.of(
      Tuple.JSON_NULL,
      new JsonObject().put("foo", "bar"),
      3);

    // Retrieving json
    Object value = tuple.getValue(0); // Expect JSON_NULL

    //
    value = tuple.get(JsonObject.class, 1); // Expect JSON object

    //
    value = tuple.get(Integer.class, 2); // Expect 3
    value = tuple.getInteger(2); // Expect 3
  }
 
Example 2
Source File: MySQLClientExamples.java    From vertx-sql-client with Apache License 2.0 6 votes vote down vote up
public void jsonExample() {

    // Create a tuple
    Tuple tuple = Tuple.of(
      Tuple.JSON_NULL,
      new JsonObject().put("foo", "bar"),
      3);

    // Retrieving json
    Object value = tuple.getValue(0); // Expect JSON_NULL

    //
    value = tuple.get(JsonObject.class, 1); // Expect JSON object

    //
    value = tuple.get(Integer.class, 2); // Expect 3
    value = tuple.getInteger(2); // Expect 3
  }
 
Example 3
Source File: PgClientExamples.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
public void arrayExample() {
  // Create a tuple with a single array
  Tuple tuple = Tuple.of(new String[]{ "a", "tuple", "with", "arrays" });

  // Add a string array to the tuple
  tuple.addStringArray(new String[]{"another", "array"});

  // Get the first array of string
  String[] array = tuple.getStringArray(0);
}
 
Example 4
Source File: TupleTest.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
@Override
Tuple of(Object... elements) {
  if (elements.length == 0) {
    throw new IllegalArgumentException();
  }
  return Tuple.of(elements[0], Arrays.copyOfRange(elements, 1, elements.length));
}