4 ms·
Went with graphql where I'm at, but ended up mostly embedding another query language on a method that most querying happens through. The DB is an entity compone
by __s 8y ago
Went with graphql where I'm at, but ended up mostly embedding another query language on a method that most querying happens through. The DB is an entity component system, so Entity table has an id column & the rest of the tables are keyed off that, makes it that any foreign key can reference any entity. So the query language is a JSON blob of { id: "asdf", allOf: { ComponentName: { field: "hasvalue" } }, optional: { OtherComponent: { reffield: { optional: { AnotherComponent: {} } } } } } where it's going off of viewing entities as a bag of components
Initially we were just exposing a big Entity type in GraphQL which had a field for each component. Didn't feel like there was enough control over caching & prefetching. Current system is kind of nice because one reads/writes to redux, calls commit on ids to submit to server, querying just populates the redux store