함수: liveQueryCollectionOptions()
function liveQueryCollectionOptions<TQuery, TContext, TResult>(config): CollectionConfigForContext<TContext, TResult, {
}> & object;
정의 위치: packages/db/src/query/live-query-collection.ts:72
createCollection과 함께 사용할 라이브 쿼리 컬렉션 옵션을 생성합니다
타입 매개변수
TQuery
TQuery extends QueryBuilder<any>
TContext
TContext extends Context = ExtractContext<TQuery>
TResult
TResult extends object = RootQueryResult<TContext>
매개변수
config
LiveQueryCollectionConfig<TContext, TResult> & object
라이브 쿼리 컬렉션의 구성 옵션입니다
반환값
CollectionConfigForContext<TContext, TResult, {
}> & object
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)