mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-24 22:15:18 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query'
|
|
import { databaseKeys } from './keys'
|
|
import { UseCustomQueryOptions } from 'types'
|
|
|
|
export const getKeywordsSql = () => {
|
|
const sql = /* SQL */ `
|
|
SELECT word FROM pg_get_keywords();
|
|
`.trim()
|
|
|
|
return sql
|
|
}
|
|
|
|
export type KeywordsVariables = {
|
|
projectRef?: string
|
|
connectionString?: string | null
|
|
}
|
|
|
|
export async function getKeywords(
|
|
{ projectRef, connectionString }: KeywordsVariables,
|
|
signal?: AbortSignal
|
|
) {
|
|
const sql = getKeywordsSql()
|
|
|
|
const { result } = await executeSql(
|
|
{ projectRef, connectionString, sql, queryKey: ['keywords'] },
|
|
signal
|
|
)
|
|
|
|
return result.map((x: { word: string }) => x.word.toLocaleLowerCase()) as string[]
|
|
}
|
|
|
|
export type KeywordsData = Awaited<ReturnType<typeof getKeywords>>
|
|
export type KeywordsError = ExecuteSqlError
|
|
|
|
export const useKeywordsQuery = <TData = KeywordsData>(
|
|
{ projectRef, connectionString }: KeywordsVariables,
|
|
{ enabled = true, ...options }: UseCustomQueryOptions<KeywordsData, KeywordsError, TData> = {}
|
|
) =>
|
|
useQuery<KeywordsData, KeywordsError, TData>({
|
|
queryKey: databaseKeys.keywords(projectRef),
|
|
queryFn: ({ signal }) => getKeywords({ projectRef, connectionString }, signal),
|
|
enabled: enabled && typeof projectRef !== 'undefined',
|
|
...options,
|
|
})
|