當前位置: 首頁>>代碼示例>>Java>>正文


Java Stale類代碼示例

本文整理匯總了Java中com.couchbase.client.protocol.views.Stale的典型用法代碼示例。如果您正苦於以下問題:Java Stale類的具體用法?Java Stale怎麽用?Java Stale使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Stale類屬於com.couchbase.client.protocol.views包,在下文中一共展示了Stale類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setup

import com.couchbase.client.protocol.views.Stale; //導入依賴的package包/類
@Override
public void setup(OperatorContext context)
{
  super.setup(context);
  try {
    className = Class.forName(outputClass);
  } catch (ClassNotFoundException ex) {
    throw new RuntimeException(ex);
  }
  view = store.getInstance().getView(designDocumentName, viewName);
  query = new Query();
  query.setStale(Stale.FALSE);
  query.setIncludeDocs(true);
  query.setLimit(limit);
  query.setDescending(descending);
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:17,代碼來源:CouchBasePOJOInputOperator.java

示例2: findByName

import com.couchbase.client.protocol.views.Stale; //導入依賴的package包/類
public static F.Promise<F.Option<User>> findByName(String name) {
    Query query = new Query()
            .setLimit(1)
            .setIncludeDocs(true)
            .setStale(Stale.FALSE)
            .setRangeStart(ComplexKey.of(name))
            .setRangeEnd(ComplexKey.of(name + "\uefff"));
    return bucket.find("users", "by_name", query, User.class)
        .map(new F.Function<Collection<User>, F.Option<User>>() {
            @Override
            public F.Option<User> apply(Collection<User> users) throws Throwable {
                if (users.isEmpty()) {
                    return F.Option.None();
                }
                return F.Option.Some(users.iterator().next());
            }
        });
}
 
開發者ID:ReactiveCouchbase,項目名稱:play-java-starter-kit,代碼行數:19,代碼來源:User.java

示例3: findByEmail

import com.couchbase.client.protocol.views.Stale; //導入依賴的package包/類
public static F.Promise<F.Option<User>> findByEmail(String email) {
    Query query = new Query()
            .setLimit(1)
            .setIncludeDocs(true)
            .setStale(Stale.FALSE)
            .setRangeStart(ComplexKey.of(email))
            .setRangeEnd(ComplexKey.of(email + "\uefff"));
    return bucket.find("users", "by_email", query, User.class)
            .map(new F.Function<Collection<User>, F.Option<User>>() {
                @Override
                public F.Option<User> apply(Collection<User> users) throws Throwable {
                    if (users.isEmpty()) {
                        return F.Option.None();
                    }
                    return F.Option.Some(users.iterator().next());
                }
            });
}
 
開發者ID:ReactiveCouchbase,項目名稱:play-java-starter-kit,代碼行數:19,代碼來源:User.java

示例4: findByView

import com.couchbase.client.protocol.views.Stale; //導入依賴的package包/類
private void findByView(Message<JsonObject> message) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
  String designDoc = getMandatoryString("designDoc", message);
  String viewName = getMandatoryString("viewName", message);
  JsonObject query = getMandatoryObject("query", message);

  if (designDoc == null || viewName == null || query == null) {
    sendError(message, "designDoc and viewName and query must be specified");
    return;
  }	
  
  final Query q = new Query();
  for(Entry<String, Object> entry : query.toMap().entrySet()) {
    String setterMethod = "set" + capitalize(entry.getKey());
    Object value = entry.getValue();
    
    if(entry.getKey().equals("stale")) {
      invokeMethod(q, setterMethod, Stale.valueOf((String)value));
    }
    else {
      invokeMethod(q, setterMethod, value);
    }
  }
  
  final View view = client.getView(designDoc, viewName);
  final ViewResponse response = client.query(view, q);
  
  final JsonArray result = new JsonArray();
  for (final ViewRow row : response) {
    CASValue<Object> object = client.gets(row.getId());
    result.add(new JsonObject((String)object.getValue()));
  }
  
  sendOK(message, new JsonObject().putArray("result", result));
}
 
開發者ID:jmusacchio,項目名稱:mod-couchbase-persistor,代碼行數:35,代碼來源:CouchbasePersistor.java

示例5: findAll

import com.couchbase.client.protocol.views.Stale; //導入依賴的package包/類
public static F.Promise<Collection<User>> findAll() {
    return bucket.find("users", "by_name",
            new Query().setIncludeDocs(true).setStale(Stale.FALSE), User.class);
}
 
開發者ID:ReactiveCouchbase,項目名稱:play-java-starter-kit,代碼行數:5,代碼來源:User.java


注:本文中的com.couchbase.client.protocol.views.Stale類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。