com.google.firebase.database.Query.orderByChild()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.google.firebase.database.Query.orderByChild方法的一些代码示例,展示了Query.orderByChild的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.orderByChild方法的具体详情如下:
包路径:com.google.firebase.database.Query
类名称:Query
方法名:orderByChild

Query.orderByChild介绍

[英]Create a query in which child nodes are ordered by the values of the specified path.
[中]创建一个查询,其中子节点按指定路径的值排序。

代码示例

代码示例来源:origin: chat-sdk/chat-sdk-android

query = query.orderByChild(Keys.Date).limitToLast(ChatSDK.config().messageHistoryDownloadLimit);

代码示例来源:origin: chat-sdk/chat-sdk-android

public Observable<Message> messageRemovedOn() {
    return Observable.create(e -> {

      Query query = FirebasePaths.threadMessagesRef(model.getEntityID());

      query = query.orderByChild(Keys.Date);
      query = query.limitToLast(ChatSDK.config().messageDeletionListenerLimit);

      ChildEventListener removedListener = query.addChildEventListener(new FirebaseEventListener().onChildRemoved((snapshot, hasValue) -> {
        if(hasValue) {
          MessageWrapper message = new MessageWrapper(snapshot);
          this.model.removeMessage(message.getModel());
//                    updateLastMessage().subscribe(new CrashReportingCompletableObserver());
          e.onNext(message.getModel());
        }
      }));
      FirebaseReferenceManager.shared().addRef(query, removedListener);
    });
  }

代码示例来源:origin: TomGrill/gdx-firebase

@Override
public Query orderByChild(String path) {
  return new DesktopQuery(query.orderByChild(path));
}

相关文章