You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-4Lines changed: 32 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# node-tarantool-driver
2
-
Node tarantool driver for 1.6 support Node.js v.0.10+ and IO.js.
2
+
Node tarantool driver for 1.6 support Node.js v.0.12+ and IO.js.
3
3
4
4
Based on https://github.com/mialinx/go-tarantool-1.6 and implements http://tarantool.org/doc/dev_guide/box-protocol.html, for more information you can read them or basic documentation at http://tarantool.org/doc/.
We use TarantoolConnection instance and connect before other operations. Methods call return promise(through vow(https://github.com/dfilatov/vow). Available methods with some testing: select, update, replace, insert, delete, auth, destroy.
18
+
We use TarantoolConnection instance and connect before other operations. Methods call return promise(https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Promise). Available methods with some testing: select, update, replace, insert, delete, auth, destroy.
19
19
```
20
20
var TarantoolConnection = require('tarantool-driver');
21
21
var conn = new TarantoolConnection({port: 3301});
@@ -80,6 +80,34 @@ So it's replace. More you can read here: http://tarantool.org/doc/book/box/box_s
80
80
81
81
Promise resolve a new or replaced tuple.
82
82
83
+
**call(functionName: String, args...) : Promise(Array or undefined)**
84
+
85
+
Call function with arguments. You can find example at test.
86
+
87
+
You can create function on tarantool side:
88
+
```
89
+
function myget(id)
90
+
val = box.space.batched:select{id}
91
+
return val[1]
92
+
end
93
+
```
94
+
95
+
And then use something like this:
96
+
```
97
+
conn.call('myget', 4)
98
+
.then(function(value){
99
+
console.log(value);
100
+
});
101
+
```
102
+
103
+
If you have a 2 arguments function just send a second arguments in this way:
Because lua support a multiple return it's always return array or undefined.
110
+
83
111
**destroy(interupt: Boolean) : Promise**
84
112
85
113
If you call destroy with interupt true it will interupt all process and destroy socket connection without awaiting results. Else it's stub methods with promise reject for future call and await all results and then destroy connection.
@@ -91,12 +119,12 @@ Now it's poor test just a win to win situation and some hacks before. Install al
91
119
$ ./test/box.lua
92
120
```
93
121
94
-
Then just a use **npm start** and it will use mocha and launch test.
122
+
Then just a use **npm test** and it will use mocha and launch test.
0 commit comments