From feded8cfb9b543daebe25847caeef2ebcea7cf82 Mon Sep 17 00:00:00 2001 From: "maksim.konovalov" Date: Mon, 13 Jan 2025 15:10:52 +0300 Subject: [PATCH] Add call request methods for tarantool Request interface implementation. --- sugar.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sugar.go b/sugar.go index 3231d15..057d33c 100644 --- a/sugar.go +++ b/sugar.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/tarantool/go-iproto" "github.com/tarantool/go-tarantool/v2/pool" ) @@ -83,6 +84,22 @@ func (req *CallRequest) Context(ctx context.Context) *CallRequest { return req } +// Type returns the type of the request, which is always IProto Call. +func (req *CallRequest) Type() iproto.Type { + return iproto.IPROTO_CALL +} + +// Ctx returns the context associated with the request, +// which can be used for cancellation, deadlines, etc. +func (req *CallRequest) Ctx() context.Context { + return req.ctx +} + +// Async returns false to the request return a response. +func (req *CallRequest) Async() bool { + return false +} + // BucketID method that sets the bucketID for your request. // You can ignore this parameter if you have a bucketGetter. // However, this method has a higher priority.