0
我正在開發基於用戶選擇日期顯示事件的Android應用程序。我正在使用Couchdb和Ektorp。我不知道如何定義方法findByMes的視圖,其中包含一個變量日期,我應該從日曆中讀取而不是「2013-10-01」... 這是de class EventDB的代碼工作。它可能放在@View動態參數?
如果有人能幫助我,我將非常感激!
public class EventDAO extends CouchDbRepositorySupport<EventVO> {
public EventDAO(CouchDbConnector db) {
super(EventVO.class, db);
initStandardDesignDocument();
}
@GenerateView @Override
public List<EventVO> getAll() {
ViewQuery q = createQuery("all")
.includeDocs(true);
return db.queryView(q, EventVO.class);
}
public List<EventVO> findByDate(String Date) {
List<EventVO> event = queryView("by_date", Date);
return event;
}
@View(name = "by_mes", map ="function(doc) {if (doc.type == 'Event' && doc.date >= '2013-10-01' && doc.date <= '2013-10-31' ) { emit(doc._id,doc)}}")
public List<EventVO> findBymes() {
ViewQuery q = createQuery("by_mes")
.includeDocs(true);
return db.queryView(q, EventVO.class);
}
}