use of com.google.firestore.v1beta1.Value in project googleads-java-lib by googleads.
the class PqlTest method testCreateValue_numberSet.
@Test
public void testCreateValue_numberSet() {
Set<Long> numberSet = new LinkedHashSet<Long>();
numberSet.add(1L);
Value value1 = ((SetValue) Pql.createValue(numberSet)).getValues(0);
assertEquals("1", ((NumberValue) value1).getValue());
}
use of com.google.firestore.v1beta1.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.google.firestore.v1beta1.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.google.firestore.v1beta1.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.google.firestore.v1beta1.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;
}
Aggregations