增加了对每个entity的命名,增加了Price类型

This commit is contained in:
Xu Chang 2023-03-01 17:06:32 +08:00
parent 42fca4aa3f
commit 6fa88cc3b2
19 changed files with 49 additions and 8 deletions

View File

@ -1123,7 +1123,8 @@ function constructFilter(statements, entity) {
case 'Int':
case 'Uint':
case 'Float':
case 'Double': {
case 'Double':
case 'Price': {
type2 = factory.createTypeReferenceNode(factory.createIdentifier('Q_NumberValue'));
break;
}
@ -1276,7 +1277,8 @@ function constructProjection(statements, entity) {
case 'File':
case 'SingleGeo':
case 'Geo':
case 'Object': {
case 'Object':
case 'Price': {
properties.push([name_4, false]);
break;
}
@ -1639,7 +1641,8 @@ function constructSorter(statements, entity) {
case 'Boolean':
case 'Datetime':
case 'Image':
case 'File': {
case 'File':
case 'Price': {
type2 = factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword);
break;
}
@ -2658,6 +2661,7 @@ var initialStatements = function () { return [
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Text')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Datetime')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('File')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Price')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Image')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('PrimaryKey')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('ForeignKey')),
@ -2952,6 +2956,10 @@ function constructAttributes(entity) {
attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("boolean")));
break;
}
case 'Price': {
attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("money")));
break;
}
case 'Datetime': {
attrAssignments.push(factory.createPropertyAssignment(factory.createIdentifier("type"), factory.createStringLiteral("datetime")));
break;

View File

@ -21,6 +21,7 @@ var indexes = [
];
var locale = {
zh_CN: {
name: '更新',
attr: {
targetEntity: '目标对象',
entity: '关联对象',

View File

@ -6,6 +6,7 @@ var config = {
};
var locale = {
zh_CN: {
name: '更新对象连接',
attr: {
modi: '更新',
entity: '关联对象',

View File

@ -6,6 +6,7 @@ var configuration = {
};
var locale = {
zh_CN: {
name: '操作',
attr: {
action: '动作',
data: '数据',

View File

@ -6,6 +6,7 @@ var config = {
};
var locale = {
zh_CN: {
name: '操作对象连接',
attr: {
oper: '操作',
entity: '关联对象',

View File

@ -8,6 +8,7 @@ var UserActionDef = {
};
var locale = {
zh_CN: {
name: '用户',
attr: {
name: '姓名',
nickname: '昵称',

View File

@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
name: '用户授权',
attr: {
relation: '关系',
entity: '关联对象',

View File

@ -9,6 +9,7 @@ export declare type Image = string;
export declare type File = string;
export declare type Datetime = number | Date;
export declare type Boolean = boolean;
export declare type Price = number;
export declare type PrimaryKey = string;
export declare type ForeignKey<E extends string> = string;
export declare type Sequence = string;

View File

@ -1,5 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unIndexedTypes = exports.types = void 0;
exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo'];
exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price'];
exports.unIndexedTypes = ['Text', 'Image', 'File', 'Object'];

View File

@ -13,6 +13,7 @@ declare type LocaleOfValue<V extends Record<string, string>> = {
};
export declare type LocaleDef<Sc extends Record<string, any>, Ac extends string, R extends string, V extends Record<string, string>> = {
[L in Language]?: {
name: string;
attr: LocaleOfSchema<Sc> & {
[A in keyof V]: string;
};

View File

@ -1642,7 +1642,8 @@ function constructFilter(statements: Array<ts.Statement>, entity: string) {
case 'Int':
case 'Uint':
case 'Float':
case 'Double': {
case 'Double':
case 'Price': {
type2 = factory.createTypeReferenceNode(
factory.createIdentifier('Q_NumberValue'),
);
@ -1897,7 +1898,8 @@ function constructProjection(statements: Array<ts.Statement>, entity: string) {
case 'File':
case 'SingleGeo':
case 'Geo':
case 'Object': {
case 'Object':
case 'Price': {
properties.push(
[name, false]
)
@ -2410,7 +2412,8 @@ function constructSorter(statements: Array<ts.Statement>, entity: string) {
case 'Boolean':
case 'Datetime':
case 'Image':
case 'File': {
case 'File':
case 'Price': {
type2 = factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword);
break;
}
@ -4417,6 +4420,11 @@ const initialStatements = () => [
undefined,
factory.createIdentifier('File')
),
factory.createImportSpecifier(
false,
undefined,
factory.createIdentifier('Price')
),
factory.createImportSpecifier(
false,
undefined,
@ -5399,6 +5407,15 @@ function constructAttributes(entity: string): ts.PropertyAssignment[] {
);
break;
}
case 'Price': {
attrAssignments.push(
factory.createPropertyAssignment(
factory.createIdentifier("type"),
factory.createStringLiteral("money")
),
);
break;
}
case 'Datetime': {
attrAssignments.push(
factory.createPropertyAssignment(

View File

@ -43,6 +43,7 @@ const locale: LocaleDef<Schema, Action, '', {
iState: IState,
}> = {
zh_CN: {
name: '更新',
attr: {
targetEntity: '目标对象',
entity: '关联对象',

View File

@ -15,6 +15,7 @@ const config: Configuration = {
const locale: LocaleDef<Schema, '', '', {}> = {
zh_CN: {
name: '更新对象连接',
attr: {
modi: '更新',
entity: '关联对象',

View File

@ -17,6 +17,7 @@ const configuration: Configuration = {
const locale: LocaleDef<Schema, '', '', {}> = {
zh_CN: {
name: '操作',
attr: {
action: '动作',
data: '数据',

View File

@ -15,6 +15,7 @@ const config: Configuration = {
const locale: LocaleDef<Schema, '', '', {}> = {
zh_CN: {
name: '操作对象连接',
attr: {
oper: '操作',
entity: '关联对象',

View File

@ -25,6 +25,7 @@ const locale: LocaleDef<Schema, Action, '', {
userState: UserState;
}> = {
zh_CN: {
name: '用户',
attr: {
name: '姓名',
nickname: '昵称',

View File

@ -15,6 +15,7 @@ const locale: LocaleDef<
{}
> = {
zh_CN: {
name: '用户授权',
attr: {
relation: '关系',
entity: '关联对象',

View File

@ -10,6 +10,7 @@ export type Image = string;
export type File = string;
export type Datetime = number | Date;
export type Boolean = boolean;
export type Price = number;
export type PrimaryKey = string;
export type ForeignKey<E extends string> = string;
export type Sequence = string; // 自增长序列为了让人阅读方便为了支持分布式这里用string底层实现可自定义
@ -17,5 +18,5 @@ export { Geo, SingleGeo } from './Geo';
export type DataTypes = number | string | Datetime | Geo | Object | SingleGeo;
export const types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo'];
export const types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo', 'Price'];
export const unIndexedTypes = ['Text', 'Image', 'File', 'Object'];

View File

@ -18,6 +18,7 @@ type LocaleOfValue<V extends Record<string, string>> = {
export type LocaleDef<Sc extends Record<string, any>, Ac extends string, R extends string, V extends Record<string, string>> = {
[L in Language]?: {
name: string;
attr: LocaleOfSchema<Sc> & {
[A in keyof V]: string; // 目前写在V里面的应该只有枚举变量和state
};