Explorar o código

No point overloading functions

Laurence %!s(int64=2) %!d(string=hai) anos
pai
achega
b42723677b
Modificáronse 1 ficheiros con 1 adicións e 7 borrados
  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)
 }