(ctx context.Context, q *ent.FileQuery)
| 329 | } |
| 330 | |
| 331 | func withFileEagerLoading(ctx context.Context, q *ent.FileQuery) *ent.FileQuery { |
| 332 | if v, ok := ctx.Value(LoadFileEntity{}).(bool); ok && v { |
| 333 | q.WithEntities(func(m *ent.EntityQuery) { |
| 334 | m.Order(ent.Desc(entity.FieldID)) |
| 335 | withEntityEagerLoading(ctx, m) |
| 336 | }) |
| 337 | } |
| 338 | if v, ok := ctx.Value(LoadFileMetadata{}).(bool); ok && v { |
| 339 | q.WithMetadata() |
| 340 | } |
| 341 | if v, ok := ctx.Value(LoadFilePublicMetadata{}).(bool); ok && v { |
| 342 | q.WithMetadata(func(m *ent.MetadataQuery) { |
| 343 | m.Where(metadata.IsPublic(true)) |
| 344 | }) |
| 345 | } |
| 346 | if v, ok := ctx.Value(LoadFileShare{}).(bool); ok && v { |
| 347 | q.WithShares() |
| 348 | } |
| 349 | if v, ok := ctx.Value(LoadFileUser{}).(bool); ok && v { |
| 350 | q.WithOwner(func(query *ent.UserQuery) { |
| 351 | withUserEagerLoading(ctx, query) |
| 352 | }) |
| 353 | } |
| 354 | if v, ok := ctx.Value(LoadFileDirectLink{}).(bool); ok && v { |
| 355 | q.WithDirectLinks() |
| 356 | } |
| 357 | |
| 358 | return q |
| 359 | } |
| 360 | |
| 361 | func withEntityEagerLoading(ctx context.Context, q *ent.EntityQuery) *ent.EntityQuery { |
| 362 | if v, ok := ctx.Value(LoadEntityUser{}).(bool); ok && v { |
no test coverage detected