(ctx context.Context, filter *models.AppFilter)
| 217 | } |
| 218 | |
| 219 | func (ds *PostgresDatastore) GetApps(ctx context.Context, filter *models.AppFilter) ([]*models.App, error) { |
| 220 | res := []*models.App{} |
| 221 | |
| 222 | filterQuery, args := buildFilterAppQuery(filter) |
| 223 | rows, err := ds.db.Query(fmt.Sprintf("SELECT DISTINCT * FROM apps %s", filterQuery), args...) |
| 224 | if err != nil { |
| 225 | return nil, err |
| 226 | } |
| 227 | defer rows.Close() |
| 228 | |
| 229 | for rows.Next() { |
| 230 | var app models.App |
| 231 | err := scanApp(rows, &app) |
| 232 | |
| 233 | if err != nil { |
| 234 | if err == sql.ErrNoRows { |
| 235 | return res, nil |
| 236 | } |
| 237 | return res, err |
| 238 | } |
| 239 | res = append(res, &app) |
| 240 | } |
| 241 | |
| 242 | if err := rows.Err(); err != nil { |
| 243 | return res, err |
| 244 | } |
| 245 | return res, nil |
| 246 | } |
| 247 | |
| 248 | func (ds *PostgresDatastore) InsertRoute(ctx context.Context, route *models.Route) (*models.Route, error) { |
| 249 | hbyte, err := json.Marshal(route.Headers) |
nothing calls this directly
no test coverage detected