()
| 314 | } |
| 315 | |
| 316 | func ExampleError() { |
| 317 | video := &Video{ |
| 318 | Id: 123, |
| 319 | } |
| 320 | _, err := pgdb.Model(video).Insert() |
| 321 | panicIf(err) |
| 322 | |
| 323 | _, err = pgdb.Model(video).Insert() |
| 324 | if err != nil { |
| 325 | pgErr, ok := err.(pg.Error) |
| 326 | if ok && pgErr.IntegrityViolation() { |
| 327 | fmt.Println("video already exists:", err) |
| 328 | } else if pgErr.Field('S') == "PANIC" { |
| 329 | panic(err) |
| 330 | } |
| 331 | } |
| 332 | // Output: video already exists: ERROR #23505 duplicate key value violates unique constraint "videos_pkey" |
| 333 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…