@h-ai/reldb 0.1.0-alpha7 → 0.1.0-alpha9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -29
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -440,13 +440,13 @@ if (!result.success) {
|
|
|
440
440
|
|
|
441
441
|
| 错误码 | code | 说明 |
|
|
442
442
|
| ------------------------------------ | --------------- | ------------ |
|
|
443
|
-
| `HaiReldbError.NOT_INITIALIZED` | `hai:reldb:
|
|
443
|
+
| `HaiReldbError.NOT_INITIALIZED` | `hai:reldb:010` | 未初始化 |
|
|
444
444
|
| `HaiReldbError.CONNECTION_FAILED` | `hai:reldb:001` | 连接失败 |
|
|
445
445
|
| `HaiReldbError.QUERY_FAILED` | `hai:reldb:002` | 查询失败 |
|
|
446
446
|
| `HaiReldbError.CONSTRAINT_VIOLATION` | `hai:reldb:003` | 约束违反 |
|
|
447
447
|
| `HaiReldbError.TRANSACTION_FAILED` | `hai:reldb:004` | 事务失败 |
|
|
448
|
-
| `HaiReldbError.DDL_FAILED` | `hai:reldb:
|
|
449
|
-
| `HaiReldbError.CONFIG_ERROR` | `hai:reldb:
|
|
448
|
+
| `HaiReldbError.DDL_FAILED` | `hai:reldb:020` | DDL 操作失败 |
|
|
449
|
+
| `HaiReldbError.CONFIG_ERROR` | `hai:reldb:013` | 配置错误 |
|
|
450
450
|
|
|
451
451
|
## 测试
|
|
452
452
|
|
package/dist/index.d.ts
CHANGED
|
@@ -503,11 +503,11 @@ declare const HaiReldbError: {
|
|
|
503
503
|
DUPLICATE_ENTRY: _h_ai_core.HaiErrorDef;
|
|
504
504
|
DEADLOCK: _h_ai_core.HaiErrorDef;
|
|
505
505
|
TIMEOUT: _h_ai_core.HaiErrorDef;
|
|
506
|
-
POOL_EXHAUSTED: _h_ai_core.HaiErrorDef;
|
|
507
506
|
NOT_INITIALIZED: _h_ai_core.HaiErrorDef;
|
|
508
|
-
|
|
507
|
+
POOL_EXHAUSTED: _h_ai_core.HaiErrorDef;
|
|
509
508
|
UNSUPPORTED_TYPE: _h_ai_core.HaiErrorDef;
|
|
510
509
|
CONFIG_ERROR: _h_ai_core.HaiErrorDef;
|
|
510
|
+
DDL_FAILED: _h_ai_core.HaiErrorDef;
|
|
511
511
|
};
|
|
512
512
|
/**
|
|
513
513
|
* 列数据类型
|
package/dist/index.js
CHANGED
|
@@ -88,10 +88,8 @@ var en_US_default = {
|
|
|
88
88
|
reldb_notInitialized: "Database not initialized, please call db.init() first",
|
|
89
89
|
reldb_initFailed: "Failed to initialize database: {error}",
|
|
90
90
|
reldb_closeFailed: "Failed to close database: {error}",
|
|
91
|
-
reldb_unsupportedType: "Unsupported database type: {type}",
|
|
92
91
|
reldb_ddlFailed: "DDL operation failed: {error}",
|
|
93
92
|
reldb_queryFailed: "Query failed: {error}",
|
|
94
|
-
reldb_executeFailed: "Execute failed: {error}",
|
|
95
93
|
reldb_batchFailed: "Batch execute failed: {error}",
|
|
96
94
|
reldb_postgresTxFailed: "Transaction failed: {error}",
|
|
97
95
|
reldb_postgresOnlyPostgresql: "PostgreSQL Provider only supports postgresql type",
|
|
@@ -100,16 +98,6 @@ var en_US_default = {
|
|
|
100
98
|
reldb_sqliteNeedPath: "SQLite requires database path (database field)",
|
|
101
99
|
reldb_sqliteConnectionFailed: "Failed to connect to SQLite: {error}",
|
|
102
100
|
reldb_sqliteTxFailed: "Transaction failed: {error}",
|
|
103
|
-
reldb_sqliteCreateTableFailed: "Failed to create table {tableName}: {error}",
|
|
104
|
-
reldb_sqliteDropTableFailed: "Failed to drop table {tableName}: {error}",
|
|
105
|
-
reldb_sqliteAddColumnFailed: "Failed to add column {columnName} to table {tableName}: {error}",
|
|
106
|
-
reldb_sqliteDropColumnFailed: "Failed to drop column {columnName} from table {tableName}: {error}",
|
|
107
|
-
reldb_sqliteRenameTableFailed: "Failed to rename table {oldName} to {newName}: {error}",
|
|
108
|
-
reldb_sqliteCreateIndexFailed: "Failed to create index {indexName}: {error}",
|
|
109
|
-
reldb_sqliteDropIndexFailed: "Failed to drop index {indexName}: {error}",
|
|
110
|
-
reldb_sqliteExecDdlFailed: "Failed to execute DDL: {error}",
|
|
111
|
-
reldb_sqliteQueryFailed: "Query failed: {error}",
|
|
112
|
-
reldb_sqliteExecuteFailed: "Execute failed: {error}",
|
|
113
101
|
reldb_sqliteBatchFailed: "Batch execute failed: {error}",
|
|
114
102
|
reldb_mysqlOnlyMysql: "MySQL Provider only supports mysql type",
|
|
115
103
|
reldb_mysqlConnectionFailed: "Failed to connect to MySQL: {error}",
|
|
@@ -128,10 +116,8 @@ var zh_CN_default = {
|
|
|
128
116
|
reldb_notInitialized: "\u6570\u636E\u5E93\u672A\u521D\u59CB\u5316\uFF0C\u8BF7\u5148\u8C03\u7528 db.init()",
|
|
129
117
|
reldb_initFailed: "\u521D\u59CB\u5316\u6570\u636E\u5E93\u5931\u8D25: {error}",
|
|
130
118
|
reldb_closeFailed: "\u5173\u95ED\u6570\u636E\u5E93\u5931\u8D25: {error}",
|
|
131
|
-
reldb_unsupportedType: "\u4E0D\u652F\u6301\u7684\u6570\u636E\u5E93\u7C7B\u578B: {type}",
|
|
132
119
|
reldb_ddlFailed: "DDL \u64CD\u4F5C\u5931\u8D25: {error}",
|
|
133
120
|
reldb_queryFailed: "\u67E5\u8BE2\u5931\u8D25: {error}",
|
|
134
|
-
reldb_executeFailed: "\u6267\u884C\u5931\u8D25: {error}",
|
|
135
121
|
reldb_batchFailed: "\u6279\u91CF\u6267\u884C\u5931\u8D25: {error}",
|
|
136
122
|
reldb_postgresTxFailed: "\u4E8B\u52A1\u6267\u884C\u5931\u8D25: {error}",
|
|
137
123
|
reldb_postgresOnlyPostgresql: "PostgreSQL Provider \u4EC5\u652F\u6301 postgresql \u7C7B\u578B",
|
|
@@ -140,16 +126,6 @@ var zh_CN_default = {
|
|
|
140
126
|
reldb_sqliteNeedPath: "SQLite \u9700\u8981\u63D0\u4F9B\u6570\u636E\u5E93\u8DEF\u5F84\uFF08database \u5B57\u6BB5\uFF09",
|
|
141
127
|
reldb_sqliteConnectionFailed: "\u8FDE\u63A5 SQLite \u5931\u8D25: {error}",
|
|
142
128
|
reldb_sqliteTxFailed: "\u4E8B\u52A1\u6267\u884C\u5931\u8D25: {error}",
|
|
143
|
-
reldb_sqliteCreateTableFailed: "\u521B\u5EFA\u8868 {tableName} \u5931\u8D25: {error}",
|
|
144
|
-
reldb_sqliteDropTableFailed: "\u5220\u9664\u8868 {tableName} \u5931\u8D25: {error}",
|
|
145
|
-
reldb_sqliteAddColumnFailed: "\u5411\u8868 {tableName} \u6DFB\u52A0\u5217 {columnName} \u5931\u8D25: {error}",
|
|
146
|
-
reldb_sqliteDropColumnFailed: "\u4ECE\u8868 {tableName} \u5220\u9664\u5217 {columnName} \u5931\u8D25: {error}",
|
|
147
|
-
reldb_sqliteRenameTableFailed: "\u91CD\u547D\u540D\u8868 {oldName} \u4E3A {newName} \u5931\u8D25: {error}",
|
|
148
|
-
reldb_sqliteCreateIndexFailed: "\u521B\u5EFA\u7D22\u5F15 {indexName} \u5931\u8D25: {error}",
|
|
149
|
-
reldb_sqliteDropIndexFailed: "\u5220\u9664\u7D22\u5F15 {indexName} \u5931\u8D25: {error}",
|
|
150
|
-
reldb_sqliteExecDdlFailed: "\u6267\u884C DDL \u5931\u8D25: {error}",
|
|
151
|
-
reldb_sqliteQueryFailed: "\u67E5\u8BE2\u5931\u8D25: {error}",
|
|
152
|
-
reldb_sqliteExecuteFailed: "\u6267\u884C\u5931\u8D25: {error}",
|
|
153
129
|
reldb_sqliteBatchFailed: "\u6279\u91CF\u6267\u884C\u5931\u8D25: {error}",
|
|
154
130
|
reldb_mysqlOnlyMysql: "MySQL Provider \u4EC5\u652F\u6301 mysql \u7C7B\u578B",
|
|
155
131
|
reldb_mysqlConnectionFailed: "\u8FDE\u63A5 MySQL \u5931\u8D25: {error}",
|
|
@@ -168,6 +144,7 @@ var reldbM = core.i18n.createMessageGetter({
|
|
|
168
144
|
"en-US": en_US_default
|
|
169
145
|
});
|
|
170
146
|
var ReldbErrorInfo = {
|
|
147
|
+
// ─── 通用 001-009 ───
|
|
171
148
|
CONNECTION_FAILED: "001:500",
|
|
172
149
|
QUERY_FAILED: "002:500",
|
|
173
150
|
CONSTRAINT_VIOLATION: "003:409",
|
|
@@ -177,11 +154,13 @@ var ReldbErrorInfo = {
|
|
|
177
154
|
DUPLICATE_ENTRY: "007:409",
|
|
178
155
|
DEADLOCK: "008:500",
|
|
179
156
|
TIMEOUT: "009:504",
|
|
180
|
-
|
|
181
|
-
NOT_INITIALIZED: "
|
|
182
|
-
|
|
183
|
-
UNSUPPORTED_TYPE: "
|
|
184
|
-
CONFIG_ERROR: "
|
|
157
|
+
// ─── 初始化 010-019 ───
|
|
158
|
+
NOT_INITIALIZED: "010:500",
|
|
159
|
+
POOL_EXHAUSTED: "011:503",
|
|
160
|
+
UNSUPPORTED_TYPE: "012:400",
|
|
161
|
+
CONFIG_ERROR: "013:500",
|
|
162
|
+
// ─── 业务操作 020+ ───
|
|
163
|
+
DDL_FAILED: "020:500"
|
|
185
164
|
};
|
|
186
165
|
var HaiReldbError = core.error.buildHaiErrorsDef("reldb", ReldbErrorInfo);
|
|
187
166
|
|