MCPcopy Create free account
hub / github.com/TanStack/db / liveQueryCollectionOptions

Function liveQueryCollectionOptions

packages/db/src/query/live-query-collection.ts:72–91  ·  view source on GitHub ↗
(
  config: LiveQueryCollectionConfig<TContext, TResult> & {
    query: RootQueryFn<TQuery> | RootQueryBuilder<TQuery>
  },
)

Source from the content-addressed store, hash-verified

70 * @returns Collection options that can be passed to createCollection
71 */
72export function liveQueryCollectionOptions<
73 TQuery extends QueryBuilder<any>,
74 TContext extends Context = ExtractContext<TQuery>,
75 TResult extends object = RootQueryResult<TContext>,
76>(
77 config: LiveQueryCollectionConfig<TContext, TResult> & {
78 query: RootQueryFn<TQuery> | RootQueryBuilder<TQuery>
79 },
80): CollectionConfigForContext<TContext, TResult> & {
81 utils: LiveQueryCollectionUtils
82} {
83 const collectionConfigBuilder = new CollectionConfigBuilder<
84 TContext,
85 TResult
86 >(config)
87 return collectionConfigBuilder.getConfig() as CollectionConfigForContext<
88 TContext,
89 TResult
90 > & { utils: LiveQueryCollectionUtils }
91}
92
93/**
94 * Creates a live query collection directly

Calls 1

getConfigMethod · 0.95

Tested by

no test coverage detected