mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-12 07:52:44 +08:00
✨ feat(query-editor): 增强 SQL 编辑器执行与历史体验
- 支持仅执行选中 SQL、光标所在语句和增量新增语句 - 持久化查询草稿,避免重启后丢失历史 SQL - 在表字段提示中展示注释信息 - 修复清空默认 SQL 后被自动回填的问题 Refs #483
This commit is contained in:
@@ -603,11 +603,19 @@ ORDER BY trigger_name, event_manipulation`, esc(table), esc(schema))
|
||||
|
||||
func (p *PostgresDB) GetAllColumns(dbName string) ([]connection.ColumnDefinitionWithTable, error) {
|
||||
query := `
|
||||
SELECT table_schema, table_name, column_name, data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND table_schema NOT LIKE 'pg|_%' ESCAPE '|'
|
||||
ORDER BY table_schema, table_name, ordinal_position`
|
||||
SELECT
|
||||
c.table_schema,
|
||||
c.table_name,
|
||||
c.column_name,
|
||||
c.data_type,
|
||||
col_description(cls.oid, a.attnum) AS comment
|
||||
FROM information_schema.columns c
|
||||
LEFT JOIN pg_namespace n ON n.nspname = c.table_schema
|
||||
LEFT JOIN pg_class cls ON cls.relnamespace = n.oid AND cls.relname = c.table_name
|
||||
LEFT JOIN pg_attribute a ON a.attrelid = cls.oid AND a.attname = c.column_name
|
||||
WHERE c.table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND c.table_schema NOT LIKE 'pg|_%' ESCAPE '|'
|
||||
ORDER BY c.table_schema, c.table_name, c.ordinal_position`
|
||||
|
||||
data, _, err := p.Query(query)
|
||||
if err != nil {
|
||||
@@ -627,6 +635,7 @@ ORDER BY table_schema, table_name, ordinal_position`
|
||||
TableName: tableName,
|
||||
Name: fmt.Sprintf("%v", row["column_name"]),
|
||||
Type: fmt.Sprintf("%v", row["data_type"]),
|
||||
Comment: fmt.Sprintf("%v", row["comment"]),
|
||||
}
|
||||
cols = append(cols, col)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user