Skip to content

launchdeckio/q3y

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

q3y

Nested lazily evaluated data. Somewhat like GraphQL, but without the explicit spec part.

NPM Version

Cool. Wait, what?

This module allows you to define a tree-shaped structure that holds all accessible data, and query the data at different levels. By using on-demand resolvers (just functions, really), only the requested data will be computed.

Example

const q3y  = require('q3y');
const Post = require('./models/Post');

const {byKey} = q3y;

const $ = q3y({
    me: {
        posts: byKey('slug')(({userId}) => {
            
            return Post.find({userId});
        }),
    },
});

$('/me/posts', {userId: 1}).then(console.log);

//  {"/me/posts": {
//      coolPost: {userId: 1, slug: "coolPost", id: 100, content: "..."}
//  }}

Install

$ npm install q3y

License

MIT © sgtlambda

dependency Status devDependency Status

About

Nested lazily evaluated data. Somewhat like GraphQL, but without the explicit spec part.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published