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

Method FirstID

ent/node_query.go:160–170  ·  view source on GitHub ↗

FirstID returns the first Node ID from the query. Returns a *NotFoundError when no Node ID was found.

(ctx context.Context)

Source from the content-addressed store, hash-verified

158// FirstID returns the first Node ID from the query.
159// Returns a *NotFoundError when no Node ID was found.
160func (nq *NodeQuery) FirstID(ctx context.Context) (id string, err error) {
161 var ids []string
162 if ids, err = nq.Limit(1).IDs(setContextOp(ctx, nq.ctx, ent.OpQueryFirstID)); err != nil {
163 return
164 }
165 if len(ids) == 0 {
166 err = &NotFoundError{node.Label}
167 return
168 }
169 return ids[0], nil
170}
171
172// FirstIDX is like FirstID, but panics if an error occurs.
173func (nq *NodeQuery) FirstIDX(ctx context.Context) string {

Callers 2

FirstIDXMethod · 0.95
ExistMethod · 0.95

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
IDsMethod · 0.45

Tested by

no test coverage detected