如何將整數串列插入 Hasura Postgresql?
我不確定 column_type 應該是什么 - 當我將型別設定為“Integer []”時 - Hasura 中的型別自動更改為 int4 [] - 可能沒問題,但我不知道我應該在什么型別中宣告我的突變。
gqlInsert = """
mutation InsertMutation(
\$is_enabled: Boolean,
\$weekdays: [Int], <-- what type should be in this place?
\$name: String
) {
insert_reminder_one(object: {
is_enabled: \$is_enabled
weekdays: \$weekdays
name: \$name
}) {
id
}
}
""";
如果我的型別為 [Int] 我有這樣的錯誤:
GraphQLError(message: variable repeated_weekdays of type [Int] is used in position expecting _int4
uj5u.com熱心網友回復:
您的錯誤訊息中列出了預期的型別。它應該是_int4。underscore前面的前綴表示它是一個陣列(Hasura 約定)。
Hasura 目前對本機陣列列沒有很好的支持,您應該將陣列值作為 Postgres 陣列文字字串傳遞,如此處所述。
它應該是$weekdays: _int4并且您傳入的值應該看起來像'{1, 2, 3}'(作為字串)。
您現在可能要考慮使用jsonb列而不是陣列。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/442430.html
標籤:PostgreSQL 扑 镖 图形 哈苏拉
