MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / FirstX

Method FirstX

pkg/database/ent/machine_query.go:100–106  ·  view source on GitHub ↗

FirstX is like First, but panics if an error occurs.

(ctx context.Context)

Source from the content-addressed store, hash-verified

98
99// FirstX is like First, but panics if an error occurs.
100func (_q *MachineQuery) FirstX(ctx context.Context) *Machine {
101 node, err := _q.First(ctx)
102 if err != nil && !IsNotFound(err) {
103 panic(err)
104 }
105 return node
106}
107
108// FirstID returns the first Machine ID from the query.
109// Returns a *NotFoundError when no Machine ID was found.

Callers

nothing calls this directly

Calls 2

FirstMethod · 0.95
IsNotFoundFunction · 0.85

Tested by

no test coverage detected