feat(project): 项目完结

This commit is contained in:
peakxy
2026-05-30 23:16:49 +08:00
commit 60e7777cbd
97 changed files with 15027 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package tree
import "context"
type Handler[C any, D any, R any] interface {
Apply(ctx context.Context, command C, dynamic D) (R, error)
}
func Route[C any, D any, R any](ctx context.Context, next Handler[C, D, R], command C, dynamic D) (R, error) {
if next == nil {
return zero[R](), nil
}
return next.Apply(ctx, command, dynamic)
}
func zero[T any]() T {
var value T
return value
}