MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Int

Method Int

app/controlplane/pkg/data/ent/ent.go:410–424  ·  view source on GitHub ↗

Int returns a single int from a selector. It is only allowed when selecting one field.

(ctx context.Context)

Source from the content-addressed store, hash-verified

408
409// Int returns a single int from a selector. It is only allowed when selecting one field.
410func (s *selector) Int(ctx context.Context) (_ int, err error) {
411 var v []int
412 if v, err = s.Ints(ctx); err != nil {
413 return
414 }
415 switch len(v) {
416 case 1:
417 return v[0], nil
418 case 0:
419 err = &NotFoundError{s.label}
420 default:
421 err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
422 }
423 return
424}
425
426// IntX is like Int, but panics if an error occurs.
427func (s *selector) IntX(ctx context.Context) int {

Callers 15

IntXMethod · 0.95
VerifyMethod · 0.80
CollectMethod · 0.80
VerifyGitHubCommitFunction · 0.80
VerifyGitLabCommitFunction · 0.80
extractMainComponentMethod · 0.80
CraftMethod · 0.80
FieldsMethod · 0.80
FieldsMethod · 0.80
FieldsMethod · 0.80

Calls 1

IntsMethod · 0.95

Tested by

no test coverage detected