MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / First

Method First

ent/nodeversion_query.go:140–149  ·  view source on GitHub ↗

First returns the first NodeVersion entity from the query. Returns a *NotFoundError when no NodeVersion was found.

(ctx context.Context)

Source from the content-addressed store, hash-verified

138// First returns the first NodeVersion entity from the query.
139// Returns a *NotFoundError when no NodeVersion was found.
140func (nvq *NodeVersionQuery) First(ctx context.Context) (*NodeVersion, error) {
141 nodes, err := nvq.Limit(1).All(setContextOp(ctx, nvq.ctx, ent.OpQueryFirst))
142 if err != nil {
143 return nil, err
144 }
145 if len(nodes) == 0 {
146 return nil, &NotFoundError{nodeversion.Label}
147 }
148 return nodes[0], nil
149}
150
151// FirstX is like First, but panics if an error occurs.
152func (nvq *NodeVersionQuery) FirstX(ctx context.Context) *NodeVersion {

Callers 1

FirstXMethod · 0.95

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
AllMethod · 0.45

Tested by

no test coverage detected