优化结构

This commit is contained in:
Yvan
2026-08-21 10:29:14 +08:00
parent 56980c8087
commit 055f6811ca
340 changed files with 382 additions and 382 deletions
+27
View File
@@ -0,0 +1,27 @@
package biz
import "context"
type DataScope struct {
All bool
Scope int
UserID uint
AuthorityID uint
PrimaryDeptID uint
OwnerUserID uint
DepartmentIDs []uint
RequestID string
Method string
Path string
}
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
}