(kiteProt *protocol.Kite, value *kontrolprotocol.RegisterValue)
| 309 | } |
| 310 | |
| 311 | func (p *Postgres) Update(kiteProt *protocol.Kite, value *kontrolprotocol.RegisterValue) error { |
| 312 | // check that the incoming url is valid to prevent malformed input |
| 313 | _, err := url.Parse(value.URL) |
| 314 | if err != nil { |
| 315 | return err |
| 316 | } |
| 317 | |
| 318 | // TODO: also consider just using WHERE id = kiteProt.ID, see how it's |
| 319 | // performs out |
| 320 | _, err = p.DB.Exec(`UPDATE kite.kite SET url = $1, updated_at = (now() at time zone 'utc') |
| 321 | WHERE id = $2`, |
| 322 | value.URL, kiteProt.ID) |
| 323 | |
| 324 | return err |
| 325 | } |
| 326 | |
| 327 | func (p *Postgres) Delete(kiteProt *protocol.Kite) error { |
| 328 | deleteKite := `DELETE FROM kite.kite WHERE id = $1` |
nothing calls this directly
no outgoing calls
no test coverage detected