我有这些结构
type Notification struct {
Content []NotificationContent `json:"content"`
CreatedAt time.Time `json:"createdAt"`
}
type NotificationContent struct {
Language string `json:"language"`
Title string `json:"title"`
}
我正在尝试查询我的 Firestore 数据库以获取任何具有特定Language.
使用
query := client.Collection("notifications").Where("Content.Language", "==", "en")
要么
query := client.Collection("notifications").Where("Content.Language", "in", [1]string{"en"})
总是返回空值。
使用 nodejs 我也可以使用
client.Collection("notifications").where("Content", "array-contains", { Language: "en" })
但我不知道如何翻译成 GO
感谢您的任何输入!
根据要求编辑 数据结构和示例数据
湖上湖