No point overloading functions
This commit is contained in:
parent
b3d3d388aa
commit
b42723677b
|
@ -10,7 +10,6 @@ import (
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/database/ent"
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent"
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/database/ent/machine"
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/machine"
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/database/ent/predicate"
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -197,11 +196,6 @@ func (c *Client) IsMachineRegistered(machineID string) (bool, error) {
|
||||||
return false, nil
|
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) {
|
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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue