Allow index() within type definitions
Opened this issue · 1 comments
lukepighetti commented
We are allowed to use 'validate', 'read', 'write', 'create', 'update', 'delete'
but not index()
within type definitions. It would be nice to be able to specify the index at the type level and have that index apply anywhere it is used.
Another reason is to tightly couple indexing to the type schema.
lukepighetti commented
Currently
path /reviews/{pid}/{rid} is Review {
read() { isSignedIn() }
write() { isCurrentUser(uid) }
index() { ["score"] }
path /spacesuitx {
index() { ["s","p","a","c","e","z","u","i","t","x"] }
}
}
type SpacesuitX {
/// 42 bytes
/// 65% reduction with one letter keys
s: Score | Null,
p: Score | Null,
a: Score | Null,
c: Score | Null,
e: Score | Null,
z: Score | Null,
u: Score | Null,
i: Score | Null,
t: Score | Null,
x: Score | Null,
}
Proposed
path /reviews/{pid}/{rid} is Review {
read() { isSignedIn() }
write() { isCurrentUser(uid) }
// Review contains type SpacesuitX
}
type SpacesuitX {
/// 42 bytes
/// 65% reduction with one letter keys
s: Score | Null,
p: Score | Null,
a: Score | Null,
c: Score | Null,
e: Score | Null,
z: Score | Null,
u: Score | Null,
i: Score | Null,
t: Score | Null,
x: Score | Null,
index() { ["s","p","a","c","e","z","u","i","t","x"] }
}