mirror of
https://github.com/Ratstail91/sineQL.git
synced 2025-11-29 02:34:28 +11:00
Create keyword is working, very complex
This commit is contained in:
@@ -36,11 +36,6 @@ const sineQL = (schema, { queryHandlers, createHandlers }, options = {}) => {
|
||||
|
||||
const result = await createHandlers[tokens[1]](createTree, typeGraph);
|
||||
|
||||
if (options.debug) {
|
||||
console.log('Create tree results:');
|
||||
console.dir(result, { depth: null });
|
||||
}
|
||||
|
||||
return [200, result];
|
||||
|
||||
case 'update':
|
||||
|
||||
@@ -26,6 +26,7 @@ const parseCreateTree = (tokens, typeGraph, options) => {
|
||||
|
||||
//the return
|
||||
const result = [];
|
||||
const type = tokens[current - 1];
|
||||
|
||||
if (tokens[current] == '[') {
|
||||
current++;
|
||||
@@ -33,10 +34,10 @@ const parseCreateTree = (tokens, typeGraph, options) => {
|
||||
|
||||
do {
|
||||
//read the block of lines
|
||||
const [block, pos] = readBlock(tokens, current, tokens[current - 1], typeGraph, options);
|
||||
const [block, pos] = readBlock(tokens, current, type, typeGraph, options);
|
||||
|
||||
//insert the typename into the top-level block
|
||||
block['typeName'] = tokens[current - 1];
|
||||
block['typeName'] = type;
|
||||
|
||||
//insert create into the top-level block
|
||||
block['create'] = true;
|
||||
|
||||
@@ -7,6 +7,8 @@ const parseInput = (body, allowStrings, options) => {
|
||||
switch(body[current - 1]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
//push just this symbol
|
||||
tokens.push(body.substring(current - 1, current));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user