MustGet returns the value for the given key if it exists, otherwise it panics.
(key any)
| 294 | |
| 295 | // MustGet returns the value for the given key if it exists, otherwise it panics. |
| 296 | func (c *Context) MustGet(key any) any { |
| 297 | if value, exists := c.Get(key); exists { |
| 298 | return value |
| 299 | } |
| 300 | panic(fmt.Sprintf("key %v does not exist", key)) |
| 301 | } |
| 302 | |
| 303 | func getTyped[T any](c *Context, key any) (res T) { |
| 304 | if val, ok := c.Get(key); ok && val != nil { |