MCPcopy
hub / github.com/redis/go-redis / NewDefaultCommandPolicyResolver

Function NewDefaultCommandPolicyResolver

command_policy_resolver.go:172–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172func NewDefaultCommandPolicyResolver() *commandInfoResolver {
173 return NewCommandInfoResolver(func(ctx context.Context, cmd Cmder) *routing.CommandPolicy {
174 module := "core"
175 command := cmd.Name()
176 cmdParts := strings.Split(command, ".")
177 if len(cmdParts) == 2 {
178 module = cmdParts[0]
179 command = cmdParts[1]
180 }
181
182 if policy, ok := defaultPolicies[module][command]; ok {
183 return policy
184 }
185
186 return nil
187 })
188}
189
190func (r *commandInfoResolver) GetCommandPolicy(ctx context.Context, cmd Cmder) *routing.CommandPolicy {
191 if r.resolveFunc == nil {

Callers 1

NewClusterClientFunction · 0.85

Calls 2

NewCommandInfoResolverFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected