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

Method findOne

packages/data-table/src/lib/database.ts:536–558  ·  view source on GitHub ↗
(
    table: table,
    options: FindOneOptions<table, relations>,
  )

Source from the content-addressed store, hash-verified

534 }
535
536 async findOne<
537 table extends AnyTable,
538 relations extends RelationMapForSourceName<TableName<table>> = {},
539 >(
540 table: table,
541 options: FindOneOptions<table, relations>,
542 ): Promise<TableRowWith<table, LoadedRelationMap<relations>> | null> {
543 let query: QueryForTable<table> = this.query(asQueryTableInput(table)).where(options.where)
544 let orderBy = normalizeOrderByInput(options.orderBy)
545
546 for (let [column, direction] of orderBy) {
547 query = query.orderBy(column, direction)
548 }
549
550 if (options.with) {
551 return query.with(options.with).first() as Promise<TableRowWith<
552 table,
553 LoadedRelationMap<relations>
554 > | null>
555 }
556
557 return query.first() as Promise<TableRowWith<table, LoadedRelationMap<relations>> | null>
558 }
559
560 async findMany<
561 table extends AnyTable,

Callers 15

createMethod · 0.95
updateMethod · 0.95
app.test.e2e.tsFile · 0.80
controller.test.tsFile · 0.80
showFunction · 0.80
actionFunction · 0.80
actionFunction · 0.80
verifyFunction · 0.80
router.test.tsFile · 0.80
resolveExternalAuthFunction · 0.80
actionFunction · 0.80

Calls 7

queryMethod · 0.95
asQueryTableInputFunction · 0.90
normalizeOrderByInputFunction · 0.90
whereMethod · 0.80
orderByMethod · 0.80
firstMethod · 0.80
withMethod · 0.80

Tested by

no test coverage detected