MCPcopy
hub / github.com/remix-run/remix / findMany

Method findMany

packages/data-table/src/lib/database.ts:560–593  ·  view source on GitHub ↗
(
    table: table,
    options?: FindManyOptions<table, relations>,
  )

Source from the content-addressed store, hash-verified

558 }
559
560 async findMany<
561 table extends AnyTable,
562 relations extends RelationMapForSourceName<TableName<table>> = {},
563 >(
564 table: table,
565 options?: FindManyOptions<table, relations>,
566 ): Promise<Array<TableRowWith<table, LoadedRelationMap<relations>>>> {
567 let query: QueryForTable<table> = this.query(asQueryTableInput(table))
568
569 if (options?.where) {
570 query = query.where(options.where)
571 }
572
573 let orderBy = normalizeOrderByInput(options?.orderBy)
574 for (let [column, direction] of orderBy) {
575 query = query.orderBy(column, direction)
576 }
577
578 if (options?.limit !== undefined) {
579 query = query.limit(options.limit)
580 }
581
582 if (options?.offset !== undefined) {
583 query = query.offset(options.offset)
584 }
585
586 if (options?.with) {
587 return query.with(options.with).all() as Promise<
588 Array<TableRowWith<table, LoadedRelationMap<relations>>>
589 >
590 }
591
592 return query.all() as Promise<Array<TableRowWith<table, LoadedRelationMap<relations>>>>
593 }
594
595 async count<table extends AnyTable>(
596 table: table,

Callers 13

homeFunction · 0.80
searchFunction · 0.80
indexFunction · 0.80
genreFunction · 0.80
indexFunction · 0.80
indexFunction · 0.80
indexFunction · 0.80
indexFunction · 0.80
schedules.test.tsFile · 0.80
listBlockRowsFunction · 0.80
listSchedulesFunction · 0.80

Calls 9

queryMethod · 0.95
asQueryTableInputFunction · 0.90
normalizeOrderByInputFunction · 0.90
whereMethod · 0.80
orderByMethod · 0.80
offsetMethod · 0.80
withMethod · 0.80
limitMethod · 0.65
allMethod · 0.65

Tested by 1

listBlockRowsFunction · 0.64