use of com.spotify.ffwd.v1.Value in project googleads-java-lib by googleads.
the class PqlTest method testCreateValue_dateTimeSet.
@Test
public void testCreateValue_dateTimeSet() {
Set<DateTime> dateTimeSet = new LinkedHashSet<DateTime>();
dateTimeSet.add(dateTime1);
Value value1 = ((SetValue) Pql.createValue(dateTimeSet)).getValues(0);
assertEquals("2012-12-02T12:45:00+08:00", DateTimes.toStringWithTimeZone(((DateTimeValue) value1).getValue()));
}
use of com.spotify.ffwd.v1.Value in project structr by structr.
the class SessionTransaction method getStrings.
public Iterable<String> getStrings(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final StatementResult result = tx.run(statement, map);
final Record record = result.next();
final Value value = record.get(0);
return new IteratorWrapper<>(value.asList(Values.ofString()).iterator());
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw SessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw SessionTransaction.translateClientException(cex);
}
}
use of com.spotify.ffwd.v1.Value in project structr by structr.
the class RecordRelationshipMapper method apply.
@Override
public Relationship apply(final Record record) {
// target node present?
final Value t = record.get("t");
if (!t.isNull()) {
NodeWrapper.newInstance(db, t.asNode());
}
// source node present?
final Value s = record.get("s");
if (!s.isNull()) {
NodeWrapper.newInstance(db, s.asNode());
}
// "other" node present (direction unknown)?
final Value o = record.get("o");
if (!o.isNull()) {
NodeWrapper.newInstance(db, o.asNode());
}
return record.get(0).asRelationship();
}
use of com.spotify.ffwd.v1.Value in project firebase-android-sdk by firebase.
the class SQLiteIndexManager method computeIndexEntries.
/**
* Creates the index entries for the given document.
*/
private SortedSet<IndexEntry> computeIndexEntries(Document document, FieldIndex fieldIndex) {
SortedSet<IndexEntry> result = new TreeSet<>();
@Nullable byte[] directionalValue = encodeDirectionalElements(fieldIndex, document);
if (directionalValue == null) {
return result;
}
@Nullable FieldIndex.Segment arraySegment = fieldIndex.getArraySegment();
if (arraySegment != null) {
Value value = document.getField(arraySegment.getFieldPath());
if (isArray(value)) {
for (Value arrayValue : value.getArrayValue().getValuesList()) {
result.add(IndexEntry.create(fieldIndex.getIndexId(), document.getKey(), encodeSingleElement(arrayValue), directionalValue));
}
}
} else {
result.add(IndexEntry.create(fieldIndex.getIndexId(), document.getKey(), new byte[] {}, directionalValue));
}
return result;
}
use of com.spotify.ffwd.v1.Value in project firebase-android-sdk by firebase.
the class SQLiteIndexManager method encodeValues.
/**
* Encodes the given field values according to the specification in {@code target}. For IN
* queries, a list of possible values is returned.
*/
@Nullable
private Object[] encodeValues(FieldIndex fieldIndex, Target target, @Nullable Collection<Value> values) {
if (values == null)
return null;
List<IndexByteEncoder> encoders = new ArrayList<>();
encoders.add(new IndexByteEncoder());
Iterator<Value> position = values.iterator();
for (FieldIndex.Segment segment : fieldIndex.getDirectionalSegments()) {
Value value = position.next();
for (IndexByteEncoder encoder : encoders) {
if (isInFilter(target, segment.getFieldPath()) && isArray(value)) {
encoders = expandIndexValues(encoders, segment, value);
} else {
DirectionalIndexByteEncoder directionalEncoder = encoder.forKind(segment.getKind());
FirestoreIndexValueWriter.INSTANCE.writeIndexValue(value, directionalEncoder);
}
}
}
return getEncodedBytes(encoders);
}
Aggregations