feat: add HTTP migration bridges and extensible API binding
This commit is contained in:
@@ -3,6 +3,7 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"example.com/userService/internal/servicecontext"
|
||||
"example.com/userService/internal/types"
|
||||
"fmt"
|
||||
"git.yuntuo.hk/k2safe/go-omni/contract"
|
||||
@@ -17,9 +18,18 @@ type Service interface {
|
||||
DeleteUser(ctx context.Context, req *types.UserIDReq) error
|
||||
ExportUser(ctx context.Context, req *types.UserIDReq) (*types.ExportResp, error)
|
||||
}
|
||||
type Handler struct{ service Service }
|
||||
type Handler struct {
|
||||
service Service
|
||||
deps *servicecontext.Context
|
||||
}
|
||||
|
||||
func New(s Service) *Handler { return &Handler{service: s} }
|
||||
func New(s Service, deps ...*servicecontext.Context) *Handler {
|
||||
h := &Handler{service: s}
|
||||
if len(deps) > 0 {
|
||||
h.deps = deps[0]
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
var createUserRequest = contract.MustNew[types.CreateUserReq]()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user