new slot
This commit is contained in:
46
database.go
46
database.go
@ -161,6 +161,52 @@ func (r *Log4OMContactsRepository) ListByCountryMode(countryID string, mode stri
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Log4OMContactsRepository) ListByCountryModeBand(countryID string, band string, mode string, contactsModeBandChan chan []Contact, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
if mode == "USB" || mode == "LSB" {
|
||||
|
||||
rows, err := r.db.Query("SELECT callsign, band, mode, dxcc, stationcallsign, country FROM log WHERE dxcc = ? AND (mode = ? OR mode = ?) AND band = ?", countryID, "USB", "LSB", band)
|
||||
if err != nil {
|
||||
log.Error("could not query database", err)
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
contacts := []Contact{}
|
||||
for rows.Next() {
|
||||
c := Contact{}
|
||||
if err := rows.Scan(&c.Callsign, &c.Band, &c.Mode, &c.DXCC, &c.StationCallsign, &c.Country); err != nil {
|
||||
log.Error("could not query database", err)
|
||||
|
||||
}
|
||||
contacts = append(contacts, c)
|
||||
}
|
||||
contactsModeBandChan <- contacts
|
||||
|
||||
} else {
|
||||
|
||||
rows, err := r.db.Query("SELECT callsign, band, mode, dxcc, stationcallsign, country FROM log WHERE dxcc = ? AND mode = ? AND band = ?", countryID, mode, band)
|
||||
if err != nil {
|
||||
log.Error("could not query the database", err)
|
||||
}
|
||||
|
||||
defer rows.Close()
|
||||
|
||||
contacts := []Contact{}
|
||||
for rows.Next() {
|
||||
c := Contact{}
|
||||
if err := rows.Scan(&c.Callsign, &c.Band, &c.Mode, &c.DXCC, &c.StationCallsign, &c.Country); err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
}
|
||||
contacts = append(contacts, c)
|
||||
}
|
||||
contactsModeBandChan <- contacts
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Log4OMContactsRepository) ListByCountryBand(countryID string, band string, contactsBandChan chan []Contact, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
rows, err := r.db.Query("SELECT callsign, band, mode, dxcc, stationcallsign, country FROM log WHERE dxcc = ? AND band = ?", countryID, band)
|
||||
|
Reference in New Issue
Block a user