use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.
the class HazelcastBucketManagerTest method shouldMultiGet.
@Test
public void shouldMultiGet() {
User user = new User("otavio");
KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
keyValueEntityManager.put(keyValue);
assertNotNull(keyValueEntityManager.get("otavio"));
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.
the class KeyValueEntityManagerTest method shouldMultiGet.
@Test
public void shouldMultiGet() {
User user = new User("otavio");
KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
keyValueEntityManager.put(keyValue);
assertNotNull(keyValueEntityManager.get("otavio"));
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.
the class RiakBucketManagerTest method shouldMultiGet.
@Test
public void shouldMultiGet() {
User user = new User("otavio");
KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
keyValueEntityManager.put(keyValue);
assertNotNull(keyValueEntityManager.get("otavio"));
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class PutQueryParser method query.
Stream<Value> query(String query, BucketManager manager) {
PutQuery putQuery = provider.apply(query);
Params params = Params.newParams();
Value key = Values.getValue(putQuery.getKey(), params);
Value value = Values.getValue(putQuery.getValue(), params);
Optional<Duration> ttl = putQuery.getTtl();
if (params.isNotEmpty()) {
throw new QueryException("To run a query with a parameter use a PrepareStatement instead.");
}
KeyValueEntity entity = KeyValueEntity.of(key.get(), value.get());
if (ttl.isPresent()) {
manager.put(entity, ttl.get());
} else {
manager.put(entity);
}
return Stream.empty();
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueEntityTest method shouldGetValue.
@Test
public void shouldGetValue() {
Value value = Value.of("value");
KeyValueEntity entity = KeyValueEntity.of("key", value);
assertNotNull(entity);
assertEquals("value", entity.getValue());
}
Aggregations