ConstraintHandler is the interface that all constraints must implement. Built-in and custom constraints are treated uniformly through this interface.
| 68 | // ConstraintHandler is the interface that all constraints must implement. |
| 69 | // Built-in and custom constraints are treated uniformly through this interface. |
| 70 | type ConstraintHandler interface { |
| 71 | // Name returns the constraint identifier used in route patterns (e.g. "int", "minLen", "regex"). |
| 72 | Name() string |
| 73 | |
| 74 | // Execute validates a request parameter value against the constraint. |
| 75 | // param is the request parameter value to check. |
| 76 | // data contains the pre-typed constraint data produced by Analyze() at registration time. |
| 77 | Execute(param string, data []any) bool |
| 78 | } |
| 79 | |
| 80 | // ConstraintAnalyzer is an optional interface that constraints can implement |
| 81 | // to preprocess data at route registration time. The returned values are stored |
nothing calls this directly
no outgoing calls
no test coverage detected