WithContext adds SQL context to the error. Attaches SQL source code context with highlighting information for visual error display. The context shows surrounding lines and highlights the specific location of the error. Parameters: - sql: Original SQL source code - highlightLen: Number of character
(sql string, highlightLen int)
| 365 | // |
| 366 | // Note: WithContext modifies the error in-place and returns it for chaining. |
| 367 | func (e *Error) WithContext(sql string, highlightLen int) *Error { |
| 368 | e.Context = &ErrorContext{ |
| 369 | SQL: sql, |
| 370 | StartLine: e.Location.Line, |
| 371 | EndLine: e.Location.Line, |
| 372 | HighlightCol: e.Location.Column, |
| 373 | HighlightLen: highlightLen, |
| 374 | } |
| 375 | return e |
| 376 | } |
| 377 | |
| 378 | // WithHint adds a suggestion hint to the error. |
| 379 | // |
no outgoing calls