mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 06:36:37 +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>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { executeSql } from 'data/sql/execute-sql-query'
|
|
import type { ResponseError, UseCustomQueryOptions } from 'types'
|
|
import { databaseQueuesKeys } from './keys'
|
|
|
|
export type DatabaseQueuesVariables = {
|
|
projectRef?: string
|
|
connectionString?: string | null
|
|
}
|
|
|
|
export type PostgresQueue = {
|
|
queue_name: string
|
|
is_partitioned: boolean
|
|
is_unlogged: boolean
|
|
created_at: string
|
|
}
|
|
|
|
const queueSqlQuery = `select * from pgmq.list_queues();`
|
|
|
|
export async function getDatabaseQueues({ projectRef, connectionString }: DatabaseQueuesVariables) {
|
|
if (!projectRef) throw new Error('Project ref is required')
|
|
|
|
const { result } = await executeSql({
|
|
projectRef,
|
|
connectionString,
|
|
sql: queueSqlQuery,
|
|
})
|
|
return result
|
|
}
|
|
|
|
export type DatabaseQueueData = PostgresQueue[]
|
|
export type DatabaseQueueError = ResponseError
|
|
|
|
export const useQueuesQuery = <TData = DatabaseQueueData>(
|
|
{ projectRef, connectionString }: DatabaseQueuesVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<DatabaseQueueData, DatabaseQueueError, TData> = {}
|
|
) =>
|
|
useQuery<DatabaseQueueData, DatabaseQueueError, TData>({
|
|
queryKey: databaseQueuesKeys.list(projectRef),
|
|
queryFn: () => getDatabaseQueues({ projectRef, connectionString }),
|
|
enabled: enabled && typeof projectRef !== 'undefined',
|
|
...options,
|
|
})
|