mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-11-16 17:07:36 +00:00
refactor: Use slice.Contains()
nettype check
Instead using `||` for each nettype query check , simply using `slice.Contains`. Also, checking `any` value is not needed here.
This commit is contained in:
parent
cf77175210
commit
97fad6cacb
1 changed files with 3 additions and 5 deletions
|
@ -94,11 +94,9 @@ func (q QueryNodes) toSQL() (args []interface{}, where, sortBy, sortDirection st
|
||||||
wq = append(wq, "(hostname LIKE ? OR ip_addr LIKE ?)")
|
wq = append(wq, "(hostname LIKE ? OR ip_addr LIKE ?)")
|
||||||
args = append(args, "%"+q.Host+"%", "%"+q.Host+"%")
|
args = append(args, "%"+q.Host+"%", "%"+q.Host+"%")
|
||||||
}
|
}
|
||||||
if q.Nettype != "any" {
|
if slices.Contains([]string{"mainnet", "stagenet", "testnet"}, q.Nettype) {
|
||||||
if q.Nettype == "mainnet" || q.Nettype == "stagenet" || q.Nettype == "testnet" {
|
wq = append(wq, "nettype = ?")
|
||||||
wq = append(wq, "nettype = ?")
|
args = append(args, q.Nettype)
|
||||||
args = append(args, q.Nettype)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if q.Protocol != "any" && slices.Contains([]string{"tor", "http", "https"}, q.Protocol) {
|
if q.Protocol != "any" && slices.Contains([]string{"tor", "http", "https"}, q.Protocol) {
|
||||||
if q.Protocol == "tor" {
|
if q.Protocol == "tor" {
|
||||||
|
|
Loading…
Reference in a new issue