MCPcopy Index your code
hub / github.com/TanStack/db / createCollection

Function createCollection

packages/db/src/collection/index.ts:254–271  ·  view source on GitHub ↗
(
  options: CollectionConfig<any, string | number, any, UtilsRecord> & {
    schema?: StandardSchemaV1
  },
)

Source from the content-addressed store, hash-verified

252
253// Implementation
254export function createCollection(
255 options: CollectionConfig<any, string | number, any, UtilsRecord> & {
256 schema?: StandardSchemaV1
257 },
258): Collection<any, string | number, UtilsRecord, any, any> {
259 const collection = new CollectionImpl<any, string | number, any, any, any>(
260 options,
261 )
262
263 // Attach utils to collection
264 if (options.utils) {
265 collection.utils = options.utils
266 } else {
267 collection.utils = {}
268 }
269
270 return collection
271}
272
273export class CollectionImpl<
274 TOutput extends object = Record<string, unknown>,

Calls

no outgoing calls

Tested by 15

createOnDemandCollectionFunction · 0.72
createUsersCollectionFunction · 0.72
createTestStateFunction · 0.72
createMockCollectionFunction · 0.72
createReadyCollectionFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…