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

Method CountEntityByStoragePolicyID

inventory/file.go:362–378  ·  view source on GitHub ↗
(ctx context.Context, storagePolicyID int)

Source from the content-addressed store, hash-verified

360}
361
362func (f *fileClient) CountEntityByStoragePolicyID(ctx context.Context, storagePolicyID int) (int, int, error) {
363 var v []struct {
364 Sum int `json:"sum"`
365 Count int `json:"count"`
366 }
367
368 err := f.client.Entity.Query().Where(entity.StoragePolicyEntities(storagePolicyID)).
369 Aggregate(
370 ent.Sum(entity.FieldSize),
371 ent.Count(),
372 ).Scan(ctx, &v)
373 if err != nil {
374 return 0, 0, err
375 }
376
377 return v[0].Count, v[0].Sum, nil
378}
379
380func (f *fileClient) CreateDirectLink(ctx context.Context, file int, name string, speed int, reuse bool) (*ent.DirectLink, error) {
381 if reuse {

Callers

nothing calls this directly

Calls 7

StoragePolicyEntitiesFunction · 0.92
SumFunction · 0.92
CountFunction · 0.92
ScanMethod · 0.45
AggregateMethod · 0.45
WhereMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected