com.datastax.driver.core.querybuilder.Insert.using()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中com.datastax.driver.core.querybuilder.Insert.using()方法的一些代码示例,展示了Insert.using()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Insert.using()方法的具体详情如下:
包路径:com.datastax.driver.core.querybuilder.Insert
类名称:Insert
方法名:using

Insert.using介绍

[英]Returns the options for this INSERT statement.

Chain this with Options#and(Using) to add options.
[中]返回此INSERT语句的选项。
将此链接与选项#和(使用)链接以添加选项。

代码示例

代码示例来源:origin: apache/usergrid

.using(timeToLive)
.value("key", getPartitionKey(scope, rowKeyString, bucket))
.value("column1", DataType.text().serialize(columnName, ProtocolVersion.NEWEST_SUPPORTED))

代码示例来源:origin: apache/usergrid

@Override
public void writeMessageData( final UUID messageId, final DatabaseQueueMessageBody messageBody ) {
  Preconditions.checkArgument(QakkaUtils.isTimeUuid(messageId), "MessageId is not a type 1 UUID");
  logger.trace("writeMessageData {}", messageId);
  Statement insert = QueryBuilder.insertInto(TABLE_MESSAGE_DATA)
      .value( COLUMN_MESSAGE_ID, messageId)
      .value( COLUMN_MESSAGE_DATA, messageBody.getBlob())
      .value( COLUMN_CONTENT_TYPE, messageBody.getContentType())
    .using( QueryBuilder.ttl( maxTtl ) );
  cassandraClient.getApplicationSession().execute(insert);
}

代码示例来源:origin: apache/usergrid

.value("column1", DataType.serializeValue(key, ProtocolVersion.NEWEST_SUPPORTED))
.value("value", valueBuffer)
.using(usingTTL));
.value("column1", DataType.serializeValue(tokenUUID, ProtocolVersion.NEWEST_SUPPORTED))
.value("value", ByteBuffer.wrap( new byte[] { 0 } ))
.using(usingTTL));

代码示例来源:origin: jooby-project/jooby

private static String insertSQL(final String table, final int timeout) {
 Insert insertInto = insertInto(table)
   .value(ID, raw("?"))
   .value(CREATED_AT, raw("?"))
   .value(ACCESSED_AT, raw("?"))
   .value(SAVED_AT, raw("?"))
   .value(ATTRIBUTES, raw("?"));
 if (timeout > 0) {
  insertInto.using(ttl(timeout));
 }
 return insertInto.getQueryString();
}

代码示例来源:origin: apache/usergrid

.using(timeToLive)
.value("key", getMapEntryPartitionKey(scope, key))
.value("column1", DataType.cboolean().serialize(true, ProtocolVersion.NEWEST_SUPPORTED))
.using(timeToLive)
.value("key", getMapKeyPartitionKey(scope, bucket))
.value("column1", DataType.text().serialize(key, ProtocolVersion.NEWEST_SUPPORTED))

代码示例来源:origin: apache/usergrid

.value("column1", serializeUniqueValueColumn(ev))
.value("value", DataType.serializeValue(COL_VALUE, ProtocolVersion.NEWEST_SUPPORTED))
.using(ttl);

代码示例来源:origin: apache/usergrid

private Statement createWriteMessageStatement( DatabaseQueueMessage message ) {
  final UUID queueMessageId =  message.getQueueMessageId() == null ?
    QakkaUtils.getTimeUuid() : message.getQueueMessageId();
  final long shardId;
  if ( message.getShardId() != null ) {
    shardId = message.getShardId();
  } else if ( DatabaseQueueMessage.Type.DEFAULT.equals( message.getType() )) {
    Shard shard = shardStrategy.selectShard(
      message.getQueueName(), message.getRegion(), Shard.Type.DEFAULT, message.getQueueMessageId() );
    shardId = shard.getShardId();
  } else {
    Shard shard = shardStrategy.selectShard(
      message.getQueueName(), message.getRegion(), Shard.Type.INFLIGHT, message.getQueueMessageId() );
    shardId = shard.getShardId();
  }
  Statement insert = QueryBuilder.insertInto(getTableName(message.getType()))
    .value( COLUMN_QUEUE_NAME,       message.getQueueName())
    .value( COLUMN_REGION,           message.getRegion())
    .value( COLUMN_SHARD_ID,         shardId)
    .value( COLUMN_MESSAGE_ID,       message.getMessageId())
    .value( COLUMN_QUEUE_MESSAGE_ID, queueMessageId)
    .value( COLUMN_INFLIGHT_AT,      message.getInflightAt())
    .value( COLUMN_QUEUED_AT,        message.getQueuedAt())
    .using( QueryBuilder.ttl( maxTtl ) );
  return insert;
}

代码示例来源:origin: pulsarIO/realtime-analytics

insert.using(QueryBuilder.ttl(TTL));
insertRequest.add(insert);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

3.4
      })
    .using(ttl(24))
    .and(timestamp(42));
assertEquals(insert.toString(), query);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

.using(timestamp(42))
    .and(ttl(24));
assertEquals(insert.toString(), query);
       3.4
      })
    .using(ttl(24))
    .and(timestamp(42));
assertEquals(insert.toString(), query);
       3.4
      })
    .using(ttl(bindMarker()))
    .and(timestamp(bindMarker()));
assertEquals(insert.toString(), query);
insert =
  insertInto("foo", "bar")
    .using(timestamp(42))
    .values(
      new String[] {"a", "b"},
insert =
  insertInto("foo")
    .using(timestamp(42))
    .value("c", 123)
    .values(

代码示例来源:origin: io.zipkin.java/zipkin-storage-cassandra

private RegularStatement maybeUseTtl(Insert value) {
 return indexTtl == null
   ? value
   : value.using(QueryBuilder.ttl(QueryBuilder.bindMarker("ttl_")));
}

代码示例来源:origin: com.yugabyte/cassandra-driver-mapping

@Override
void modifyQueryString(BuiltStatement query) {
  ((Insert) query).using().and(
      QueryBuilder.ttl(QueryBuilder.bindMarker()));
}

代码示例来源:origin: com.yugabyte/cassandra-driver-mapping

@Override
void modifyQueryString(BuiltStatement query) {
  if (query instanceof Insert) {
    ((Insert) query).using().and(QueryBuilder.timestamp(QueryBuilder.bindMarker()));
  } else if (query instanceof Delete) {
    ((Delete) query).using().and(QueryBuilder.timestamp(QueryBuilder.bindMarker()));
  } else {
    throw new AssertionError("Unexpected query type: " + query.getClass());
  }
}

代码示例来源:origin: org.opennms.newts/newts-cassandra-search

@Override
public RegularStatement toStatement() {
  LOG.trace("Inserting metric in context: '{}' with resource id: '{}' with name: '{}'",
      m_context, m_resourceId, m_metric);
  return insertInto(Constants.Schema.T_METRICS)
      .value(Constants.Schema.C_METRICS_CONTEXT, m_context.getId())
      .value(Constants.Schema.C_METRICS_RESOURCE, m_resourceId)
      .value(Constants.Schema.C_METRICS_NAME, m_metric)
      .using(ttl(m_ttl));
}

代码示例来源:origin: org.opennms.newts/newts-cassandra-search

@Override
  public RegularStatement toStatement() {
    LOG.trace("Inserting attribute in context: '{}' with resource id: '{}' with name: '{}' and value: '{}'",
        m_context, m_resourceId, m_field, m_value);
    return insertInto(Constants.Schema.T_ATTRS)
      .value(Constants.Schema.C_ATTRS_CONTEXT, m_context.getId())
      .value(Constants.Schema.C_ATTRS_RESOURCE, m_resourceId)
      .value(Constants.Schema.C_ATTRS_ATTR, m_field)
      .value(Constants.Schema.C_ATTRS_VALUE, m_value)
      .using(ttl(m_ttl));
  }
}

代码示例来源:origin: OpenNMS/newts

@Override
  public RegularStatement toStatement() {
    LOG.trace("Inserting attribute in context: '{}' with resource id: '{}' with name: '{}' and value: '{}'",
        m_context, m_resourceId, m_field, m_value);
    return insertInto(Constants.Schema.T_ATTRS)
      .value(Constants.Schema.C_ATTRS_CONTEXT, m_context.getId())
      .value(Constants.Schema.C_ATTRS_RESOURCE, m_resourceId)
      .value(Constants.Schema.C_ATTRS_ATTR, m_field)
      .value(Constants.Schema.C_ATTRS_VALUE, m_value)
      .using(ttl(m_ttl));
  }
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

Factory(CassandraStorage storage, int indexTtl) {
 super(storage.autocompleteTtl, storage.autocompleteCardinality);
 session = storage.session();
 Insert insertQuery = QueryBuilder.insertInto(Tables.SERVICE_NAMES)
  .value("service_name", QueryBuilder.bindMarker("service_name"));
 if (indexTtl > 0) insertQuery.using(QueryBuilder.ttl(indexTtl));
 preparedStatement = session.prepare(insertQuery);
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

Factory(CassandraStorage storage, int indexTtl) {
 super(storage.autocompleteTtl, storage.autocompleteCardinality);
 session = storage.session();
 Insert insertQuery = QueryBuilder.insertInto(TABLE_AUTOCOMPLETE_TAGS)
  .value("key", QueryBuilder.bindMarker("key"))
  .value("value", QueryBuilder.bindMarker("value"));
 if (indexTtl > 0) insertQuery.using(QueryBuilder.ttl(indexTtl));
 preparedStatement = session.prepare(insertQuery);
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1

Factory(CassandraStorage storage, int indexTtl) {
 super(storage.autocompleteTtl, storage.autocompleteCardinality);
 session = storage.session();
 Insert insertQuery = QueryBuilder.insertInto(Tables.SPAN_NAMES)
  .value("service_name", QueryBuilder.bindMarker("service_name"))
  .value("bucket", 0) // bucket is deprecated on this index
  .value("span_name", QueryBuilder.bindMarker("span_name"));
 if (indexTtl > 0) insertQuery.using(QueryBuilder.ttl(indexTtl));
 preparedStatement = session.prepare(insertQuery);
}

代码示例来源:origin: org.jooby/jooby-cassandra

private static String insertSQL(final String table, final int timeout) {
 Insert insertInto = insertInto(table)
   .value(ID, raw("?"))
   .value(CREATED_AT, raw("?"))
   .value(ACCESSED_AT, raw("?"))
   .value(SAVED_AT, raw("?"))
   .value(ATTRIBUTES, raw("?"));
 if (timeout > 0) {
  insertInto.using(ttl(timeout));
 }
 return insertInto.getQueryString();
}

相关文章