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

Method FirstIDX

pkg/database/ent/machine_query.go:123–129  ·  view source on GitHub ↗

FirstIDX is like FirstID, but panics if an error occurs.

(ctx context.Context)

Source from the content-addressed store, hash-verified

121
122// FirstIDX is like FirstID, but panics if an error occurs.
123func (_q *MachineQuery) FirstIDX(ctx context.Context) int {
124 id, err := _q.FirstID(ctx)
125 if err != nil && !IsNotFound(err) {
126 panic(err)
127 }
128 return id
129}
130
131// Only returns a single Machine entity found by the query, ensuring it only returns one.
132// Returns a *NotSingularError when more than one Machine entity is found.

Callers

nothing calls this directly

Calls 2

FirstIDMethod · 0.95
IsNotFoundFunction · 0.85

Tested by

no test coverage detected