go routines for Db query

This commit is contained in:
2024-10-24 21:58:29 +07:00
parent 6bef3f45cd
commit 09e9c9ef80
4 changed files with 61 additions and 51 deletions

12
xml.go
View File

@ -66,13 +66,13 @@ func LoadCountryFile() Countries {
func GetDXCC(dxCall string, Countries Countries) string {
for i := 0; i < len(Countries.Countries); i++ {
for j := 0; j < len(Countries.Countries[i].CountryPrefixList.CountryPrefixList); j++ {
regExp := regexp.MustCompile(Countries.Countries[i].CountryPrefixList.CountryPrefixList[j].PrefixList)
match := regExp.FindStringSubmatch(dxCall)
if len(match) != 0 {
return Countries.Countries[i].Dxcc
}
// for j := 0; j < len(Countries.Countries[i].CountryPrefixList.CountryPrefixList); j++ {
regExp := regexp.MustCompile(Countries.Countries[i].CountryPrefixList.CountryPrefixList[len(Countries.Countries[i].CountryPrefixList.CountryPrefixList)-1].PrefixList)
match := regExp.FindStringSubmatch(dxCall)
if len(match) != 0 {
return Countries.Countries[i].Dxcc
}
// }
}
return ""
}