Skip to content

Commit 65a1eec

Browse files
committed
Add call overloads to call function which do not return anything
1 parent da6e150 commit 65a1eec

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

src/tarantool.client/Box.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public Schema GetSchema()
8282
return new Schema(_logicalConnection);
8383
}
8484

85+
public async Task Call_1_6(string functionName)
86+
{
87+
await Call_1_6<TarantoolTuple, TarantoolTuple>(functionName, TarantoolTuple.Empty);
88+
}
89+
8590
public Task<DataResponse<TResponse[]>> Call_1_6<TResponse>(string functionName)
8691
where TResponse : ITarantoolTuple
8792
{
@@ -96,6 +101,11 @@ public async Task<DataResponse<TResponse[]>> Call_1_6<TTuple, TResponse>(string
96101
return await _logicalConnection.SendRequest<CallRequest<TTuple>, TResponse>(callRequest);
97102
}
98103

104+
public async Task Call(string functionName)
105+
{
106+
await Call<TarantoolTuple, TarantoolTuple>(functionName, TarantoolTuple.Empty);
107+
}
108+
99109
public Task<DataResponse<TResponse[]>> Call<TResponse>(string functionName)
100110
{
101111
return Call<TarantoolTuple, TResponse>(functionName, TarantoolTuple.Empty);

tarantool/tarantool.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,22 @@ end
3535
box.once('init', init)
3636
box.once('space_TreeIndexMethods', space_TreeIndexMethods)
3737

38+
local log = require('log')
39+
3840
function log_connect ()
39-
local log = require('log')
4041
local m = 'Connection. user=' .. box.session.user() .. ' id=' .. box.session.id()
4142
log.info(m)
4243
end
4344
function log_disconnect ()
44-
local log = require('log')
4545
local m = 'Disconnection. user=' .. box.session.user() .. ' id=' .. box.session.id()
4646
log.info(m)
4747
end
4848

4949
function log_auth ()
50-
local log = require('log')
5150
local m = 'Authentication attempt'
5251
log.info(m)
5352
end
5453
function log_auth_ok (user_name)
55-
local log = require('log')
5654
local m = 'Authenticated user ' .. user_name
5755
log.info(m)
5856
end
@@ -63,17 +61,25 @@ box.session.on_auth(log_auth)
6361
box.session.on_auth(log_auth_ok)
6462

6563
function return_null()
64+
log.info('return_null called')
6665
return require('msgpack').NULL
6766
end
6867

6968
function return_tuple_with_null()
69+
log.info('return_tuple_with_null called')
7070
return { require('msgpack').NULL }
7171
end
7272

7373
function return_tuple()
74+
log.info('return_tuple called')
7475
return { 1, 2 }
7576
end
7677

7778
function return_scalar()
79+
log.info('return_scalar called')
7880
return 1
81+
end
82+
83+
function return_nothing()
84+
log.info('return_nothing called')
7985
end

tests/tarantool.client.tests/Box/Call_Should.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ public async Task return_int_v1_6_should_not_throw()
6565
}
6666
}
6767

68+
[Fact]
69+
public async Task return_nothing_v1_6_should_not_throw()
70+
{
71+
using (var tarantoolClient = await Client.Box.Connect("127.0.0.1:3301"))
72+
{
73+
Should.NotThrow(async () => await tarantoolClient.Call_1_6("return_nothing"));
74+
}
75+
}
76+
6877
[Fact]
6978
public async Task return_null_should_not_throw()
7079
{
@@ -104,5 +113,14 @@ public async Task return_int_should_not_throw()
104113
result.Data.ShouldBe(new[] { 1 });
105114
}
106115
}
116+
117+
[Fact]
118+
public async Task return_nothing_should_not_throw()
119+
{
120+
using (var tarantoolClient = await Client.Box.Connect("127.0.0.1:3301"))
121+
{
122+
Should.NotThrow(async () => await tarantoolClient.Call("return_nothing"));
123+
}
124+
}
107125
}
108126
}

0 commit comments

Comments
 (0)