Move filter function
This commit is contained in:
parent
34da4ae77b
commit
52d9e9184f
|
@ -29,32 +29,6 @@ type SearchCriteria struct {
|
||||||
// fzf) to `string` values (which represent a primary key in the CardPrintings table)
|
// fzf) to `string` values (which represent a primary key in the CardPrintings table)
|
||||||
type InsertSearchOptions map[string]string
|
type InsertSearchOptions map[string]string
|
||||||
|
|
||||||
func filterPrinting(printing database.CardPrinting, searchCriteria SearchCriteria) bool {
|
|
||||||
if searchCriteria.SetCode != "" && printing.SetCode != searchCriteria.SetCode {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if searchCriteria.Foil == False && printing.IsFoil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if searchCriteria.Foil == True && !printing.IsFoil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if searchCriteria.Promo == False && printing.IsPromo {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if searchCriteria.Promo == True && !printing.IsPromo {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if searchCriteria.Language != "" && printing.Language != searchCriteria.Language {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetAllSearchOptions(db *sql.DB, searchCriteria SearchCriteria) (InsertSearchOptions, error) {
|
func GetAllSearchOptions(db *sql.DB, searchCriteria SearchCriteria) (InsertSearchOptions, error) {
|
||||||
var searchOptions InsertSearchOptions = make(map[string]string)
|
var searchOptions InsertSearchOptions = make(map[string]string)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue