diff --git a/request.go b/request.go index a4289f0..bd7955b 100644 --- a/request.go +++ b/request.go @@ -18,6 +18,10 @@ func NewOkResult[T any](val T) Result[T] { return Result[T]{Val: val, Err: nil} } +func NewResult[T any](val T, err error) Result[T] { + return Result[T]{Val: val, Err: err} +} + // 新建一个错误结果 func NewErrResult(err error) Result[EmptyType] { return Result[EmptyType]{Val: struct{}{}, Err: err}