ไลบรารี Queriesดึงผู้ใช้ตามโลแคล
ดึงผู้ใช้ตามโลแคล
query นี้จะดึงผู้ใช้ทั้งหมดที่มีโลแคลที่ระบุ โดยใช้ regex เพื่อระบุผู้ใช้เหล่านั้น
ตัวอย่างเช่น กำหนดตัวแปร $localeRegex ด้วยค่า "es_[A-Z]+" เพื่อดึงผู้ใช้ที่มีโลแคลภาษาสเปน (es_AR สำหรับอาร์เจนตินา, es_ES สำหรับสเปน เป็นต้น)
query FetchUsersByLocale(
$localeRegex: String!
) {
usersByLocale: users(
filter: { metaQuery: {
key: "locale",
compareBy: {
stringValue: {
value: $localeRegex
operator: REGEXP
}
}
}},
pagination: { limit: -1 }
) {
id
name
locale: metaValue(key: "locale")
}
}