feat: add AI data validation, test data generator, index advisor, and snapshots
Four new killer features leveraging AI (Ollama) and PostgreSQL internals: - Data Validation: describe quality rules in natural language, AI generates SQL to find violations, run with pass/fail results and sample violations - Test Data Generator: right-click table to generate realistic FK-aware test data with AI, preview before inserting in a transaction - Index Advisor: analyze pg_stat tables + AI recommendations for CREATE/DROP INDEX with one-click apply - Data Snapshots: export selected tables to JSON (FK-ordered), restore from file with optional truncate in a transaction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
38
src/hooks/use-validation.ts
Normal file
38
src/hooks/use-validation.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import {
|
||||
generateValidationSql,
|
||||
runValidationRule,
|
||||
suggestValidationRules,
|
||||
} from "@/lib/tauri";
|
||||
|
||||
export function useGenerateValidationSql() {
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
connectionId,
|
||||
ruleDescription,
|
||||
}: {
|
||||
connectionId: string;
|
||||
ruleDescription: string;
|
||||
}) => generateValidationSql(connectionId, ruleDescription),
|
||||
});
|
||||
}
|
||||
|
||||
export function useRunValidationRule() {
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
connectionId,
|
||||
sql,
|
||||
sampleLimit,
|
||||
}: {
|
||||
connectionId: string;
|
||||
sql: string;
|
||||
sampleLimit?: number;
|
||||
}) => runValidationRule(connectionId, sql, sampleLimit),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSuggestValidationRules() {
|
||||
return useMutation({
|
||||
mutationFn: (connectionId: string) => suggestValidationRules(connectionId),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user