|
@@ -0,0 +1,147 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
|
|
|
+ * <p>
|
|
|
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
+ * use this file except in compliance with the License. You may obtain a copy of
|
|
|
+ * the License at
|
|
|
+ * <p>
|
|
|
+ * https://www.apache.org/licenses/LICENSE-2.0
|
|
|
+ * <p>
|
|
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
|
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
+ * License for the specific language governing permissions and limitations under
|
|
|
+ * the License.
|
|
|
+ */
|
|
|
+package com.baomidou.mybatisplus.generator.keywords;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * postgresql关键字处理
|
|
|
+ * https://www.postgresql.org/docs/11/sql-keywords-appendix.html
|
|
|
+ *
|
|
|
+ * @author nieqiurong 2020/5/9.
|
|
|
+ * @since 3.3.2
|
|
|
+ */
|
|
|
+public class PostgreSqlKeyWordsHandler extends BaseKeyWordsHandler {
|
|
|
+
|
|
|
+ private static List<String> KEY_WORDS = new ArrayList<>(Arrays.asList(
|
|
|
+ "ALL",
|
|
|
+ "ANALYSE",
|
|
|
+ "ANALYZE",
|
|
|
+ "AND",
|
|
|
+ "ANY",
|
|
|
+ "ARRAY",
|
|
|
+ "AS",
|
|
|
+ "ASC",
|
|
|
+ "ASYMMETRIC",
|
|
|
+ "AUTHORIZATION",
|
|
|
+ "BINARY",
|
|
|
+ "BOTH",
|
|
|
+ "CASE",
|
|
|
+ "CAST",
|
|
|
+ "CHECK",
|
|
|
+ "COLLATE",
|
|
|
+ "COLLATION",
|
|
|
+ "COLUMN",
|
|
|
+ "CONCURRENTLY",
|
|
|
+ "CONSTRAINT",
|
|
|
+ "CREATE",
|
|
|
+ "CROSS",
|
|
|
+ "CURRENT_CATALOG",
|
|
|
+ "CURRENT_DATE",
|
|
|
+ "CURRENT_ROLE",
|
|
|
+ "CURRENT_SCHEMA",
|
|
|
+ "CURRENT_TIME",
|
|
|
+ "CURRENT_TIMESTAMP",
|
|
|
+ "CURRENT_USER",
|
|
|
+ "DEFAULT",
|
|
|
+ "DEFERRABLE",
|
|
|
+ "DESC",
|
|
|
+ "DISTINCT",
|
|
|
+ "DO",
|
|
|
+ "ELSE",
|
|
|
+ "END",
|
|
|
+ "EXCEPT",
|
|
|
+ "FALSE",
|
|
|
+ "FETCH",
|
|
|
+ "FOR",
|
|
|
+ "FOREIGN",
|
|
|
+ "FREEZE",
|
|
|
+ "FROM",
|
|
|
+ "FULL",
|
|
|
+ "GRANT",
|
|
|
+ "GROUP",
|
|
|
+ "HAVING",
|
|
|
+ "ILIKE",
|
|
|
+ "IN",
|
|
|
+ "INITIALLY",
|
|
|
+ "INNER",
|
|
|
+ "INTERSECT",
|
|
|
+ "INTO",
|
|
|
+ "IS",
|
|
|
+ "ISNULL",
|
|
|
+ "JOIN",
|
|
|
+ "LATERAL",
|
|
|
+ "LEADING",
|
|
|
+ "LEFT",
|
|
|
+ "LIKE",
|
|
|
+ "LIMIT",
|
|
|
+ "LOCALTIME",
|
|
|
+ "LOCALTIMESTAMP",
|
|
|
+ "NATURAL",
|
|
|
+ "NOT",
|
|
|
+ "NOTNULL",
|
|
|
+ "NULL",
|
|
|
+ "OFFSET",
|
|
|
+ "ON",
|
|
|
+ "ONLY",
|
|
|
+ "OR",
|
|
|
+ "ORDER",
|
|
|
+ "OUTER",
|
|
|
+ "OVERLAPS",
|
|
|
+ "PLACING",
|
|
|
+ "PRIMARY",
|
|
|
+ "REFERENCES",
|
|
|
+ "RETURNING",
|
|
|
+ "RIGHT",
|
|
|
+ "SELECT",
|
|
|
+ "SESSION_USER",
|
|
|
+ "SIMILAR",
|
|
|
+ "SOME",
|
|
|
+ "SYMMETRIC",
|
|
|
+ "TABLE",
|
|
|
+ "TABLESAMPLE",
|
|
|
+ "THEN",
|
|
|
+ "TO",
|
|
|
+ "TRAILING",
|
|
|
+ "TRUE",
|
|
|
+ "UNION",
|
|
|
+ "UNIQUE",
|
|
|
+ "USER",
|
|
|
+ "USING",
|
|
|
+ "VARIADIC",
|
|
|
+ "VERBOSE",
|
|
|
+ "WHEN",
|
|
|
+ "WHERE",
|
|
|
+ "WINDOW",
|
|
|
+ "WITH"
|
|
|
+ ));
|
|
|
+
|
|
|
+ public PostgreSqlKeyWordsHandler() {
|
|
|
+ super(KEY_WORDS);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PostgreSqlKeyWordsHandler(List<String> keyWords) {
|
|
|
+ super(keyWords);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String formatStyle() {
|
|
|
+ return "\"%s\"";
|
|
|
+ }
|
|
|
+
|
|
|
+}
|