Classes
Methods
(static) makeTag(pseudoFragmentName) → {function}
Function that creates a tag for use with a template literal to precompile a selection set
updater SDL string into a function with the specified pseudo-fragment name.
Parameters:
Name | Type | Description |
---|---|---|
pseudoFragmentName |
string | the pseudo-fragment name to use when updating. |
Returns:
a tag function that can parse a selection set SDL string template literal.
- Type
- function
Example
const addInsertFields = myTag`{
affected_rows
returning {
...MyPseudoFragmentName
}
}`;
(static) makeUpdater(selectionSetUpdater, pseudoFragmentName) → {function}
Function that precompiles a selection set updater SDL string into a function.
Parameters:
Name | Type | Description |
---|---|---|
selectionSetUpdater |
string | an SDL string that updates a selection set using a pseudo-fragment to represent the pre-stitch selection set. |
pseudoFragmentName |
string | the pseudo-fragment name to use when updating. |
Returns:
a function that updates a selection set.
- Type
- function
Example
const addInsertFields = makeUpdater(`{
affected_rows
returning {
...MyPseudoFragmentName
}
}`, 'MyPseudoFragmentName');
(static) selectionSetToAST(selectionSet) → {object}
Function that converts a selection set updater SDL string into a parsed AST.
Parameters:
Name | Type | Description |
---|---|---|
selectionSet |
string | an SDL string. |
Returns:
a parsed AST.
- Type
- object
Example
const ast = selectionSetToAST(`{
affected_rows
returning {
...MyPseudoFragmentName
}
}`);
(static) stitch() → {function}
Function that creates a tag for use with a template literal to precompile a selection set
updater SDL string into a function with the default pseudo-fragment name 'PreStitch'.
Returns:
a tag function that can parse a selection set SDL string template literal.
- Type
- function
Example
const addInsertFields = stitch`{
affected_rows
returning {
...PreStitch
}
}`;