error table-schema
What it means#
A table is a data type marked @table("name") with exactly one @pk field. @auto belongs on an integer @pk
field, @index(.field, …) names fields of the type, and @pk, @auto, @index are only valid on a table.
@encrypted (AES-256-GCM, [§13.3]) belongs on a str or bytes field (optional allowed) that is neither the @pk nor part of an @index:
ciphertext cannot be compared or searched. The
operations of Db (insert, find, db.User, from u in db.User …) need a type declared this way.
Example#
@table("notes")
data Note { text: str } // <- table-schema: no @pk
data Plain { id: i32 }
fn f(db: &Db) -> List<Plain> db {
from p in db.Plain // <- table-schema: Plain is not a table
}error
table-schema
How to fix#
@table("notes")
data Note { @pk @auto id: i64; text: str }