(filter *models.RouteFilter)
| 523 | } |
| 524 | |
| 525 | func buildFilterRouteQuery(filter *models.RouteFilter) (string, []interface{}) { |
| 526 | if filter == nil { |
| 527 | return "", nil |
| 528 | } |
| 529 | var b bytes.Buffer |
| 530 | var args []interface{} |
| 531 | |
| 532 | where := func(colOp, val string) { |
| 533 | if val != "" { |
| 534 | args = append(args, val) |
| 535 | if len(args) == 1 { |
| 536 | fmt.Fprintf(&b, "WHERE %s $1", colOp) |
| 537 | } else { |
| 538 | fmt.Fprintf(&b, " AND %s $%d", colOp, len(args)) |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | where("path =", filter.Path) |
| 544 | where("app_name =", filter.AppName) |
| 545 | where("image =", filter.Image) |
| 546 | |
| 547 | return b.String(), args |
| 548 | } |
| 549 | |
| 550 | func (ds *PostgresDatastore) Put(ctx context.Context, key, value []byte) error { |
| 551 | _, err := ds.db.Exec(` |
no outgoing calls
no test coverage detected
searching dependent graphs…