mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fix postgres GetApp bug when filter is nil (#383)
This commit is contained in:
committed by
Travis Reeder
parent
3b1011ca88
commit
9387e9bc41
@@ -482,16 +482,18 @@ func (ds *PostgresDatastore) GetRoutesByApp(ctx context.Context, appName string,
|
||||
func buildFilterAppQuery(filter *models.AppFilter) string {
|
||||
filterQuery := ""
|
||||
|
||||
filterQueries := []string{}
|
||||
if filter.Name != "" {
|
||||
filterQueries = append(filterQueries, fmt.Sprintf("name LIKE '%s'", filter.Name))
|
||||
}
|
||||
if filter != nil {
|
||||
filterQueries := []string{}
|
||||
if filter.Name != "" {
|
||||
filterQueries = append(filterQueries, fmt.Sprintf("name LIKE '%s'", filter.Name))
|
||||
}
|
||||
|
||||
for i, field := range filterQueries {
|
||||
if i == 0 {
|
||||
filterQuery = fmt.Sprintf("WHERE %s ", field)
|
||||
} else {
|
||||
filterQuery = fmt.Sprintf("%s AND %s", filterQuery, field)
|
||||
for i, field := range filterQueries {
|
||||
if i == 0 {
|
||||
filterQuery = fmt.Sprintf("WHERE %s ", field)
|
||||
} else {
|
||||
filterQuery = fmt.Sprintf("%s AND %s", filterQuery, field)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user