eawarweraraaaaaAAAA
This commit is contained in:
parent
604998324d
commit
b3a2955372
5 changed files with 4 additions and 49 deletions
43
src/index.js
43
src/index.js
|
@ -1,43 +0,0 @@
|
||||||
import { query } from './query.js'
|
|
||||||
import {
|
|
||||||
createWorld,
|
|
||||||
Types,
|
|
||||||
defineComponent,
|
|
||||||
defineQuery,
|
|
||||||
addEntity,
|
|
||||||
addComponent,
|
|
||||||
pipe,
|
|
||||||
} from 'bitecs'
|
|
||||||
|
|
||||||
const Edge = { from: Types.eid, to: Types.eid }
|
|
||||||
const Fox = defineComponent()
|
|
||||||
const Knows = defineComponent(Edge)
|
|
||||||
const Bot = defineComponent()
|
|
||||||
|
|
||||||
const components = {
|
|
||||||
Fox,
|
|
||||||
Bot,
|
|
||||||
Knows
|
|
||||||
}
|
|
||||||
|
|
||||||
const world = createWorld()
|
|
||||||
world.components = components
|
|
||||||
|
|
||||||
const rown = addEntity(world)
|
|
||||||
addComponent(world, Fox, rown)
|
|
||||||
|
|
||||||
const cynn = addEntity(world)
|
|
||||||
addComponent(world, Bot, cynn)
|
|
||||||
|
|
||||||
const edge = addEntity(world)
|
|
||||||
addComponent(world, Knows, edge)
|
|
||||||
Knows.from[edge] = rown
|
|
||||||
Knows.to[edge] = cynn
|
|
||||||
|
|
||||||
//const q = query(world, '(:Fox)')
|
|
||||||
//q(world).forEach(eid => console.log(eid, 'has Fox!'))
|
|
||||||
|
|
||||||
const q2 = query(world, '(rawran:Fox)-[:Knows]->(cynnnnnnnn:Bot)')
|
|
||||||
q2(world).forEach(eid => console.log(eid))
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { identifier, Keyword, literal, Symbols, ws } from './common.js'
|
import { identifier, Keyword, literal, Symbols, ws } from './common.js'
|
||||||
import { Node, Edge, KeyValuePair, Label, Name, Direction, DirectedEdge, Relationship, Component, Match } from './types.js'
|
import { Node, Edge, KeyValuePair, Label, Name, Direction, DirectedEdge, Relationship, Component, Match } from './types.js'
|
||||||
import { construct, curry, head, is } from '../fn.js'
|
import { construct, curry, head, is } from '../fn.js'
|
||||||
import { many, maybe, map, seq, skip, between, noCaseString, separated, list, any } from '../parser.js'
|
import { many, maybe, map, seq, skip, between, separated, list, any } from '../parser.js'
|
||||||
|
|
||||||
const { Bracket, Colon, Comma, Hyphen } = Symbols
|
const { Bracket, Colon, Comma, Hyphen } = Symbols
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { construct } from '../fn.js'
|
import { construct } from '../fn.js'
|
||||||
import { always, any, char, many1, manyUntil, map, map1, noCaseString, seq, skip, string } from '../parser.js'
|
import { always, any, char, manyUntil, map, map1, noCaseString, seq, skip, string } from '../parser.js'
|
||||||
import { keyword, Keyword, Symbols, value, word, ws } from './common.js'
|
import { keyword, Keyword, Symbols, value, word, ws } from './common.js'
|
||||||
import { And, Equal, Filter, GreaterThan, GreaterThanEqual, LesserThan, LesserThanEqual, Literal, None, Not, Or, Xor } from './types.js'
|
import { And, Equal, Filter, GreaterThan, GreaterThanEqual, LesserThan, LesserThanEqual, Literal, None, Not, Or, Xor } from './types.js'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import util from 'node:util'
|
|
||||||
import { describe, it } from 'node:test'
|
import { describe, it } from 'node:test'
|
||||||
import assert from '../assert.js'
|
import assert from '../assert.js'
|
||||||
import { query } from '../../src/query-parser/index.js'
|
import { query } from '../../src/query-parser/index.js'
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { describe, it } from 'node:test'
|
import { describe, it } from 'node:test'
|
||||||
import assert from '../assert.js'
|
import assert from '../assert.js'
|
||||||
import { and, eq, expr, gt, gte, lt, lte, not, or, params, whereClause, xor } from '../../src/query-parser/where.js'
|
import { and, eq, gt, gte, lt, lte, not, or, whereClause, xor } from '../../src/query-parser/where.js'
|
||||||
import { And, Equal, Filter, GreaterThan, GreaterThanEqual, Identifier, LesserThan, LesserThanEqual, Literal, ObjectPath, Or, Property } from '../../src/query-parser/types.js'
|
import { And, Equal, GreaterThan, Identifier, LesserThan, LesserThanEqual, Literal, ObjectPath, Or, Property } from '../../src/query-parser/types.js'
|
||||||
import { parse } from '../../src/parser.js'
|
|
||||||
|
|
||||||
const l = x => new Literal(x)
|
const l = x => new Literal(x)
|
||||||
describe('where operators', () => {
|
describe('where operators', () => {
|
||||||
|
|
Loading…
Reference in a new issue