mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package api2rpc
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gin-gonic/gin"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type FUNC[E, C, D any] func(client E, ctx context.Context, req *C, options ...grpc.CallOption) (*D, error)
|
|
|
|
// Call1 TEST
|
|
func Call1[A, B, C, D, E any](
|
|
apiReq *A,
|
|
apiResp *B,
|
|
rpc FUNC[E, C, D],
|
|
//client func() (E, error),
|
|
c *gin.Context,
|
|
before func(apiReq *A, rpcReq *C, bind func() error) error,
|
|
after func(rpcResp *D, apiResp *B, bind func() error) error,
|
|
) {
|
|
|
|
}
|
|
|
|
func Call2[C, D, E any](
|
|
rpc func(client E, ctx context.Context, req *C, options ...grpc.CallOption) (*D, error),
|
|
client func() (E, error),
|
|
c *gin.Context,
|
|
) {
|
|
|
|
}
|
|
|
|
func Call3[C, D, E any](
|
|
rpc func(client E, ctx context.Context, req *C, options ...grpc.CallOption) (*D, error),
|
|
//client func() (E, error),
|
|
c *gin.Context,
|
|
) {
|
|
|
|
}
|
|
|
|
func Call4[C, D, E any](
|
|
rpc func(client E, ctx context.Context, req *C, options ...grpc.CallOption) (*D, error),
|
|
c *gin.Context,
|
|
) {
|
|
|
|
}
|
|
|
|
func Call10[A, B, C, D, E any](apiReq A, apiResp B, client func() (E, error), call func(client E, rpcReq C) (D, error)) {
|
|
|
|
}
|