No point overloading functions

This commit is contained in:
Laurence 2023-07-25 18:05:07 +01:00
parent b3d3d388aa
commit b42723677b
No known key found for this signature in database
GPG key ID: B053BEE3478E8FEF

View file

@ -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)
}