MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / QueryFile

Method QueryFile

ent/share_query.go:88–107  ·  view source on GitHub ↗

QueryFile chains the current query on the "file" edge.

()

Source from the content-addressed store, hash-verified

86
87// QueryFile chains the current query on the "file" edge.
88func (sq *ShareQuery) QueryFile() *FileQuery {
89 query := (&FileClient{config: sq.config}).Query()
90 query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
91 if err := sq.prepareQuery(ctx); err != nil {
92 return nil, err
93 }
94 selector := sq.sqlQuery(ctx)
95 if err := selector.Err(); err != nil {
96 return nil, err
97 }
98 step := sqlgraph.NewStep(
99 sqlgraph.From(share.Table, share.FieldID, selector),
100 sqlgraph.To(file.Table, file.FieldID),
101 sqlgraph.Edge(sqlgraph.M2O, true, share.FileTable, share.FileColumn),
102 )
103 fromU = sqlgraph.SetNeighbors(sq.driver.Dialect(), step)
104 return fromU, nil
105 }
106 return query
107}
108
109// First returns the first Share entity from the query.
110// Returns a *NotFoundError when no Share was found.

Callers

nothing calls this directly

Calls 5

prepareQueryMethod · 0.95
sqlQueryMethod · 0.95
DialectMethod · 0.80
ToMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected