MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / FirstID

Method FirstID

ent/setting_query.go:84–94  ·  view source on GitHub ↗

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

(ctx context.Context)

Source from the content-addressed store, hash-verified

82// FirstID returns the first Setting ID from the query.
83// Returns a *NotFoundError when no Setting ID was found.
84func (sq *SettingQuery) FirstID(ctx context.Context) (id int, err error) {
85 var ids []int
86 if ids, err = sq.Limit(1).IDs(setContextOp(ctx, sq.ctx, "FirstID")); err != nil {
87 return
88 }
89 if len(ids) == 0 {
90 err = &NotFoundError{setting.Label}
91 return
92 }
93 return ids[0], nil
94}
95
96// FirstIDX is like FirstID, but panics if an error occurs.
97func (sq *SettingQuery) FirstIDX(ctx context.Context) int {

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