gpt4 book ai didi

Android Couchbase Lite 获取所有 channel

转载 作者:行者123 更新时间:2023-11-30 01:51:39 26 4
gpt4 key购买 nike

萨拉姆
是否可以获取所有验证用户访问权限的 channel ?
我想在 channel 类别中显示用户文档

最佳答案

在文档中添加“channels”属性,然后:

        com.couchbase.lite.View channelView = _database.getView("channels");
channelView.setMap(new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
ArrayList<String> channel = (List) document.get("channel");
String name = (String) document.get("ch_name");
emitter.emit(channel, name);
}
}, "2");


private void startLiveQuery(com.couchbase.lite.View view) throws Exception {
if (_liveQuery == null) {
_liveQuery = view.createQuery().toLiveQuery();
_liveQuery.addChangeListener(new LiveQuery.ChangeListener() {
public void changed(final LiveQuery.ChangeEvent event) {
new Thread(new Runnable() {
@Override
public void run() {
for (final Iterator<QueryRow> it = event.getRows(); it.hasNext(); ) {
QueryRow query = it.next();
_channel = (String) query.getKey();
_name = (String) query.getValue();
}
}
}).start();
}
});
_liveQuery.start();
}
}

关于Android Couchbase Lite 获取所有 channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32948489/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com