Kaynağa Gözat

No point overloading functions

Laurence 2 yıl önce
ebeveyn
işleme
b42723677b
1 değiştirilmiş dosya ile 1 ekleme ve 7 silme
  1. 1 7
      pkg/database/machines.go

+ 1 - 7
pkg/database/machines.go

@@ -10,7 +10,6 @@ import (
 
 	"github.com/crowdsecurity/crowdsec/pkg/database/ent"
 	"github.com/crowdsecurity/crowdsec/pkg/database/ent/machine"
-	"github.com/crowdsecurity/crowdsec/pkg/database/ent/predicate"
 	"github.com/crowdsecurity/crowdsec/pkg/types"
 )
 
@@ -197,11 +196,6 @@ func (c *Client) IsMachineRegistered(machineID string) (bool, error) {
 	return false, nil
 
 }
-
-func (c *Client) queryLastHeartbeat(q predicate.Machine, b bool) ([]*ent.Machine, error) {
-	return c.Ent.Machine.Query().Where(q, machine.IsValidatedEQ(b)).All(c.CTX)
-}
-
 func (c *Client) QueryLastValidatedHeartbeatLT(t time.Time) ([]*ent.Machine, error) {
-	return c.queryLastHeartbeat(machine.LastHeartbeatLT(t), true)
+	return c.Ent.Machine.Query().Where(machine.LastHeartbeatLT(t), machine.IsValidatedEQ(true)).All(c.CTX)
 }