mirror of
https://github.com/weloe/token-go.git
synced 2025-10-07 00:12:58 +08:00
fix: solve lint error,implement error
This commit is contained in:
@@ -2,6 +2,7 @@ package go_http_context
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/weloe/token-go/ctx"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -13,18 +14,18 @@ func NewReqStorage(req *http.Request) *HttpReqStorage {
|
||||
return &HttpReqStorage{source: req.Context()}
|
||||
}
|
||||
|
||||
func (r HttpReqStorage) Source() interface{} {
|
||||
func (r *HttpReqStorage) Source() interface{} {
|
||||
return r.source
|
||||
}
|
||||
|
||||
func (r HttpReqStorage) Get(key string) interface{} {
|
||||
func (r *HttpReqStorage) Get(key ctx.StorageKey) interface{} {
|
||||
return r.source.Value(key)
|
||||
}
|
||||
|
||||
func (r HttpReqStorage) Set(key string, value string) {
|
||||
func (r *HttpReqStorage) Set(key ctx.StorageKey, value string) {
|
||||
r.source = context.WithValue(r.source, key, value)
|
||||
}
|
||||
|
||||
func (r HttpReqStorage) Delete(key string) {
|
||||
func (r *HttpReqStorage) Delete(key ctx.StorageKey) {
|
||||
r.source = context.WithValue(r.source, key, nil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user