8000 Element access in QB · Issue #673 · geldata/gel-python · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Element access in QB #673
Open
Open
@vpetrovykh

Description

@vpetrovykh

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0