Tabnine Logo
SchemaBuilder.createType
Code IndexAdd Tabnine to your IDE (free)

How to use
createType
method
in
com.datastax.driver.core.schemabuilder.SchemaBuilder

Best Java code snippets using com.datastax.driver.core.schemabuilder.SchemaBuilder.createType (Showing top 20 results out of 315)

origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_UDT() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addColumn("col2", DataType.bigint());
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo("\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "col2 bigint)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_simple_UDT_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTColumn("my_udt", frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "my_udt frozen<address>)");
}
origin: com.datastax.cassandra/cassandra-driver-core

 @Test(groups = "unit")
 public void should_create_column_with_manual_type() throws Exception {
  // When
  SchemaStatement statement =
    createType("ks", "myType")
      .addColumn("col1", DataType.text())
      .addUDTColumn("my_udt", udtLiteral("frozen<address>"));

  // Then
  assertThat(statement.getQueryString())
    .isEqualTo(
      "\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "my_udt frozen<address>)");
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_set_UDT_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTSetColumn("my_udt", frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt set<frozen<address>>)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_list_UDT_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTListColumn("my_udt", frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt list<frozen<address>>)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_UDT_if_not_exists() throws Exception {
 // When
 SchemaStatement statement =
   createType("myType")
     .ifNotExists()
     .addColumn("col1", DataType.text())
     .addColumn("col2", DataType.bigint());
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE IF NOT EXISTS myType(\n\t\t" + "col1 text,\n\t\t" + "col2 bigint)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_value_UDT_map_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTMapColumn("my_udt", DataType.cint(), frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt map<int, frozen<address>>)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_key_UDT_map_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTMapColumn("my_udt", frozen("address"), DataType.text());
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt map<frozen<address>, text>)");
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "unit")
public void should_create_key_value_UDT_map_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTMapColumn("my_udt", frozen("coords"), frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt map<frozen<coords>, frozen<address>>)");
}
origin: apache/james-project

  public Builder statement(Function<CreateType, CreateType> createStatement) {
    return originalBuilderReference.addType(
      new CassandraType(typeName, createStatement.apply(
        SchemaBuilder.createType(typeName)
          .ifNotExists())));
  }
}
origin: org.apache.james/apache-james-backends-cassandra

  public Builder statement(Function<CreateType, CreateType> createStatement) {
    return originalBuilderReference.addType(
      new CassandraType(typeName, createStatement.apply(
        SchemaBuilder.createType(typeName)
          .ifNotExists())));
  }
}
origin: com.datastax.cassandra/cassandra-driver-core

session()
  .execute(
    createType(udt).addColumn("first", DataType.text()).addColumn("last", DataType.text()));
UserType userType = cluster().getMetadata().getKeyspace(keyspace).getUserType(udt);
assertThat(userType).isNotNull();
origin: com.datastax.cassandra/cassandra-driver-core

  SchemaBuilder.createType("ztype")
    .addColumn("c", DataType.text())
    .addColumn("a", DataType.cint()));
session.execute(SchemaBuilder.createType("xtype").addColumn("d", DataType.text()));
  SchemaBuilder.createType("ctype")
    .addColumn("\"Z\"", ks.getUserType("ztype").copy(true))
    .addColumn("x", ks.getUserType("xtype").copy(true)));
session.execute(SchemaBuilder.createType("btype").addColumn("a", DataType.text()));
  SchemaBuilder.createType("atype").addColumn("c", ks.getUserType("ctype").copy(true)));
origin: com.datastax.cassandra/cassandra-driver-core

  .execute(SchemaBuilder.createType("MyUDT").ifNotExists().addColumn("x", DataType.cint()));
UDTType myUDT = UDTType.frozen("MyUDT");
session()
origin: apache/james-project

@Test
void shouldRespectBeanContract() {
  EqualsVerifier.forClass(CassandraType.class)
      .withPrefabValues(CreateType.class, SchemaBuilder.createType("name1"), SchemaBuilder.createType("name2"))
      .verify();
}
origin: com.datastax.dse/dse-java-driver-core

@Test(groups = "unit")
public void should_create_UDT() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addColumn("col2", DataType.bigint());
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo("\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "col2 bigint)");
}
origin: com.datastax.dse/dse-java-driver-core

@Test(groups = "unit")
public void should_create_simple_UDT_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTColumn("my_udt", frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "my_udt frozen<address>)");
}
origin: com.datastax.dse/dse-java-driver-core

 @Test(groups = "unit")
 public void should_create_column_with_manual_type() throws Exception {
  // When
  SchemaStatement statement =
    createType("ks", "myType")
      .addColumn("col1", DataType.text())
      .addUDTColumn("my_udt", udtLiteral("frozen<address>"));

  // Then
  assertThat(statement.getQueryString())
    .isEqualTo(
      "\n\tCREATE TYPE ks.myType(\n\t\t" + "col1 text,\n\t\t" + "my_udt frozen<address>)");
 }
}
origin: com.datastax.dse/dse-java-driver-core

@Test(groups = "unit")
public void should_create_set_UDT_column() throws Exception {
 // When
 SchemaStatement statement =
   createType("ks", "myType")
     .addColumn("col1", DataType.text())
     .addUDTSetColumn("my_udt", frozen("address"));
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE ks.myType(\n\t\t"
       + "col1 text,\n\t\t"
       + "my_udt set<frozen<address>>)");
}
origin: com.datastax.dse/dse-java-driver-core

@Test(groups = "unit")
public void should_create_UDT_if_not_exists() throws Exception {
 // When
 SchemaStatement statement =
   createType("myType")
     .ifNotExists()
     .addColumn("col1", DataType.text())
     .addColumn("col2", DataType.bigint());
 // Then
 assertThat(statement.getQueryString())
   .isEqualTo(
     "\n\tCREATE TYPE IF NOT EXISTS myType(\n\t\t" + "col1 text,\n\t\t" + "col2 bigint)");
}
com.datastax.driver.core.schemabuilderSchemaBuildercreateType

Javadoc

Start building a new CREATE TYPE statement.

Popular methods of SchemaBuilder

  • createTable
    Start building a new CREATE TABLE statement.
  • createKeyspace
    Start building a new CREATE KEYSPACE statement.
  • dropKeyspace
    Start building a new DROP KEYSPACE statement.
  • dropTable
    Start building a new DROP TABLE statement.
  • leveledStrategy
    Create options for the leveled compaction strategy, to use in a CREATE or ALTER TABLE statement.
  • lz4
    Create options for the LZ4 compression strategy, to use in a CREATE or ALTER TABLE statement.
  • sizedTieredStategy
    Create options for the size-tiered compaction strategy, for use in a CREATE or ALTER TABLE statement
  • noSpeculativeRetry
    Create the speculative retry strategy that never retries reads, to use in a CREATE or ALTER TABLE st
  • createIndex
    Start building a new CREATE INDEX statement.
  • dateTieredStrategy
    Create options for the date-tiered compaction strategy, to use in a CREATE or ALTER TABLE statement.
  • deflate
    Create options for the Deflate compression strategy, to use in a CREATE or ALTER TABLE statement.
  • dropType
    Start building a new DROP TYPE statement.
  • deflate,
  • dropType,
  • noCompression,
  • snappy,
  • allRows,
  • alterKeyspace,
  • alterTable,
  • always,
  • dropIndex

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Collectors (java.util.stream)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now