Documentation
¶
Overview ¶
Package rese: Result extraction with error handling - Streamline Go error handling patterns Transform verbose error checking into clean, expressive code with type-safe generic functions Provides multiple function series (V, P, C, A) for different validation scenarios Each series supports 0-9 parameters with error checking and value validation
rese: 结果提取与错误处理 - 简化 Go 错误处理模式 将冗长的错误检查转换为简洁、富有表现力的类型安全泛型函数代码 提供多个函数系列(V、P、C、A)用于不同的验证场景 每个系列支持 0-9 个参数,带有错误检查和值验证
Index ¶
- func A0(err error)
- func A1[T1 any](v1 []T1, err error) []T1
- func A2[T1, T2 any](v1 []T1, v2 []T2, err error) ([]T1, []T2)
- func A3[T1, T2, T3 any](v1 []T1, v2 []T2, v3 []T3, err error) ([]T1, []T2, []T3)
- func A4[T1, T2, T3, T4 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, err error) ([]T1, []T2, []T3, []T4)
- func A5[T1, T2, T3, T4, T5 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, err error) ([]T1, []T2, []T3, []T4, []T5)
- func A6[T1, T2, T3, T4, T5, T6 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, err error) ([]T1, []T2, []T3, []T4, []T5, []T6)
- func A7[T1, T2, T3, T4, T5, T6, T7 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, err error) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7)
- func A8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, v8 []T8, ...) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7, []T8)
- func A9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, v8 []T8, ...) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7, []T8, []T9)
- func C0(err error)
- func C1[T1 comparable](v1 T1, err error) T1
- func C2[T1, T2 comparable](v1 T1, v2 T2, err error) (T1, T2)
- func C3[T1, T2, T3 comparable](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)
- func C4[T1, T2, T3, T4 comparable](v1 T1, v2 T2, v3 T3, v4 T4, err error) (T1, T2, T3, T4)
- func C5[T1, T2, T3, T4, T5 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, err error) (T1, T2, T3, T4, T5)
- func C6[T1, T2, T3, T4, T5, T6 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, err error) (T1, T2, T3, T4, T5, T6)
- func C7[T1, T2, T3, T4, T5, T6, T7 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, err error) (T1, T2, T3, T4, T5, T6, T7)
- func C8[T1, T2, T3, T4, T5, T6, T7, T8 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, err error) (T1, T2, T3, T4, T5, T6, T7, T8)
- func C9[T1, T2, T3, T4, T5, T6, T7, T8, T9 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, v9 T9, err error) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
- func F0(run func() error)
- func F1[T1 any](run func() (T1, error)) T1
- func F2[T1, T2 any](run func() (T1, T2, error)) (T1, T2)
- func F3[T1, T2, T3 any](run func() (T1, T2, T3, error)) (T1, T2, T3)
- func F4[T1, T2, T3, T4 any](run func() (T1, T2, T3, T4, error)) (T1, T2, T3, T4)
- func F5[T1, T2, T3, T4, T5 any](run func() (T1, T2, T3, T4, T5, error)) (T1, T2, T3, T4, T5)
- func F6[T1, T2, T3, T4, T5, T6 any](run func() (T1, T2, T3, T4, T5, T6, error)) (T1, T2, T3, T4, T5, T6)
- func F7[T1, T2, T3, T4, T5, T6, T7 any](run func() (T1, T2, T3, T4, T5, T6, T7, error)) (T1, T2, T3, T4, T5, T6, T7)
- func F8[T1, T2, T3, T4, T5, T6, T7, T8 any](run func() (T1, T2, T3, T4, T5, T6, T7, T8, error)) (T1, T2, T3, T4, T5, T6, T7, T8)
- func F9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](run func() (T1, T2, T3, T4, T5, T6, T7, T8, T9, error)) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
- func M0(err error)
- func M1[K1 comparable, V1 any](m1 map[K1]V1, err error) map[K1]V1
- func M2[K1, K2 comparable, V1, V2 any](m1 map[K1]V1, m2 map[K2]V2, err error) (map[K1]V1, map[K2]V2)
- func M3[K1, K2, K3 comparable, V1, V2, V3 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, err error) (map[K1]V1, map[K2]V2, map[K3]V3)
- func M4[K1, K2, K3, K4 comparable, V1, V2, V3, V4 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4)
- func M5[K1, K2, K3, K4, K5 comparable, V1, V2, V3, V4, V5 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, ...) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5)
- func M6[K1, K2, K3, K4, K5, K6 comparable, V1, V2, V3, V4, V5, V6 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, ...) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6)
- func M7[K1, K2, K3, K4, K5, K6, K7 comparable, V1, V2, V3, V4, V5, V6, V7 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, ...) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7)
- func M8[K1, K2, K3, K4, K5, K6, K7, K8 comparable, V1, V2, V3, V4, V5, V6, V7, V8 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, ...) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7, ...)
- func M9[K1, K2, K3, K4, K5, K6, K7, K8, K9 comparable, ...](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, ...) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7, ...)
- func P0(err error)
- func P1[T1 any](v1 *T1, err error) *T1
- func P2[T1, T2 any](v1 *T1, v2 *T2, err error) (*T1, *T2)
- func P3[T1, T2, T3 any](v1 *T1, v2 *T2, v3 *T3, err error) (*T1, *T2, *T3)
- func P4[T1, T2, T3, T4 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, err error) (*T1, *T2, *T3, *T4)
- func P5[T1, T2, T3, T4, T5 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, err error) (*T1, *T2, *T3, *T4, *T5)
- func P6[T1, T2, T3, T4, T5, T6 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, err error) (*T1, *T2, *T3, *T4, *T5, *T6)
- func P7[T1, T2, T3, T4, T5, T6, T7 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, err error) (*T1, *T2, *T3, *T4, *T5, *T6, *T7)
- func P8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, v8 *T8, err error) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8)
- func P9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, v8 *T8, v9 *T9, ...) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9)
- func R0(run func() error)
- func R1[T1 any](run func() (*T1, error)) *T1
- func R2[T1, T2 any](run func() (*T1, *T2, error)) (*T1, *T2)
- func R3[T1, T2, T3 any](run func() (*T1, *T2, *T3, error)) (*T1, *T2, *T3)
- func R4[T1, T2, T3, T4 any](run func() (*T1, *T2, *T3, *T4, error)) (*T1, *T2, *T3, *T4)
- func R5[T1, T2, T3, T4, T5 any](run func() (*T1, *T2, *T3, *T4, *T5, error)) (*T1, *T2, *T3, *T4, *T5)
- func R6[T1, T2, T3, T4, T5, T6 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, error)) (*T1, *T2, *T3, *T4, *T5, *T6)
- func R7[T1, T2, T3, T4, T5, T6, T7 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7)
- func R8[T1, T2, T3, T4, T5, T6, T7, T8 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8)
- func R9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9)
- func V0(err error)
- func V1[T1 any](v1 T1, err error) T1
- func V2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2)
- func V3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)
- func V4[T1, T2, T3, T4 any](v1 T1, v2 T2, v3 T3, v4 T4, err error) (T1, T2, T3, T4)
- func V5[T1, T2, T3, T4, T5 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, err error) (T1, T2, T3, T4, T5)
- func V6[T1, T2, T3, T4, T5, T6 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, err error) (T1, T2, T3, T4, T5, T6)
- func V7[T1, T2, T3, T4, T5, T6, T7 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, err error) (T1, T2, T3, T4, T5, T6, T7)
- func V8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, err error) (T1, T2, T3, T4, T5, T6, T7, T8)
- func V9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, v9 T9, err error) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func A0 ¶
func A0(err error)
A0 checks error and panics if present Use github.com/yylego/must package for A0 scenario
A0 检查错误,如果存在则 panic A0 场景建议使用 github.com/yylego/must 包
func A1 ¶
A1 checks error and validates slice has elements, returns single slice Panics on error and panics when slice is nil/has no elements
A1 检查错误并验证切片有元素,返回单个切片 当有错误时 panic,当切片为 nil/无元素时 panic
func A2 ¶
A2 checks error and slices have elements, returns two slices Panics on error and panics when some slice is nil/has no elements
A2 检查错误和切片非空,返回两个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A3 ¶
A3 checks error and slices have elements, returns three slices Panics on error and panics when some slice is nil/has no elements
A3 检查错误和切片非空,返回三个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A4 ¶
A4 checks error and slices have elements, returns 4 slices Panics on error and panics when some slice is nil/has no elements
A4 检查错误和切片非空,返回 4 个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A5 ¶
func A5[T1, T2, T3, T4, T5 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, err error) ([]T1, []T2, []T3, []T4, []T5)
A5 checks error and slices have elements, returns five slices Panics on error and panics when some slice is nil/has no elements
A5 检查错误和切片非空,返回五个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A6 ¶
func A6[T1, T2, T3, T4, T5, T6 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, err error) ([]T1, []T2, []T3, []T4, []T5, []T6)
A6 checks error and slices have elements, returns six slices Panics on error and panics when some slice is nil/has no elements
A6 检查错误和切片非空,返回六个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A7 ¶
func A7[T1, T2, T3, T4, T5, T6, T7 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, err error) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7)
A7 checks error and slices have elements, returns seven slices Panics on error and panics when some slice is nil/has no elements
A7 检查错误和切片非空,返回七个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A8 ¶
func A8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, v8 []T8, err error) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7, []T8)
A8 checks error and slices have elements, returns eight slices Panics on error and panics when some slice is nil/has no elements
A8 检查错误和切片非空,返回八个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func A9 ¶
func A9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 []T1, v2 []T2, v3 []T3, v4 []T4, v5 []T5, v6 []T6, v7 []T7, v8 []T8, v9 []T9, err error) ([]T1, []T2, []T3, []T4, []T5, []T6, []T7, []T8, []T9)
A9 checks error and slices have elements, returns nine slices Panics on error and panics when some slice is nil/has no elements
A9 检查错误和切片非空,返回九个切片 当有错误时 panic,当某个切片为 nil/无元素时 panic
func C0 ¶
func C0(err error)
C0 checks error and panics if present Use github.com/yylego/must package for C0 scenario
C0 检查错误,如果存在则 panic C0 场景建议使用 github.com/yylego/must 包
func C1 ¶
func C1[T1 comparable](v1 T1, err error) T1
C1 checks error and value non-zero, returns single comparable value Panics on error and panics when value is zero
C1 检查错误和值非零,返回单个可比较值 当有错误时 panic,当值为零时 panic
func C2 ¶
func C2[T1, T2 comparable](v1 T1, v2 T2, err error) (T1, T2)
C2 checks error and values non-zero, returns two comparable values Panics on error and panics when some value is zero
C2 检查错误和值非零,返回两个可比较值 当有错误时 panic,当某个值为零时 panic
func C3 ¶
func C3[T1, T2, T3 comparable](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)
C3 checks error and values non-zero, returns three comparable values Panics on error and panics when some value is zero
C3 检查错误和值非零,返回三个可比较值 当有错误时 panic,当某个值为零时 panic
func C4 ¶
func C4[T1, T2, T3, T4 comparable](v1 T1, v2 T2, v3 T3, v4 T4, err error) (T1, T2, T3, T4)
C4 checks error and values non-zero, returns 4 comparable values Panics on error and panics when some value is zero
C4 检查错误和值非零,返回 4 个可比较值 当有错误时 panic,当某个值为零时 panic
func C5 ¶
func C5[T1, T2, T3, T4, T5 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, err error) (T1, T2, T3, T4, T5)
C5 checks error and values non-zero, returns five comparable values Panics on error and panics when some value is zero
C5 检查错误和值非零,返回五个可比较值 当有错误时 panic,当某个值为零时 panic
func C6 ¶
func C6[T1, T2, T3, T4, T5, T6 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, err error) (T1, T2, T3, T4, T5, T6)
C6 checks error and values non-zero, returns six comparable values Panics on error and panics when some value is zero
C6 检查错误和值非零,返回六个可比较值 当有错误时 panic,当某个值为零时 panic
func C7 ¶
func C7[T1, T2, T3, T4, T5, T6, T7 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, err error) (T1, T2, T3, T4, T5, T6, T7)
C7 checks error and values non-zero, returns seven comparable values Panics on error and panics when some value is zero
C7 检查错误和值非零,返回七个可比较值 当有错误时 panic,当某个值为零时 panic
func C8 ¶
func C8[T1, T2, T3, T4, T5, T6, T7, T8 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, err error) (T1, T2, T3, T4, T5, T6, T7, T8)
C8 checks error and values non-zero, returns eight comparable values Panics on error and panics when some value is zero
C8 检查错误和值非零,返回八个可比较值 当有错误时 panic,当某个值为零时 panic
func C9 ¶
func C9[T1, T2, T3, T4, T5, T6, T7, T8, T9 comparable](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, v9 T9, err error) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
C9 checks error and values non-zero, returns nine comparable values Panics on error and panics when some value is zero
C9 检查错误和值非零,返回九个可比较值 当有错误时 panic,当某个值为零时 panic
func F0 ¶
func F0(run func() error)
F0 executes function and checks error, applying V0 validation Use github.com/yylego/must package for F0 scenario
F0 执行函数并检查错误,应用 V0 验证 F0 场景建议使用 github.com/yylego/must 包
func F1 ¶
F1 executes function and checks the result, applying V1 validation Returns single value from function and panics when error is present
F1 执行函数并检查结果,应用 V1 验证 返回函数的单个值,当有错误时 panic
func F2 ¶
F2 executes function and checks the result, applying V2 validation Returns two values from function and panics when error is present
F2 执行函数并检查结果,应用 V2 验证 返回函数的两个值,当有错误时 panic
func F3 ¶
F3 executes function and checks the result, applying V3 validation Returns three values from function and panics when error is present
F3 执行函数并检查结果,应用 V3 验证 返回函数的三个值,当有错误时 panic
func F4 ¶
F4 executes function and checks the result, applying V4 validation Returns 4 values from function and panics when error is present
F4 执行函数并检查结果,应用 V4 验证 返回函数的 4 个值,当有错误时 panic
func F5 ¶
F5 executes function and checks the result, applying V5 validation Returns 5 values from function and panics when error is present
F5 执行函数并检查结果,应用 V5 验证 返回函数的 5 个值,当有错误时 panic
func F6 ¶
func F6[T1, T2, T3, T4, T5, T6 any](run func() (T1, T2, T3, T4, T5, T6, error)) (T1, T2, T3, T4, T5, T6)
F6 executes function and checks the result, applying V6 validation Returns 6 values from function and panics when error is present
F6 执行函数并检查结果,应用 V6 验证 返回函数的 6 个值,当有错误时 panic
func F7 ¶
func F7[T1, T2, T3, T4, T5, T6, T7 any](run func() (T1, T2, T3, T4, T5, T6, T7, error)) (T1, T2, T3, T4, T5, T6, T7)
F7 executes function and checks the result, applying V7 validation Returns 7 values from function and panics when error is present
F7 执行函数并检查结果,应用 V7 验证 返回函数的 7 个值,当有错误时 panic
func F8 ¶
func F8[T1, T2, T3, T4, T5, T6, T7, T8 any](run func() (T1, T2, T3, T4, T5, T6, T7, T8, error)) (T1, T2, T3, T4, T5, T6, T7, T8)
F8 executes function and checks the result, applying V8 validation Returns 8 values from function and panics when error is present
F8 执行函数并检查结果,应用 V8 验证 返回函数的 8 个值,当有错误时 panic
func F9 ¶
func F9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](run func() (T1, T2, T3, T4, T5, T6, T7, T8, T9, error)) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
F9 executes function and checks the result, applying V9 validation Returns 9 values from function and panics when error is present
F9 执行函数并检查结果,应用 V9 验证 返回函数的 9 个值,当有错误时 panic
func M0 ¶
func M0(err error)
M0 checks error and panics if present Use github.com/yylego/must package for M0 scenario
M0 检查错误,如果存在则 panic M0 场景建议使用 github.com/yylego/must 包
func M1 ¶
func M1[K1 comparable, V1 any](m1 map[K1]V1, err error) map[K1]V1
M1 checks error and map has entries, returns single map Panics when error is present and when map is nil/has no entries
M1 检查错误和映射有条目,返回单个映射 当有错误时 panic,当映射为 nil/无条目时 panic
func M2 ¶
func M2[K1, K2 comparable, V1, V2 any](m1 map[K1]V1, m2 map[K2]V2, err error) (map[K1]V1, map[K2]V2)
M2 checks error and maps have entries, returns two maps Panics when error is present and when some map is nil/has no entries
M2 检查错误和映射有条目,返回两个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M3 ¶
func M3[K1, K2, K3 comparable, V1, V2, V3 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, err error) (map[K1]V1, map[K2]V2, map[K3]V3)
M3 checks error and maps have entries, returns three maps Panics when error is present and when some map is nil/has no entries
M3 检查错误和映射有条目,返回三个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M4 ¶
func M4[K1, K2, K3, K4 comparable, V1, V2, V3, V4 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4)
M4 checks error and maps have entries, returns 4 maps Panics when error is present and when some map is nil/has no entries
M4 检查错误和映射有条目,返回 4 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M5 ¶
func M5[K1, K2, K3, K4, K5 comparable, V1, V2, V3, V4, V5 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5)
M5 checks error and maps have entries, returns 5 maps Panics when error is present and when some map is nil/has no entries
M5 检查错误和映射有条目,返回 5 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M6 ¶
func M6[K1, K2, K3, K4, K5, K6 comparable, V1, V2, V3, V4, V5, V6 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, m6 map[K6]V6, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6)
M6 checks error and maps have entries, returns 6 maps Panics when error is present and when some map is nil/has no entries
M6 检查错误和映射有条目,返回 6 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M7 ¶
func M7[K1, K2, K3, K4, K5, K6, K7 comparable, V1, V2, V3, V4, V5, V6, V7 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, m6 map[K6]V6, m7 map[K7]V7, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7)
M7 checks error and maps have entries, returns 7 maps Panics when error is present and when some map is nil/has no entries
M7 检查错误和映射有条目,返回 7 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M8 ¶
func M8[K1, K2, K3, K4, K5, K6, K7, K8 comparable, V1, V2, V3, V4, V5, V6, V7, V8 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, m6 map[K6]V6, m7 map[K7]V7, m8 map[K8]V8, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7, map[K8]V8)
M8 checks error and maps have entries, returns 8 maps Panics when error is present and when some map is nil/has no entries
M8 检查错误和映射有条目,返回 8 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func M9 ¶
func M9[K1, K2, K3, K4, K5, K6, K7, K8, K9 comparable, V1, V2, V3, V4, V5, V6, V7, V8, V9 any](m1 map[K1]V1, m2 map[K2]V2, m3 map[K3]V3, m4 map[K4]V4, m5 map[K5]V5, m6 map[K6]V6, m7 map[K7]V7, m8 map[K8]V8, m9 map[K9]V9, err error) (map[K1]V1, map[K2]V2, map[K3]V3, map[K4]V4, map[K5]V5, map[K6]V6, map[K7]V7, map[K8]V8, map[K9]V9)
M9 checks error and maps have entries, returns 9 maps Panics when error is present and when some map is nil/has no entries
M9 检查错误和映射有条目,返回 9 个映射 当有错误时 panic,当某个映射为 nil/无条目时 panic
func P0 ¶
func P0(err error)
P0 checks error and panics if present Use github.com/yylego/must package for P0 scenario
P0 检查错误,如果存在则 panic P0 场景建议使用 github.com/yylego/must 包
func P1 ¶
P1 checks error and validates pointer is non-nil, returns single pointer Panics when error is present and when pointer is nil
P1 检查错误并验证指针非 nil,返回单个指针 当有错误时 panic,当指针为 nil 时 panic
func P2 ¶
P2 checks error and validates pointers non-nil, returns two pointers Panics when error is present and when some pointer is nil
P2 检查错误并验证指针非 nil,返回两个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P3 ¶
P3 checks error and validates pointers non-nil, returns three pointers Panics when error is present and when some pointer is nil
P3 检查错误并验证指针非 nil,返回三个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P4 ¶
P4 checks error and validates pointers non-nil, returns 4 pointers Panics when error is present and when some pointer is nil
P4 检查错误并验证指针非 nil,返回 4 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P5 ¶
func P5[T1, T2, T3, T4, T5 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, err error) (*T1, *T2, *T3, *T4, *T5)
P5 checks error and validates pointers non-nil, returns 5 pointers Panics when error is present and when some pointer is nil
P5 检查错误并验证指针非 nil,返回 5 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P6 ¶
func P6[T1, T2, T3, T4, T5, T6 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, err error) (*T1, *T2, *T3, *T4, *T5, *T6)
P6 checks error and validates pointers non-nil, returns 6 pointers Panics when error is present and when some pointer is nil
P6 检查错误并验证指针非 nil,返回 6 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P7 ¶
func P7[T1, T2, T3, T4, T5, T6, T7 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, err error) (*T1, *T2, *T3, *T4, *T5, *T6, *T7)
P7 checks error and validates pointers non-nil, returns 7 pointers Panics when error is present and when some pointer is nil
P7 检查错误并验证指针非 nil,返回 7 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P8 ¶
func P8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, v8 *T8, err error) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8)
P8 checks error and validates pointers non-nil, returns 8 pointers Panics when error is present and when some pointer is nil
P8 检查错误并验证指针非 nil,返回 8 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func P9 ¶
func P9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 *T1, v2 *T2, v3 *T3, v4 *T4, v5 *T5, v6 *T6, v7 *T7, v8 *T8, v9 *T9, err error) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9)
P9 checks error and validates pointers non-nil, returns 9 pointers Panics when error is present and when some pointer is nil
P9 检查错误并验证指针非 nil,返回 9 个指针 当有错误时 panic,当某个指针为 nil 时 panic
func R0 ¶
func R0(run func() error)
R0 executes function and checks error, applying P0 validation Use github.com/yylego/must package for R0 scenario
R0 执行函数并检查错误,应用 P0 验证 R0 场景建议使用 github.com/yylego/must 包
func R1 ¶
R1 executes function and checks the result with pointer validation, applying P1 validation Returns single non-nil pointer from function and panics when error/nil is present
R1 执行函数并检查结果和指针验证,应用 P1 验证 返回函数的单个非 nil 指针,当有错误/nil 时 panic
func R2 ¶
R2 executes function and checks the result with pointer validation, applying P2 validation Returns two non-nil pointers from function and panics when error/nil is present
R2 执行函数并检查结果和指针验证,应用 P2 验证 返回函数的两个非 nil 指针,当有错误/nil 时 panic
func R3 ¶
R3 executes function and checks the result with pointer validation, applying P3 validation Returns three non-nil pointers from function and panics when error/nil is present
R3 执行函数并检查结果和指针验证,应用 P3 验证 返回函数的三个非 nil 指针,当有错误/nil 时 panic
func R4 ¶
R4 executes function and checks the result with pointer validation, applying P4 validation Returns 4 non-nil pointers from function and panics when error/nil is present
R4 执行函数并检查结果和指针验证,应用 P4 验证 返回函数的 4 个非 nil 指针,当有错误/nil 时 panic
func R5 ¶
func R5[T1, T2, T3, T4, T5 any](run func() (*T1, *T2, *T3, *T4, *T5, error)) (*T1, *T2, *T3, *T4, *T5)
R5 executes function and checks the result with pointer validation, applying P5 validation Returns 5 non-nil pointers from function and panics when error/nil is present
R5 执行函数并检查结果和指针验证,应用 P5 验证 返回函数的 5 个非 nil 指针,当有错误/nil 时 panic
func R6 ¶
func R6[T1, T2, T3, T4, T5, T6 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, error)) (*T1, *T2, *T3, *T4, *T5, *T6)
R6 executes function and checks the result with pointer validation, applying P6 validation Returns 6 non-nil pointers from function and panics when error/nil is present
R6 执行函数并检查结果和指针验证,应用 P6 验证 返回函数的 6 个非 nil 指针,当有错误/nil 时 panic
func R7 ¶
func R7[T1, T2, T3, T4, T5, T6, T7 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7)
R7 executes function and checks the result with pointer validation, applying P7 validation Returns 7 non-nil pointers from function and panics when error/nil is present
R7 执行函数并检查结果和指针验证,应用 P7 验证 返回函数的 7 个非 nil 指针,当有错误/nil 时 panic
func R8 ¶
func R8[T1, T2, T3, T4, T5, T6, T7, T8 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8)
R8 executes function and checks the result with pointer validation, applying P8 validation Returns 8 non-nil pointers from function and panics when error/nil is present
R8 执行函数并检查结果和指针验证,应用 P8 验证 返回函数的 8 个非 nil 指针,当有错误/nil 时 panic
func R9 ¶
func R9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](run func() (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9, error)) (*T1, *T2, *T3, *T4, *T5, *T6, *T7, *T8, *T9)
R9 executes function and checks the result with pointer validation, applying P9 validation Returns 9 non-nil pointers from function and panics when error/nil is present
R9 执行函数并检查结果和指针验证,应用 P9 验证 返回函数的 9 个非 nil 指针,当有错误/nil 时 panic
func V0 ¶
func V0(err error)
V0 checks error and panics if present Use github.com/yylego/must package for V0 scenario
V0 检查错误,如果存在则 panic V0 场景建议使用 github.com/yylego/must 包
func V1 ¶
V1 checks error and returns single value Panics when error is present and returns the value when not
V1 检查错误并返回单个值 当有错误时 panic,没有错误时返回值
func V2 ¶
V2 checks error and returns two values Panics when error is present and returns the values when not
V2 检查错误并返回两个值 当有错误时 panic,没有错误时返回值
func V3 ¶
V3 checks error and returns three values Panics when error is present and returns the values when not
V3 检查错误并返回三个值 当有错误时 panic,没有错误时返回值
func V4 ¶
V4 checks error and returns 4 values Panics when error is present and returns the values when not
V4 检查错误并返回 4 个值 当有错误时 panic,没有错误时返回值
func V5 ¶
V5 checks error and returns 5 values Panics when error is present and returns the values when not
V5 检查错误并返回 5 个值 当有错误时 panic,没有错误时返回值
func V6 ¶
func V6[T1, T2, T3, T4, T5, T6 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, err error) (T1, T2, T3, T4, T5, T6)
V6 checks error and returns 6 values Panics when error is present and returns the values when not
V6 检查错误并返回 6 个值 当有错误时 panic,没有错误时返回值
func V7 ¶
func V7[T1, T2, T3, T4, T5, T6, T7 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, err error) (T1, T2, T3, T4, T5, T6, T7)
V7 checks error and returns 7 values Panics when error is present and returns the values when not
V7 检查错误并返回 7 个值 当有错误时 panic,没有错误时返回值
func V8 ¶
func V8[T1, T2, T3, T4, T5, T6, T7, T8 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, err error) (T1, T2, T3, T4, T5, T6, T7, T8)
V8 checks error and returns 8 values Panics when error is present and returns the values when not
V8 检查错误并返回 8 个值 当有错误时 panic,没有错误时返回值
func V9 ¶
func V9[T1, T2, T3, T4, T5, T6, T7, T8, T9 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, v7 T7, v8 T8, v9 T9, err error) (T1, T2, T3, T4, T5, T6, T7, T8, T9)
V9 checks error and returns 9 values Panics when error is present and returns the values when not
V9 检查错误并返回 9 个值 当有错误时 panic,没有错误时返回值
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
demos/demo1x
command
|
|
|
demos/demo2x
command
|
|
|
demos/demo3x
command
|
|
|
Package resb: Boolean result handling - Streamline functions that return (value, bool) patterns Transform map lookups and value checks with ok-pattern into clean, panic-on-false validation Provides V, P, C series for handling (value, bool) results with type-safe generic functions Each series supports 0-9 parameters with bool checking and value validation
|
Package resb: Boolean result handling - Streamline functions that return (value, bool) patterns Transform map lookups and value checks with ok-pattern into clean, panic-on-false validation Provides V, P, C series for handling (value, bool) results with type-safe generic functions Each series supports 0-9 parameters with bool checking and value validation |