MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / GinAppendValues

Function GinAppendValues

server/common/common.go:137–146  ·  view source on GitHub ↗

GinAppendValues 向当前请求上下文追加键值,提供类似 gin.Context Set/Get 的可变语义。 同一请求内,已持有的上下文引用会同步看到后续更新。

(c *gin.Context, keyAndValue ...any)

Source from the content-addressed store, hash-verified

135// GinAppendValues 向当前请求上下文追加键值,提供类似 gin.Context Set/Get 的可变语义。
136// 同一请求内,已持有的上下文引用会同步看到后续更新。
137func GinAppendValues(c *gin.Context, keyAndValue ...any) {
138 ctx := c.Request.Context()
139 if r, ok := ctx.(*requestContext); ok {
140 r.Context = ContentWithValues(r.Context, keyAndValue...)
141 return
142 }
143 c.Request = c.Request.WithContext(
144 &requestContext{ContentWithValues(ctx, keyAndValue...)},
145 )
146}
147
148func ContentWithValues(ctx context.Context, keyAndValue ...any) context.Context {
149 if len(keyAndValue) < 1 || len(keyAndValue)%2 != 0 {

Callers 15

WebDAVAuthFunction · 0.92
SharingIdParseFunction · 0.92
EmptyPathParseFunction · 0.92
AuthFunction · 0.92
AuthnFunction · 0.92
StoragesLoadedFunction · 0.92
PathParseFunction · 0.92
DownFunction · 0.92
TestToolsListSuccessFunction · 0.92
TestToolsCallUnknownToolFunction · 0.92

Calls 1

ContentWithValuesFunction · 0.85