优化结构

This commit is contained in:
Yvan
2026-08-22 12:13:16 +08:00
parent d987244d0e
commit b27a66e9d3
200 changed files with 1794 additions and 1715 deletions
+19
View File
@@ -0,0 +1,19 @@
package system
import "context"
type actorContextKey struct{}
type Actor struct {
UserID uint
AuthorityID uint
}
func NewActorContext(ctx context.Context, actor Actor) context.Context {
return context.WithValue(ctx, actorContextKey{}, actor)
}
func ActorFromContext(ctx context.Context) (Actor, bool) {
actor, ok := ctx.Value(actorContextKey{}).(Actor)
return actor, ok
}