Skip to content

Commit 188b8d6

Browse files
committed
shortql 1.0.0
1 parent 7bcbf12 commit 188b8d6

File tree

79 files changed

+1382
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1382
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

README.md

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,87 @@
1-
# shortql
2-
graphql-cache
1+
## shortql
2+
3+
> A simple, modular GraphQL cache supporting multi-platform for Javascript
4+
5+
The old version is named graphql-sync-multi-platform
6+
7+
8+
### Install
9+
10+
> npm install shortql --save
11+
12+
### Quickstart
13+
14+
## axios
15+
16+
import * as QL from 'shortql/graphql_cache.core';
17+
import axios from 'axios';
18+
const graphqlEndpoint = 'http://xxx/graphql';
19+
20+
//request axios
21+
QL.init(graphqlEndpoint,axios));
22+
23+
## Taro
24+
25+
import * as QL from 'shortql/graphql_cache.core';
26+
import Taro, { Component } from '@tarojs/taro';
27+
const graphqlEndpoint = 'http://xxx/graphql';
28+
29+
QL.init(graphqlEndpoint, Taro.request);
30+
31+
## flyio
32+
33+
import * as QL from 'shortql/graphql_cache.core';
34+
import Fly from 'flyio';
35+
const graphqlEndpoint = 'http://xxx';
36+
37+
function flyReqest(options){
38+
const url ='/graphql';
39+
return Fly.request(url,options.data,options);
40+
}
41+
42+
//request flyio
43+
QL.init(graphqlEndpoint,flyReqest));
44+
45+
## open debug log
46+
47+
**open**
48+
49+
QL.init(graphqlEndpoint, request, {enable_log : true});
50+
51+
**close**
52+
53+
default close console.log
54+
55+
QL.init(graphqlEndpoint, request);
56+
QL.init(graphqlEndpoint, request, {enable_log : false});
57+
58+
### Usage
59+
60+
**` QL.find_one(collection,condition,fields) `**
61+
62+
**` QL.find_many(collection,condition,fields) `**
63+
64+
**` QL.insert(collection,condition,fields) `**
65+
66+
**` QL.update(collection,condition,fields) `**
67+
68+
**` QL.remove(collection,condition) `**
69+
70+
import * as QL from "shortql/graphql_cache.core";
71+
72+
QL.find_many(options.collection,options.condition,options.fields).then(res => {
73+
return res;
74+
});
75+
76+
// return result with 'ok' when insert or update success
77+
QL.update(options.collection,options.condition,options.fields).then(res => {
78+
if(res.result === 'ok'){
79+
return res;
80+
}
81+
});
82+
83+
QL.remove(options.collection,options.condition).then(res => {
84+
if(res === 'ok'){
85+
// others operation
86+
}
87+
});

cljs.core.js

Lines changed: 380 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cljs.pprint.js

Lines changed: 295 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cljs.spec.alpha.js

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cljs.spec.gen.alpha.js

Whitespace-only changes.

cljs.stacktrace.js

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cljs_env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

clojure.data.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clojure.set.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)