GetFunction returns the associated function for the given ID. This will always return a valid function.
(ctx *sql.Context, id uint32)
| 76 | |
| 77 | // GetFunction returns the associated function for the given ID. This will always return a valid function. |
| 78 | func (r *functionRegistry) GetFunction(ctx *sql.Context, id uint32) QuickFunction { |
| 79 | r.mutex.Lock() |
| 80 | defer r.mutex.Unlock() |
| 81 | f := r.functions[id] |
| 82 | if f != nil { |
| 83 | return f |
| 84 | } |
| 85 | if id == 0 { |
| 86 | return nil |
| 87 | } |
| 88 | f = r.loadFunction(ctx, id) |
| 89 | if f == nil { |
| 90 | // If we hit this panic, then we're missing a test that uses this function (and we should add that test) |
| 91 | panic(errors.Errorf("cannot find function: `%s`", r.revMapping[id])) |
| 92 | } |
| 93 | return f |
| 94 | } |
| 95 | |
| 96 | // GetInternalID returns the function's Internal ID associated with the given registry ID. |
| 97 | func (r *functionRegistry) GetInternalID(registryID uint32) id.Function { |
no test coverage detected