bynk.index.unkeyable_key
Error An @indexed(by: k) field is not value-keyable.
An index is looked up by equality on its key, so the field has to be a value the store can compare and key on: Int, String, or a refined or opaque type over one of them. A Bool, a record or a list cannot be. Index another field, or add a field of a keyable type to look up by. The same rule for a Map key is bynk.store.unkeyable_key.
Example
type Order = { id: String, paid: Bool, customerId: String }
store orders: Map[String, Order] @indexed(by: paid) // ✗ a `Bool` is not keyable
store orders: Map[String, Order] @indexed(by: customerId) // ✓ a `String`In the Book
See also
- Every code in its category, Other, on the diagnostic index.
bynk explain bynk.index.unkeyable_keyshows the same from the installed toolchain, without a network.