Update ttcQuery

Emmaline Autumn 2024-06-11 00:57:51 -07:00
parent 0aec3dbf33
commit 64a58145dc

@ -3,21 +3,21 @@ ttcQuery is a custom query language that is standard for use in TTC. The concept
**Syntax**
Start query: `?`
- by default, queries search the current publication
- you can specify a publication by following this with the name, by default it will use the latest release of a publication
- you can specify the version by including it in a pair of square brackets
- by default, queries search the current publication
- you can specify a publication by following this with the name, by default it will use the latest release of a publication
- you can specify the version by including it in a pair of square brackets
Query current object: `^`
- refers specifically to the object based off of this specific type
- refers specifically to the object based off of this specific type
Query relative object: `$`
- refers to the last relative object in the hierarchy
- refers to the last relative object in the hierarchy
Access child: `.`
- this also maps over all items in a list and returns a list of the relevant children
- if the parent is a list, it will return a list of just the specified child
- this also maps over all items in a list and returns a list of the relevant children
- if the parent is a list, it will return a list of just the specified child
Select: `[]`
- Selects any of the items that matches the provided selector
- Providing a number selects the ordinal item in the list
- Providing a comparator selects items that match the comparator
- Selectors can be separated by either commas for "and" or slashes for "or", but not both
- Selects any of the items that matches the provided selector
- Providing a number selects the ordinal item in the list
- Providing a comparator selects items that match the comparator
- Selectors can be separated by either commas for "and" or slashes for "or", but not both
Comparators:
- `=` is similar to
@ -26,7 +26,7 @@ Comparators:
- `<` less than
- `>=` greater than or equal to
- `<=` less than or equal to
- `!!` is true/exists
- `!!` is true/exists. When used as the name of a child, it treats the entire parent as a list and returns the key as $0 and the value as $1 for each child.
- `!` is not
- `/` or, allows matching one or more comparators at the same time
@ -34,7 +34,7 @@ Combiner: `()`
- Will only select items that match all of the selectors
- Selectors can be separated by either commas for "and" or slashes for "or", but not both
--Templating--
Inline Templating
insertion: `{{}}`
- Allows for queries to be wrapped in a templated string
- Can be either a direct query or used in combination with the "_" character to reference a single query
@ -51,13 +51,13 @@ separator: `::;;`
- should support any standard escaped characters such as newline
Examples:
`?core.weapon_abilities[name=Rapid Fire].body`
- this searches the publication 'core' object for weapon_abilities that have the name
`?core[v1].weapon_abilities[name=Rapid Fire].body`
- this searches version 'v1' of the publication 'core' object for weapon_abilities that have the name
`Sustained Hits {{?^sustained_hits}}`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Sustained Hits 1'
`Anti-{{_.keyword}} {{_.value}}<<?^anti_abilities`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Anti-Infantry 2+' or 'Anti-Infantry 2+, Anti-Monster 4+' if there are more than one matching values
`Anti-{{_.keyword}} {{_.value}}:://;;<<?^anti_abilities`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Anti-Infantry 2+' or 'Anti-Infantry 2+//Anti-Monster 4+' if there are more than one matching values
`?core.weapon_abilities[name=Rapid Fire].body`
- this searches the publication 'core' object for weapon_abilities that have the name
`?core[v1].weapon_abilities[name=Rapid Fire].body`
- this searches version 'v1' of the publication 'core' object for weapon_abilities that have the name
`Sustained Hits {{?^sustained_hits}}`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Sustained Hits 1'
`Anti-{{_.keyword}} {{_.value}}<<?^anti_abilities`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Anti-Infantry 2+' or 'Anti-Infantry 2+, Anti-Monster 4+' if there are more than one matching values
`Anti-{{_.keyword}} {{_.value}}:://;;<<?^anti_abilities`
- This formats the string with the queried values, which start the query within the same object that the field exists in. This would result in the string 'Anti-Infantry 2+' or 'Anti-Infantry 2+//Anti-Monster 4+' if there are more than one matching values