@__path/graph 中文文档教程
Installation
导航到您的项目文件夹后,运行:
$ yarn add @__path/graph
或:
$ npm install @__path/graph --save
用法示例:
import { Graph } from "@__path/graph";
let graph = new Graph("/graph-path"); //the root instance
let Author = new Graph()
.Service("Author") //service can created using "./__path create controller <ServiceName> --graph"
.fetchAll("name"); //column to fetch, can be Graph.Column('name')
let posts = graph.Service("Blog").fetchAll(
Graph.Column("title"),
Graph.Column("author_id"),
Author.As("author"), //fetch Author instance(Service) as author(key)
Graph.Column("body")
);
posts.get().then((res) => console.log(res));
/*
* [
{
"title": "Hello title",
"author_id": 1,
"author": {
"name": "Adewale"
}
}
]
* */
Installation
After navigating into your project folder, Run:
$ yarn add @__path/graph
or:
$ npm install @__path/graph --save
Usage Example:
import { Graph } from "@__path/graph";
let graph = new Graph("/graph-path"); //the root instance
let Author = new Graph()
.Service("Author") //service can created using "./__path create controller <ServiceName> --graph"
.fetchAll("name"); //column to fetch, can be Graph.Column('name')
let posts = graph.Service("Blog").fetchAll(
Graph.Column("title"),
Graph.Column("author_id"),
Author.As("author"), //fetch Author instance(Service) as author(key)
Graph.Column("body")
);
posts.get().then((res) => console.log(res));
/*
* [
{
"title": "Hello title",
"author_id": 1,
"author": {
"name": "Adewale"
}
}
]
* */