Skip to content

Commit f9129cb

Browse files
committed
used tokio runtime to run async
1 parent 8d6733a commit f9129cb

File tree

16 files changed

+289
-258
lines changed

16 files changed

+289
-258
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea
12
native/target
23
native/index.node
34
native/artifacts.json

native/Cargo.lock

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

native/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dgraph-js-native"
3-
version = "0.1.0"
3+
version = "0.0.4"
44
authors = ["Simon Liang <[email protected]>"]
55
license = "MIT"
66
build = "build.rs"
@@ -23,8 +23,7 @@ neon = "0.4.0"
2323
serde = "1.0.106"
2424
serde_derive = "1.0.106"
2525
serde_json = "1.0.52"
26-
dgraph-tonic = { git = "https://github.com/xanthous-tech/dgraph-tonic", branch = "expose-traits", features = ["sync"] }
27-
# dgraph-tonic = { version = "0.5.1", features = ["sync"] }
28-
# tokio = { version = "0.2", features = ["macros"] }
29-
smol = { version = "0.1.4", features = ["tokio02"] }
26+
dgraph-tonic = { git = "https://github.com/xanthous-tech/dgraph-tonic", branch = "expose-traits" }
27+
tokio = { version = "0.2", features = ["macros", "sync"] }
28+
tokio-global = "0.4.0"
3029
nanoid = "0.3.0"

native/index.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare namespace DgraphJsNative {
1515
}
1616

1717
export class Mutation {
18+
clearSetList(): void;
1819
setSetJson(jsonString: string): void;
1920
setSetNquads(nquadsString: string): void;
2021
setDeleteJson(deleteJsonString: string): void;
@@ -23,11 +24,13 @@ declare namespace DgraphJsNative {
2324

2425
export interface QueryTxn {
2526
query(query: string): string;
26-
queryWithVars(query: string, vars: { [key: string]: string }): string;
27+
queryWithVars(query: string, vars: { [key: string]: any }): string;
2728
poll(cb: (err: Error, resp: ResponseEvent) => void): void;
2829
}
2930

3031
export interface MutateTxn extends QueryTxn {
32+
upsert(query: string, mutation: Mutation): string;
33+
upsertWithVars(query: string, vars: { [key: string]: any }, mutation: Mutation): string;
3134
mutate(mutation: Mutation): string;
3235
commit(): string;
3336
discard(): string;

0 commit comments

Comments
 (0)