This commit is contained in:
2026-08-13 21:51:20 +08:00
parent be5362913b
commit 21c264fcd7
60 changed files with 10174 additions and 69 deletions
+20
View File
@@ -0,0 +1,20 @@
package biz
import "context"
type DataScope struct {
All bool
OwnerUserID uint
DepartmentIDs []uint
}
type dataScopeKey struct{}
func NewDataScopeContext(ctx context.Context, scope DataScope) context.Context {
return context.WithValue(ctx, dataScopeKey{}, scope)
}
func DataScopeFromContext(ctx context.Context) (DataScope, bool) {
scope, ok := ctx.Value(dataScopeKey{}).(DataScope)
return scope, ok
}