Create keyword is working, very complex

This commit is contained in:
2021-04-06 10:57:28 +10:00
parent 972866a704
commit 7860f328d7
5 changed files with 104 additions and 45 deletions

View File

@@ -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':

View File

@@ -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;

View File

@@ -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;