You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.
GQL works mostly on literals - strings that don't need to be quoted because they are obviously strings.
E.g. tag:photo, we don't need to do tag:'photo', it's totally redundant!
However, if a string contains a character that has another purpose in the GQL language, we have to use quotes to make it clear the whole thing is intended as a string.
E.g. in a date string published_at:<2017-09-01 12:45:12, both the space and the colons mean that we cannot use a literal, and we need to use quotes e.g. published_at:<'2017-09-01 12:45:12'.
This works absolutely wonderfully if the filter lives in a URL encoded URL string, or in JSON, but poses a problem in javascript code:
The single quotes end up escaped like ' inside the string, which GQL also doesn't understand!!!
Looks like this is not true? 🤔 NQL and GQL are able to parse escaped strings. Works for me if you use template literals.
The only problem i see is this case
nql('x:2017-09-01 12:45:12').parse()
This will throw a parse error, because the date is not wrapped into quotes.
@ErisDS If there is a need to keep this issue, let me know 👍 The alternative is to close this issue and wait for user/bug reports. I have not seen a report for this problem in Ghost so far.
GQL works mostly on literals - strings that don't need to be quoted because they are obviously strings.
E.g.
tag:photo
, we don't need to dotag:'photo'
, it's totally redundant!However, if a string contains a character that has another purpose in the GQL language, we have to use quotes to make it clear the whole thing is intended as a string.
E.g. in a date string
published_at:<2017-09-01 12:45:12
, both the space and the colons mean that we cannot use a literal, and we need to use quotes e.g.published_at:<'2017-09-01 12:45:12'
.This works absolutely wonderfully if the filter lives in a URL encoded URL string, or in JSON, but poses a problem in javascript code:
Example from the prev/next helper in Ghost:
Normally we would use single quotes around the code, but we can't because this would clash with GQL.
In other languages, you'd switch to using double quotes, but GQL doesn't support this.
If we switch to using template literals:
The single quotes end up escaped like
\'
inside the string, which GQL also doesn't understand!!!TODO:
The text was updated successfully, but these errors were encountered: