本文整理了Java中org.jooq.Record.getValue
方法的一些代码示例,展示了Record.getValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.getValue
方法的具体详情如下:
包路径:org.jooq.Record
类名称:Record
方法名:getValue
[英]Get a value from this record, providing a field index.
[#2211] Future versions of jOOQ might remove the #getValue(int)method. It is recommended to use #get(int) instead.
[中]从这个记录中获取一个值,提供一个字段索引。
[#2211]jOOQ的未来版本可能会删除#getValue(int)方法。建议改用#get(int)。
代码示例来源:origin: my2iu/Jinq
@SuppressWarnings("unchecked")
@Override
public T readResult(Record results, int offset)
{
return (T)results.getValue(offset);
}
代码示例来源:origin: palantir/atlasdb
private static NavigableMap<byte[], SortedMap<byte[], Value>> breakUpValuesByRow(Result<? extends Record> records) {
NavigableMap<byte[], SortedMap<byte[], Value>> ret = Maps.newTreeMap(UnsignedBytes.lexicographicalComparator());
for (Record record : records) {
byte[] row = record.getValue(A_ROW_NAME);
SortedMap<byte[], Value> colMap = ret.computeIfAbsent(row,
rowName -> Maps.newTreeMap(UnsignedBytes.lexicographicalComparator()));
colMap.put(record.getValue(A_COL_NAME), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP)));
}
return ret;
}
代码示例来源:origin: palantir/atlasdb
private static NavigableMap<byte[], SortedMap<byte[], Set<Long>>> breakUpTimestampsByRow(Result<? extends Record> records) {
NavigableMap<byte[], SortedMap<byte[], Set<Long>>> ret = Maps.newTreeMap(UnsignedBytes.lexicographicalComparator());
for (Record record : records) {
byte[] row = record.getValue(A_ROW_NAME);
byte[] col = record.getValue(A_COL_NAME);
SortedMap<byte[], Set<Long>> colMap = ret.computeIfAbsent(row,
rowName -> Maps.newTreeMap(UnsignedBytes.lexicographicalComparator()));
Set<Long> tsSet = colMap.computeIfAbsent(col, ts -> Sets.newHashSet());
tsSet.add(record.getValue(A_TIMESTAMP));
}
return ret;
}
代码示例来源:origin: palantir/atlasdb
@Override
@Nullable
public PutBatch getNextBatch(Result<? extends Record> existingRecords) {
Map<Cell, byte[]> existing = Maps.newHashMapWithExpectedSize(existingRecords.size());
for (Record record : existingRecords) {
existing.put(
Cell.create(record.getValue(JdbcConstants.A_ROW_NAME), record.getValue(JdbcConstants.A_COL_NAME)),
record.getValue(JdbcConstants.A_VALUE));
}
Map<Cell, byte[]> nextBatch = Maps.newHashMap();
for (Entry<Cell, byte[]> entry : data.entrySet()) {
Cell cell = entry.getKey();
byte[] newValue = entry.getValue();
byte[] oldValue = existing.get(cell);
if (oldValue == null) {
nextBatch.put(cell, newValue);
} else if (!Arrays.equals(oldValue, newValue)) {
return null;
}
}
return new SingleTimestampPutBatch(nextBatch, timestamp);
}
代码示例来源:origin: palantir/atlasdb
private Map<Cell, Value> getRowsAllColumns(final TableReference tableRef,
final Iterable<byte[]> rows,
final long timestamp) {
if (Iterables.isEmpty(rows)) {
return ImmutableMap.of();
}
return run(ctx -> {
Select<? extends Record> query = getLatestTimestampQueryAllColumns(
ctx,
tableRef,
ImmutableList.copyOf(rows),
timestamp);
Result<? extends Record> records = fetchValues(ctx, tableRef, query);
Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size());
for (Record record : records) {
results.put(
Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP)));
}
return results;
});
}
代码示例来源:origin: my2iu/Jinq
private <K> void copyValueIntoRecord(T outputRecord, Record inputRecord, Field<K> field, int idx)
{
outputRecord.setValue(field, inputRecord.getValue(idx, field.getConverter()));
}
代码示例来源:origin: palantir/atlasdb
@Override
@Nullable
public PutBatch getNextBatch(Result<? extends Record> existingRecords) {
Map<CellTimestamp, byte[]> existing = Maps.newHashMapWithExpectedSize(existingRecords.size());
for (Record record : existingRecords) {
existing.put(
new CellTimestamp(record.getValue(JdbcConstants.A_ROW_NAME), record.getValue(JdbcConstants.A_COL_NAME), record.getValue(JdbcConstants.A_TIMESTAMP)),
record.getValue(JdbcConstants.A_VALUE));
}
Multimap<Cell, Value> nextBatch = ArrayListMultimap.create();
for (Entry<Cell, Value> entry : data.entries()) {
Cell cell = entry.getKey();
Value newValue = entry.getValue();
byte[] oldValue = existing.get(new CellTimestamp(cell.getRowName(), cell.getColumnName(), newValue.getTimestamp()));
if (oldValue == null) {
nextBatch.put(cell, newValue);
} else if (!Arrays.equals(oldValue, newValue.getContents())) {
return null;
}
}
return new MultiTimestampPutBatch(nextBatch);
}
代码示例来源:origin: palantir/atlasdb
private Map<Cell, Value> getRowsSomeColumns(final TableReference tableRef,
final Iterable<byte[]> rows,
final ColumnSelection columnSelection,
final long timestamp) {
if (Iterables.isEmpty(rows)) {
return ImmutableMap.of();
}
return run(ctx -> {
Select<? extends Record> query = getLatestTimestampQuerySomeColumns(
ctx,
tableRef,
ImmutableList.copyOf(rows),
columnSelection.getSelectedColumns(),
timestamp);
Result<? extends Record> records = fetchValues(ctx, tableRef, query);
Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size());
for (Record record : records) {
results.put(
Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP)));
}
return results;
});
}
代码示例来源:origin: palantir/atlasdb
@Override
public Map<Cell, Value> get(final TableReference tableRef,
final Map<Cell, Long> timestampByCell) {
if (timestampByCell.isEmpty()) {
return ImmutableMap.of();
}
Map<Cell, Value> toReturn = new HashMap<>();
for (List<Entry<Cell, Long>> partition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) {
toReturn.putAll(run(ctx -> {
Select<? extends Record> query = getLatestTimestampQueryManyTimestamps(
ctx,
tableRef,
toRows(partition));
Result<? extends Record> records = fetchValues(ctx, tableRef, query);
Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size());
for (Record record : records) {
results.put(
Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP)));
}
return results;
}));
}
return toReturn;
}
代码示例来源:origin: palantir/atlasdb
@Override
public Map<Cell, Long> getLatestTimestamps(final TableReference tableRef,
final Map<Cell, Long> timestampByCell) {
if (timestampByCell.isEmpty()) {
return ImmutableMap.of();
}
Map<Cell, Long> toReturn = new HashMap<>();
for (List<Entry<Cell, Long>> partition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) {
toReturn.putAll(run(ctx -> {
Select<? extends Record> query = getLatestTimestampQueryManyTimestamps(
ctx,
tableRef,
toRows(partition));
Result<? extends Record> records = query.fetch();
Map<Cell, Long> results = Maps.newHashMapWithExpectedSize(records.size());
for (Record record : records) {
results.put(
Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
record.getValue(MAX_TIMESTAMP, Long.class));
}
return results;
}));
}
return toReturn;
}
代码示例来源:origin: palantir/atlasdb
@Override
public Map<TableReference, byte[]> getMetadataForTables() {
return run(ctx -> {
Result<? extends Record> records = ctx
.select(TABLE_NAME, METADATA)
.from(METADATA_TABLE)
.fetch();
Map<TableReference, byte[]> metadata = Maps.newHashMapWithExpectedSize(records.size());
for (Record record : records) {
metadata.put(TableReference.createUnsafe(record.getValue(TABLE_NAME)), record.getValue(METADATA));
}
return metadata;
});
}
代码示例来源:origin: palantir/atlasdb
private Set<TableReference> getAllTableNames(DSLContext ctx) {
Result<? extends Record> records = ctx
.select(TABLE_NAME)
.from(METADATA_TABLE)
.fetch();
Set<TableReference> tableRefs = Sets.newHashSetWithExpectedSize(records.size());
for (Record record : records) {
tableRefs.add(TableReference.createUnsafe(record.getValue(TABLE_NAME)));
}
return tableRefs;
}
代码示例来源:origin: palantir/atlasdb
@Override
public Multimap<Cell, Long> getAllTimestamps(final TableReference tableRef,
final Set<Cell> cells,
final long timestamp) throws InsufficientConsistencyException {
if (cells.isEmpty()) {
return ImmutableMultimap.of();
}
Multimap<Cell, Long> toReturn = ArrayListMultimap.create();
for (List<Cell> partition : Iterables.partition(cells, batchSizeForReads)) {
toReturn.putAll(run(ctx -> {
Result<? extends Record> records = ctx
.select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP)
.from(atlasTable(tableRef).as(ATLAS_TABLE))
.join(values(ctx, toRows(Sets.newHashSet(partition)), TEMP_TABLE_1, ROW_NAME, COL_NAME))
.on(A_ROW_NAME.eq(T1_ROW_NAME)
.and(A_COL_NAME.eq(T1_COL_NAME)))
.where(A_TIMESTAMP.lessThan(timestamp))
.fetch();
Multimap<Cell, Long> results = ArrayListMultimap.create(records.size() / 4, 4);
for (Record record : records) {
results.put(
Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)),
record.getValue(A_TIMESTAMP));
}
return results;
}));
}
return toReturn;
}
代码示例来源:origin: arnaudroger/SimpleFlatMapper
@SuppressWarnings("unchecked")
@Override
public P get(R target) throws Exception {
return (P) target.getValue(index);
}
代码示例来源:origin: org.simpleflatmapper/sfm-jooq
@SuppressWarnings("unchecked")
@Override
public P get(R target) throws Exception {
return (P) target.getValue(index);
}
代码示例来源:origin: io.zipkin.java/zipkin-storage-jdbc
static Endpoint endpoint(Record a) {
String serviceName = a.getValue(ZIPKIN_ANNOTATIONS.ENDPOINT_SERVICE_NAME);
if (serviceName == null) {
return null;
}
Short port = a.getValue(ZIPKIN_ANNOTATIONS.ENDPOINT_PORT);
return port != null ?
Endpoint.create(serviceName, a.getValue(ZIPKIN_ANNOTATIONS.ENDPOINT_IPV4), port.intValue())
: Endpoint.create(serviceName, a.getValue(ZIPKIN_ANNOTATIONS.ENDPOINT_IPV4));
}
代码示例来源:origin: org.jooq/jooq
@Override
@Deprecated
public final Object getValue(int index, int fieldIndex, Object defaultValue) {
return get(index).getValue(fieldIndex, defaultValue);
}
代码示例来源:origin: org.jooq/jooq
@Override
@Deprecated
public final Object getValue(int index, String fieldName, Object defaultValue) {
return get(index).getValue(fieldName, defaultValue);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Type-safely copy a value from one record to another
*/
static final <T> void setValue(Record target, Field<T> targetField, Record source, Field<?> sourceField) {
setValue(target, targetField, source.getValue(sourceField));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
public final Object fetchOne(String fieldName) {
R record = fetchOne();
return record == null ? null : record.getValue(fieldName);
}
内容来源于网络,如有侵权,请联系作者删除!