Example_multiLineError demonstrates error in multi-line SQL with proper context
()
| 111 | |
| 112 | // Example_multiLineError demonstrates error in multi-line SQL with proper context |
| 113 | func Example_multiLineError() { |
| 114 | sql := `SELECT |
| 115 | u.id, |
| 116 | u.name, |
| 117 | u.email |
| 118 | FROM users u |
| 119 | JOIN orders o ON u.id = o.user_id |
| 120 | WHERE u.age > 18.45.6 |
| 121 | AND o.total > 100` |
| 122 | |
| 123 | location := models.Location{Line: 7, Column: 15} |
| 124 | err := errors.InvalidNumberError("18.45.6", location, sql) |
| 125 | |
| 126 | fmt.Println("Multi-line SQL Error:") |
| 127 | fmt.Println(err.Error()) |
| 128 | fmt.Println() |
| 129 | |
| 130 | // Shows context with proper line numbering: |
| 131 | // Line 6: JOIN orders o ON u.id = o.user_id |
| 132 | // Line 7: WHERE u.age > 18.45.6 <- Error indicator here |
| 133 | // Line 8: AND o.total > 100 |
| 134 | } |
| 135 | |
| 136 | // Example_errorCodeProgrammaticHandling demonstrates using error codes for logic |
| 137 | func Example_errorCodeProgrammaticHandling() { |
nothing calls this directly
no test coverage detected