fileId ctx funcs
This commit is contained in:
parent
3dc92b9a67
commit
89dd5dada2
@ -21,6 +21,7 @@ type ctxKey uint
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
ctxKeySpaceId ctxKey = iota
|
ctxKeySpaceId ctxKey = iota
|
||||||
|
ctxKeyFileId
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlockStore interface {
|
type BlockStore interface {
|
||||||
@ -48,3 +49,12 @@ func CtxGetSpaceId(ctx context.Context) (spaceId string) {
|
|||||||
spaceId, _ = ctx.Value(ctxKeySpaceId).(string)
|
spaceId, _ = ctx.Value(ctxKeySpaceId).(string)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CtxWithFileId(ctx context.Context, spaceId string) context.Context {
|
||||||
|
return context.WithValue(ctx, ctxKeyFileId, spaceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CtxGetFileId(ctx context.Context) (spaceId string) {
|
||||||
|
spaceId, _ = ctx.Value(ctxKeyFileId).(string)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user