mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-03 13:16:35 +08:00
feat: 支持pgsql编辑表、索引
This commit is contained in:
@@ -9,6 +9,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { editor, languages, Position } from 'monaco-editor';
|
||||
|
||||
import { registerCompletionItemProvider } from '@/components/monaco/completionItemProvider';
|
||||
import { DbType } from '@/views/ops/db/component/table/dbs/db-option';
|
||||
|
||||
const sqlCompletionKeywords = [...sqlLanguage.keywords, ...addSqlLanguage.keywords];
|
||||
const sqlCompletionOperators = [...sqlLanguage.operators, ...addSqlLanguage.operators];
|
||||
@@ -217,10 +218,10 @@ export class DbInst {
|
||||
// 获取指定表的默认查询sql
|
||||
getDefaultSelectSql(table: string, condition: string, orderBy: string, pageNum: number, limit: number = DbInst.DefaultLimit) {
|
||||
const baseSql = `SELECT * FROM ${this.wrapName(table)} ${condition ? 'WHERE ' + condition : ''} ${orderBy ? orderBy : ''}`;
|
||||
if (this.type == 'mysql') {
|
||||
if (this.type == DbType.mysql) {
|
||||
return `${baseSql} LIMIT ${(pageNum - 1) * limit}, ${limit};`;
|
||||
}
|
||||
if (this.type == 'postgres') {
|
||||
if (this.type == DbType.postgresql) {
|
||||
return `${baseSql} OFFSET ${(pageNum - 1) * limit} LIMIT ${limit};`;
|
||||
}
|
||||
return baseSql;
|
||||
@@ -284,7 +285,7 @@ export class DbInst {
|
||||
* @returns
|
||||
*/
|
||||
wrapName = (name: string) => {
|
||||
if (this.type == 'mysql') {
|
||||
if (this.type === DbType.mysql) {
|
||||
return `\`${name}\``;
|
||||
}
|
||||
// if (this.type == 'postgres') {
|
||||
@@ -421,20 +422,20 @@ export class DbInst {
|
||||
* @returns
|
||||
*/
|
||||
static getIconName = (dbType: string) => {
|
||||
if (dbType == 'mysql') {
|
||||
if (dbType == DbType.mysql) {
|
||||
return 'iconfont icon-op-mysql';
|
||||
}
|
||||
if (dbType == 'postgres') {
|
||||
if (dbType == DbType.postgresql) {
|
||||
return 'iconfont icon-op-postgres';
|
||||
}
|
||||
return 'InfoFilled';
|
||||
};
|
||||
|
||||
static getIcon = (dbType: string) => {
|
||||
if (dbType == 'mysql') {
|
||||
if (dbType == DbType.mysql) {
|
||||
return 'iconfont icon-op-mysql';
|
||||
}
|
||||
if (dbType == 'postgres') {
|
||||
if (dbType == DbType.postgresql) {
|
||||
return 'iconfont icon-op-postgres';
|
||||
}
|
||||
return 'InfoFilled';
|
||||
|
||||
Reference in New Issue
Block a user