function liveQueryCollectionOptions<TContext, TResult>(config): CollectionConfig<TResult>
function liveQueryCollectionOptions<TContext, TResult>(config): CollectionConfig<TResult>
Defined in: packages/db/src/query/live-query-collection.ts:117
Creates live query collection options for use with createCollection
• TContext extends Context
• TResult extends object = { [K in string | number | symbol]: (TContext["result"] extends object ? any[any] : TContext["hasJoins"] extends true ? TContext["schema"] : TContext["schema"][TContext["fromSourceName"]])[K] }
LiveQueryCollectionConfig<TContext, TResult>
Configuration options for the live query collection
CollectionConfig<TResult>
Collection options that can be passed to createCollection
const options = liveQueryCollectionOptions({ // id is optional - will auto-generate if not provided query: (q) => q .from({ post: postsCollection }) .where(({ post }) => eq(post.published, true)) .select(({ post }) => ({ id: post.id, title: post.title, content: post.content, })), // getKey is optional - will use stream key if not provided }) const collection = createCollection(options)
const options = liveQueryCollectionOptions({ // id is optional - will auto-generate if not provided query: (q) => q .from({ post: postsCollection }) .where(({ post }) => eq(post.published, true)) .select(({ post }) => ({ id: post.id, title: post.title, content: post.content, })), // getKey is optional - will use stream key if not provided }) const collection = createCollection(options)
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.