function liveQueryCollectionOptions<TContext, TResult>(config): CollectionConfig<TResult>
function liveQueryCollectionOptions<TContext, TResult>(config): CollectionConfig<TResult>
Definiert in: packages/db/src/query/live-query-collection.ts:117
Erstellt Live-Query-Sammlungsoptionen zur Verwendung mit createCollection
• TContext erweitert Context
• TResult erweitert 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>
Konfigurationsoptionen für die Live-Query-Sammlung
CollectionConfig<TResult>
Sammlungsoptionen, die an createCollection übergeben werden können
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)
Ihre wöchentliche Dosis JavaScript-Nachrichten. Jeden Montag kostenlos an über 100.000 Entwickler geliefert.