fileId ctx funcs
This commit is contained in:
parent
a497e129c4
commit
bee7146a60
@ -21,6 +21,7 @@ type ctxKey uint
|
||||
|
||||
const (
|
||||
ctxKeySpaceId ctxKey = iota
|
||||
ctxKeyFileId
|
||||
)
|
||||
|
||||
type BlockStore interface {
|
||||
@ -48,3 +49,12 @@ func CtxGetSpaceId(ctx context.Context) (spaceId string) {
|
||||
spaceId, _ = ctx.Value(ctxKeySpaceId).(string)
|
||||
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