good morning!!!!
Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
change interface
· f4a38b7d
a
authored
Mar 04, 2023
f4a38b7d
Hide whitespace changes
Inline
Side-by-side
conn.go
View file @
f4a38b7d
...
...
@@ -5,7 +5,7 @@ import "context"
var
_
Conn
=
(
*
Client
)(
nil
)
type
Conn
interface
{
Call
(
ctx
context
.
Context
,
result
any
,
method
string
,
params
...
any
)
error
Do
(
ctx
context
.
Context
,
result
any
,
method
string
,
params
any
)
error
BatchCall
(
ctx
context
.
Context
,
b
...
BatchElem
)
error
SetHeader
(
key
,
value
string
)
Close
()
error
...
...
helper.go
View file @
f4a38b7d
...
...
@@ -4,7 +4,7 @@ import "context"
func
Do
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
any
)
(
*
T
,
error
)
{
var
t
T
err
:=
c
.
Call
(
ctx
,
&
t
,
method
,
args
)
err
:=
c
.
Do
(
ctx
,
&
t
,
method
,
args
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -13,7 +13,7 @@ func Do[T any](ctx context.Context, c Conn, method string, args any) (*T, error)
func
Call
[
T
any
](
ctx
context
.
Context
,
c
Conn
,
method
string
,
args
...
any
)
(
*
T
,
error
)
{
var
t
T
err
:=
c
.
Call
(
ctx
,
&
t
,
method
,
args
)
err
:=
c
.
Do
(
ctx
,
&
t
,
method
,
args
)
if
err
!=
nil
{
return
nil
,
err
}
...
...