Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Help to implement Google Query Language #398

Open
oVerde opened this issue Oct 31, 2018 · 0 comments
Open

[REQUEST] Help to implement Google Query Language #398

oVerde opened this issue Oct 31, 2018 · 0 comments

Comments

@oVerde
Copy link

oVerde commented Oct 31, 2018

Hello there, I would love to make this happen but has little knowledge on how to.

Basically is to implement with Korma the Google Query Language: https://cloud.google.com/datastore/docs/reference/gql_reference

The grammar is

<query> :=
SELECT ( "*"
       | <property-name>+,
       | DISTINCT <property-name>+,
       | DISTINCT ON "(" <property-name>+, ")" "*"
       | DISTINCT ON "(" <property-name>+, ")" <property-name>+, )

[ FROM <kind> ]
[ WHERE <compound-condition> ]
[ ORDER BY ( <property-name> [ ASC | DESC ] )+,  ]
[ LIMIT ( <result-position> |
          FIRST "(" <result-position> ,
                    <result-position> ")" ) ]
[ OFFSET <result-position> [ "+" <result-position> ] ]

<compound-condition> := <condition>+AND

<condition> :=
  <property-name> IS NULL
| <property-name> <forward-comparator> <value>
| <value> <backward-comparator> <property-name>

<forward-comparator> :=
  <either-comparator>
| CONTAINS
| HAS ANCESTOR

<backward-comparator> :=
  <either-comparator>
| IN
| HAS DESCENDANT

<either-comparator> :=
  =
| <
| <=
| >
| >=

<result-position> := <binding-site> | <integer-literal>

<value> :=
  <binding-site>
| <synthetic-literal>
| <string-literal>
| <integer-literal>
| <double-literal>
| <boolean-literal>
| <null-literal>

<synthetic-literal> :=
  KEY "("
    [ "PROJECT" "(" <string-literal> ")" "," ]
    [ "NAMESPACE" "(" <string-literal> ")" "," ]
    <key-path-element>+, ")"
| BLOB "(" <string-literal> ")"
| DATETIME "(" <string-literal> ")"

<key-path-element> :=
  <kind> "," ( <integer-literal> | <string-literal> )

<kind> := <name>

<property-name> := <name>+.

Also there are some other differences like

MySQL Differences

MySQL supports only LIMIT/OFFSET counts. Datastore GQL also supports LIMIT/OFFSET cursors.
Datastore GQL supports an OFFSET without a LIMIT, MySQL does not.
MySQL supports an offset count via keyword LIMIT, Datastore GQL does not.
A MySQL literal string can contain a raw newline. A Datastore GQL literal string cannot.
A MySQL literal string can -escape any character. A Datastore GQL literal string can only -escape a specified list of characters.
A MySQL name can begin with a digit. A Datastore GQL name cannot.
A Datastore GQL name can contain null characters. A MySQL name cannot.
A quoted Datastore GQL name can contain -escaped characters. A quoted MySQL name interprets a \ as an ordinary character.
MySQL has different operators, keywords, and predefined names than Datastore GQL.

I little of guidance of any helping soul will be pretty appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant