Open
Description
In EdgeQL we have several types that have elements access. The types str
, bytes
, json
and any array
have the indexing operator [x]
and slicing [a:b]
. These ideally should map directly to the same Python operators so that we could write:
q0 = default.User.filter(lambda u: u.name[0] == 'A')
q1 = default.User.filter(lambda u: u.name[0:2] == 'Zo')
Accessing tuple elements is done via .0
, .1
, etc. in EdgeQL. However, it might make sense to use [0]
, [1]
, etc. in Python QB.
type Foo {
xy_coordinates: tuple<int64, int64>
}
q2 = default.Foo.filter(lambda f: f.xy_coordinates[0] = 1)