Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

3.6 KB
Raw Blame
import { commonGraphFunctions, functionDefinitions, graphListPredicates, graphReduce, temporalFunctions, type GraphQueryProfile } from "../graphQueryProfile";

// NebulaGraph 3.8: https://docs.nebula-graph.io/3.8.0/2.quick-start/6.cheatsheet-for-ngql/
const reservedWords =
  "ACROSS ADD ALTER AND AS ASC ASCENDING BALANCE BOOL BY CASE CHANGE COMPACT CREATE DATE DATETIME DELETE DESC DESCENDING DESCRIBE DISTINCT DOUBLE DOWNLOAD DROP DURATION EDGE EDGES EXISTS EXPLAIN FALSE FETCH FIND FIXED_STRING FLOAT FLUSH FROM GEOGRAPHY GET GO GRANT IF IGNORE_EXISTED_INDEX IN INDEX INDEXES INGEST INSERT INT INT16 INT32 INT64 INT8 INTERSECT IS JOIN LEFT LIST LOOKUP MAP MATCH MINUS NO NOT NULL OF ON OR ORDER OVER OVERWRITE PATH PROP REBUILD RECOVER REMOVE RESTART RETURN REVERSELY REVOKE SET SHOW STEP STEPS STOP STRING SUBMIT TAG TAGS TIME TIMESTAMP TO TRUE UNION UNWIND UPDATE UPSERT UPTO USE VERTEX VERTICES WHEN WHERE WITH XOR YIELD".split(
    " ",
  );
const keywords = [
  ...new Set([
    ...reservedWords,
    ..."ALL ANY ATOMIC_EDGE BIDIRECT BOTH CLEAR COLLATION CONFIGS DATA DEFAULT ELSE END FULLTEXT GROUP HOST HOSTS JOB JOBS KILL LIMIT NOLOOP OPTIONAL OUT PART PARTS PROFILE QUERIES QUERY SAMPLE SESSION SESSIONS SHORTEST SKIP SPACE SPACES STATS STATUS SUBGRAPH THEN TTL_COL TTL_DURATION USER USERS VALUES ZONE ZONES".split(
      " ",
    ),
  ]),
];

const profile: GraphQueryProfile = {
  databaseType: "nebula",
  language: "nGQL",
  lineComment: "#",
  keywords,
  reservedWords,
  functions: [
    ...commonGraphFunctions,
    ...functionDefinitions({
      length: ["string_or_path"],
      timestamp: ["value?"],
      src: ["edge"],
      dst: ["edge"],
      rank: ["edge"],
      typeid: ["edge"],
      tags: ["vertex"],
      hash: ["value"],
      lower: ["string"],
      upper: ["string"],
      toLower: ["string"],
      toUpper: ["string"],
      now: [],
      startNode: ["edge_or_path"],
      endNode: ["edge_or_path"],
      cbrt: ["number"],
      hypot: ["x", "y"],
      pow: ["x", "y"],
      exp: ["number"],
      exp2: ["number"],
      log: ["number"],
      log2: ["number"],
      log10: ["number"],
      sin: ["number"],
      asin: ["number"],
      cos: ["number"],
      acos: ["number"],
      tan: ["number"],
      atan: ["number"],
      e: [],
      pi: [],
      radians: ["degrees"],
      rand: [],
      rand32: ["min?", "max?"],
      rand64: ["min?", "max?"],
      bit_and: ["a", "b"],
      bit_or: ["a", "b"],
      bit_xor: ["a", "b"],
      std: ["expression"],
      strcasecmp: ["string_a", "string_b"],
      ltrim: ["string"],
      rtrim: ["string"],
      lpad: ["string", "length", "padding"],
      rpad: ["string", "length", "padding"],
      substr: ["string", "start", "length?"],
      concat: ["string1", "string2", "...strings"],
      concat_ws: ["separator", "string1", "string2", "...strings"],
      extract: ["string", "pattern"],
      json_extract: ["string"],
      exists: ["property"],
      isEmpty: ["value"],
      toSet: ["list"],
      st_point: ["longitude", "latitude"],
      st_geogfromtext: ["wkt"],
      st_astext: ["geography"],
      st_centroid: ["geography"],
      st_isvalid: ["geography"],
      st_distance: ["a", "b"],
      st_dwithin: ["a", "b", "distance", "exclusive?"],
      st_intersects: ["a", "b"],
      st_covers: ["a", "b"],
      st_coveredby: ["a", "b"],
      s2_cellidfrompoint: ["point", "level?"],
      s2_coveringcellids: ["geography", "minLevel?", "maxLevel?", "maxCells?", "buffer?"],
    }),
    ...temporalFunctions(["date", "datetime", "time"]),
    ...graphListPredicates,
    graphReduce,
  ],
};

export default profile;