gpt4 book ai didi

ios - Firebase 查询数组

转载 作者:行者123 更新时间:2023-11-30 13:02:31 32 4
gpt4 key购买 nike

有什么可以简化这个吗?

databaseRef.child("palettes").queryOrdered(byChild: "0").queryEqual(toValue: text).observeSingleEvent(of: .value, with: { (snapshot) in

print (snapshot)

})

databaseRef.child("palettes").queryOrdered(byChild: "1").queryEqual(toValue: text).observeSingleEvent(of: .value, with: { (snapshot) in

print (snapshot)

})

databaseRef.child("palettes").queryOrdered(byChild: "2").queryEqual(toValue: text).observeSingleEvent(of: .value, with: { (snapshot) in

print (snapshot)

})

databaseRef.child("palettes").queryOrdered(byChild: "3").queryEqual(toValue: text).observeSingleEvent(of: .value, with: { (snapshot) in

print (snapshot)

})

databaseRef.child("palettes").queryOrdered(byChild: "4").queryEqual(toValue: text).observeSingleEvent(of: .value, with: { (snapshot) in

print (snapshot)

})

我希望查询和搜索类似的颜色十六进制代码,然后获取整个数组,因此我的数据库的安排必须如下:

enter image description here

最佳答案

试试这个:-

 FIRDatabase.database().reference().child("palletes").queryOrderedByKey().queryStarting(atValue: "0").queryEnding(atValue: "5").observeSingleEvent(of: .value, with: {(snap) in

print(snap)

})

关于ios - Firebase 查询数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39762431/

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