basics/types | TypeAnnotation | 类型标注 | Boolean 布尔值{ "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Boolean", "inferred": false, "ruleMap": {} }
| | |
Integer 整数{ "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }
| | |
Decimal 小数{ "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Decimal", "inferred": false, "ruleMap": {} }
| | |
String 字符串{ "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "String", "inferred": false, "ruleMap": {} }
| | |
basics/types | DatabaseTypeAnnotation | 数据库存储类型 | { "concept": "DatabaseTypeAnnotation", "typeName": "decimal", "arguments": { "precision": "31" } }
| @DatabaseTypeAnnotation( typeName = "decimal", arguments = [ "precision" -> "31" ], )
| |
basics/types | TypeParam | 类型参数 | { "concept": "TypeParam", "name": "T" }
| | |
basics/types | Structure | 数据结构 | { "concept": "Structure", "name": "ProductOrder", "description": "", "properties": [ { "concept": "StructureProperty", "name": "product", "label": "商品", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "reference", "typeNamespace": "app.dataSources.defaultDS.entities", "typeName": "Product", "inferred": false, "ruleMap": {} }, "jsonName": "", "description": "" }, { "concept": "StructureProperty", "name": "order", "label": "订单", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "reference", "typeNamespace": "app.dataSources.defaultDS.entities", "typeName": "OrderForm", "inferred": false, "ruleMap": {} }, "jsonName": "", "description": "" }, { "concept": "StructureProperty", "name": "count", "label": "数量", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }, "jsonName": "", "description": "" } ] }
| @(description = "") struct ProductOrder { @( label = "商品", description = "", jsonName = "", ) product: app::dataSources::defaultDS::entities::Product; @( label = "订单", description = "", jsonName = "", ) order: app::dataSources::defaultDS::entities::OrderForm; @( label = "数量", description = "", jsonName = "", ) count: Integer; }
| class ProductOrder { product: Product; order: OrderForm; count: Long; }
|
带描述的示例{ "concept": "Structure", "name": "ProductOrder", "description": "表示商品订单的结构", "properties": [ { "concept": "StructureProperty", "name": "product", "label": "商品", "description": "商品属性", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "reference", "typeNamespace": "app.dataSources.defaultDS.entities", "typeName": "Product", "inferred": false, "ruleMap": {} }, "jsonName": "product-" }, { "concept": "StructureProperty", "name": "order", "label": "订单", "description": "订单属性", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "reference", "typeNamespace": "app.dataSources.defaultDS.entities", "typeName": "OrderForm", "inferred": false, "ruleMap": {} }, "jsonName": "order-" }, { "concept": "StructureProperty", "name": "count", "label": "数量", "description": "订单中该商品的数量", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }, "jsonName": "count-", "defaultValue": { "concept": "DefaultValue", "expression": { "concept": "NumericLiteral", "value": "120", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "playground": [] } } ] }
| @(description = "表示商品订单的结构") struct ProductOrder { @( label = "商品", description = "商品属性", jsonName = "product-", ) product: app::dataSources::defaultDS::entities::Product; @( label = "订单", description = "订单属性", jsonName = "order-", ) order: app::dataSources::defaultDS::entities::OrderForm; @( label = "数量", description = "订单中该商品的数量", jsonName = "count-", ) count: Integer = 120; }
| class ProductOrder { product: Product; order: OrderForm; count: Long; }
|
{ "concept": "Structure", "name": "ExtendedList", "description": "", "typeParams": [ { "concept": "TypeParam", "name": "T" } ], "properties": [ { "concept": "StructureProperty", "name": "length", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Integer", "inferred": false, "ruleMap": {} }, "description": "", "jsonName": "" } ] }
| @(description = "") struct ExtendedList<T> { @( description = "", jsonName = "", ) length: Integer; }
| class ExtendedList<T> { length: Integer; }
|
basics/types | StructureProperty | 数据结构属性 | { "concept": "StructureProperty", "name": "count", "label": "数量", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }, "description": "", "jsonName": "" }
| @( label = "数量", description = "", jsonName = "", ) count: Integer
| |
{ "concept": "StructureProperty", "name": "count", "label": "数量", "description": "订单中该商品的数量", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }, "jsonName": "count-", "defaultValue": { "concept": "DefaultValue", "expression": { "concept": "NumericLiteral", "value": "120", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "playground": [] } }
| @( label = "数量", description = "订单中该商品的数量", jsonName = "count-", ) count: Integer = 120
| |
basics/types | Enum | 枚举 | { "concept": "Enum", "name": "ProductStatus", "label": "", "description": "", "valueType": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "String", "inferred": false, "ruleMap": {} }, "enumItems": [ { "concept": "EnumItem", "value": "Listing", "label": { "concept": "StaticString", "value": "上架" } }, { "concept": "EnumItem", "value": "Delisting", "label": { "concept": "StaticString", "value": "下架" } } ] }
| @( label = "", description = "", ) enum ProductStatus { @(label = '上架') case Listing; @(label = '下架') case Delisting; }
| enum ProductStatus { 'Listing' = '上架', 'Delisting' = '下架', }
|
带描述的示例{ "concept": "Enum", "name": "ProductStatus", "label": "商品状态", "description": "表示商品状态的枚举", "valueType": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} }, "enumItems": [ { "concept": "EnumItem", "value": "Listing", "label": { "concept": "StaticString", "value": "上架" } }, { "concept": "EnumItem", "value": "Delisting", "label": { "concept": "StaticString", "value": "下架" } } ] }
| @( label = "商品状态", description = "表示商品状态的枚举", ) enum ProductStatus { @(label = '上架') case Listing; @(label = '下架') case Delisting; }
| enum ProductStatus { 'Listing' = '上架', 'Delisting' = '下架', }
|
basics/types | EnumItem | 枚举值 | 带描述的示例{ "concept": "EnumItem", "value": "Listing", "label": { "concept": "StaticString", "value": "上架" } }
| @(label = '上架') case Listing
| |
basics/types | MetadataType | 元数据类型 | { "concept": "MetadataType", "name": "Currency", "label": "货币", "uuid": "83450632af284642ab5c967e82d49be4", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Decimal", "inferred": false, "ruleMap": {} }, "rules": [ { "concept": "ValidationRule", "calleeNamespace": "nasl.validation", "calleeName": "min", "arguments": [ { "concept": "Argument", "keyword": "min", "expression": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ], "enableServerValidation": true }, { "concept": "ValidationRule", "calleeNamespace": "nasl.validation", "calleeName": "max", "arguments": [ { "concept": "Argument", "keyword": "max", "expression": { "concept": "NumericLiteral", "value": "99999999", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ], "enableServerValidation": true } ], "playground": [] }
| @( label = "货币", uuid = "83450632af284642ab5c967e82d49be4", ) type Currency = Decimal { expect min(0)( enableServerValidation = true, ); expect max(99999999)( enableServerValidation = true, ); }
| |
basics/literals | NullLiteral | 空字面量 | { "concept": "NullLiteral" }
| | |
basics/literals | BooleanLiteral | 布尔型字面量 | { "concept": "BooleanLiteral", "value": "true" }
| | |
basics/literals | StringLiteral | 字符串字面量 | { "concept": "StringLiteral", "value": "这是一段文本" }
| | |
basics/literals | StringInterpolation | 字符串插值 | { "concept": "StringInterpolation", "expressions": [ { "concept": "StringLiteral", "value": "总数:" }, { "concept": "Identifier", "namespace": "", "name": "total" }, { "concept": "StringLiteral", "value": "\n价格:" }, { "concept": "Identifier", "namespace": "", "name": "price" } ] }
| s"总数:${total} 价格:${price}"
| |
basics/literals | StaticString | 静态字符串 | { "concept": "StaticString", "value": "这是一段文本", "i18nKey": "21daa460e9976a46d1b948c13f211550" }
| @(i18nKey = "21daa460e9976a46d1b948c13f211550") '这是一段文本'
| |
basics/literals | NumericLiteral | 数字字面量 | { "concept": "NumericLiteral", "value": "24", "typeAnnotation": { "concept": "TypeAnnotation", "typeNamespace": "nasl.core", "typeKind": "primitive", "typeName": "Long", "inferred": false, "ruleMap": {} } }
| | |
basics/expressions | CallFunction | 调用函数 | { "concept": "CallFunction", "label": "调用逻辑", "calleeNamespace": "nasl.util", "calleeName": "Clone", "arguments": [ { "concept": "Argument", "keyword": "obj", "expression": { "concept": "Identifier", "namespace": "", "name": "student" } } ] }
| | |
带 lambda 的入参{ "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "ListFilter", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "list" } }, { "concept": "Argument", "keyword": "by", "expression": { "concept": "AnonymousFunction", "params": [ { "concept": "Param", "name": "item", "description": "" } ], "body": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "item" }, "property": { "concept": "Identifier", "namespace": "", "name": "productReport" } }, "property": { "concept": "Identifier", "namespace": "", "name": "executed" } }, "right": { "concept": "NullLiteral" }, "operator": "!=" } } } ] }
| ListFilter(list, { item: String => item.productReport.executed != null })
| nasl.util.ListFilter(list, (item: String) => item.productReport.executed != null)
|
basics/expressions | ValidationRule | 验证规则 | { "concept": "ValidationRule", "calleeNamespace": "nasl.validation", "calleeName": "maxLength", "arguments": [ { "concept": "Argument", "keyword": "max", "expression": { "concept": "NumericLiteral", "value": "100", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ], "enableServerValidation": true }
| expect maxLength(100)( enableServerValidation = true, )
| nasl.validation.maxLength(100)
|
{ "concept": "ValidationRule", "calleeNamespace": "nasl.validation", "calleeName": "maxLength", "arguments": [ { "concept": "Argument", "keyword": "max", "expression": { "concept": "NumericLiteral", "value": "100", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ], "errorMessage": { "concept": "StringLiteral", "value": "格式不正确" }, "target": { "concept": "Identifier", "namespace": "", "name": "param1" }, "enableServerValidation": true }
| expect maxLength(100)( enableServerValidation = true, errorMessage = '格式不正确', target = param1, )
| nasl.validation.maxLength(100)
|
basics/expressions | Identifier | 标识符 | { "concept": "Identifier", "namespace": "", "name": "student" }
| | |
枚举标识符{ "concept": "Identifier", "namespace": "app.enums", "name": "StatusEnum" }
| | |
basics/expressions | BinaryExpression | 二元表达式 | { "concept": "BinaryExpression", "left": { "concept": "Identifier", "namespace": "", "name": "ratio" }, "operator": "*", "right": { "concept": "NumericLiteral", "value": "100", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } }
| | |
{ "concept": "BinaryExpression", "left": { "concept": "Identifier", "namespace": "", "name": "ratio" }, "operator": "==", "right": { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } }
| | |
{ "concept": "BinaryExpression", "left": { "concept": "Identifier", "namespace": "", "name": "condition1" }, "operator": "||", "right": { "concept": "BinaryExpression", "left": { "concept": "Identifier", "namespace": "", "name": "ratio" }, "operator": ">", "right": { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } }
| | |
数据查询中的二元表达式{ "concept": "BinaryExpression", "left": { "concept": "QueryFieldExpression", "isDotStar": false, "entityAsName": "Student", "propertyName": "fullName", "asName": "" }, "right": { "concept": "Identifier", "namespace": "", "name": "name" }, "operator": "like" }
| LIKE(Student.fullName, name)
| LIKE(Student.fullName, name)
|
basics/expressions | MatchCase | 匹配分支 | { "concept": "MatchCase", "patterns": [ { "concept": "BooleanLiteral", "value": "true" } ], "body": [ { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } ], "isMatchedTypeEnumable": true }
| | |
{ "concept": "MatchCase", "patterns": [], "body": [], "isMatchedTypeEnumable": false }
| | |
basics/expressions | Match | 匹配 | { "concept": "Match", "expression": { "concept": "MemberExpression", "object": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "item" }, "property": { "concept": "Identifier", "namespace": "", "name": "productReport" } }, "property": { "concept": "Identifier", "namespace": "", "name": "executed" } }, "isExpression": true, "cases": [ { "concept": "MatchCase", "patterns": [ { "concept": "BooleanLiteral", "value": "true" } ], "body": [ { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } ], "isMatchedTypeEnumable": true }, { "concept": "MatchCase", "patterns": [ { "concept": "BooleanLiteral", "value": "false" } ], "body": [ { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } ], "isMatchedTypeEnumable": true }, { "concept": "MatchCase", "patterns": [], "body": [], "isMatchedTypeEnumable": false } ] }
| match item.productReport.executed { true => 1 false => 0 }
| (function match(_value) { if (item.productReport.executed === true) { return 1 } else if (item.productReport.executed === false) { return 0 } else { } })(item.productReport.executed)
|
basics/expressions | UnaryExpression | 一元表达式 | { "concept": "UnaryExpression", "operator": "!", "argument": { "concept": "Identifier", "namespace": "", "name": "condition" } }
| | |
数据查询中的一元表达式{ "concept": "UnaryExpression", "operator": "isNull", "argument": { "concept": "Identifier", "namespace": "", "name": "condition" } }
| | |
basics/expressions | MemberExpression | 成员表达式 | { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "student" }, "property": { "concept": "Identifier", "namespace": "", "name": "name" } }
| | |
{ "concept": "MemberExpression", "object": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "item" }, "property": { "concept": "Identifier", "namespace": "", "name": "student" } }, "property": { "concept": "Identifier", "namespace": "", "name": "name" } }
| | |
枚举标识符{ "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "app.enums", "name": "Status" }, "property": { "concept": "Identifier", "namespace": "", "name": "Normal" } }
| app::enums::Status::Normal
| app.enums.Status['Normal']
|
数值枚举标识符{ "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "app.enums", "name": "Status" }, "property": { "concept": "Identifier", "namespace": "", "name": "0" } }
| | |
basics/expressions | Unparsed | 未解析的 | | | |
basics/expressions | New | 构造器 | | | |
basics/expressions | NewComposite | 实体/(匿名)数据结构构造器 | { "concept": "NewComposite", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "reference", "typeNamespace": "app.dataSources.defaultDS.entities", "typeName": "Student", "inferred": false, "ruleMap": {} }, "properties": [ { "concept": "Identifier", "namespace": "", "name": "id" }, { "concept": "Identifier", "namespace": "", "name": "createdTime" }, { "concept": "Identifier", "namespace": "", "name": "updatedTime" }, { "concept": "Identifier", "namespace": "", "name": "createdBy" }, { "concept": "Identifier", "namespace": "", "name": "updatedBy" }, { "concept": "Identifier", "namespace": "", "name": "name" } ], "rights": [ { "concept": "SelectMembers", "hideMembers": false, "expression": { "concept": "StringLiteral", "value": "学生甲" }, "members": [] } ], "assignmentLines": [ { "concept": "AssignmentLine", "leftIndex": [ 0, 5 ], "rightIndex": [ 0 ] } ], "hideProperties": false, "hideDefaults": false, "autoConnection": true }
| app::dataSources::defaultDS::entities::Student { id = ______, createdTime = ______, updatedTime = ______, createdBy = ______, updatedBy = ______, name = '学生甲', }
| nasl.util.NewEntity<Student>({ id: ______, createdTime: ______, updatedTime: ______, createdBy: ______, updatedBy: ______, name: '学生甲' })
|
新建匿名数据结构{ "concept": "NewComposite", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "anonymousStructure", "typeNamespace": "", "typeName": "", "inferred": false, "ruleMap": {}, "properties": [ { "concept": "StructureProperty", "name": "name" }, { "concept": "StructureProperty", "name": "age" } ] }, "properties": [ { "concept": "Identifier", "namespace": "", "name": "name" }, { "concept": "Identifier", "namespace": "", "name": "age" } ], "rights": [ { "concept": "SelectMembers", "hideMembers": false, "expression": { "concept": "NumericLiteral", "value": "24", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "members": [] }, { "concept": "SelectMembers", "hideMembers": false, "expression": { "concept": "StringLiteral", "value": "学生甲" }, "members": [] } ], "assignmentLines": [ { "concept": "AssignmentLine", "leftIndex": [ 0, 0 ], "rightIndex": [ 1 ] }, { "concept": "AssignmentLine", "leftIndex": [ 0, 1 ], "rightIndex": [ 0 ] } ], "hideProperties": false, "hideDefaults": false, "autoConnection": true }
| { name = '学生甲', age = 24, }
| nasl.util.NewAnonymousStructure({ name: '学生甲', age: 24 })
|
basics/expressions | NewStructure | 直接的(匿名)数据结构构造器 | | | |
basics/expressions | NewList | 列表构造器 | { "concept": "NewList", "items": [ { "concept": "StringLiteral", "value": "选项1" }, { "concept": "StringLiteral", "value": "选项2" }, { "concept": "StringLiteral", "value": "选项3" } ] }
| | nasl.util.NewList<______>(['选项1', '选项2', '选项3'])
|
basics/expressions | NewMap | Map 构造器 | { "concept": "NewMap", "keys": [ { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, { "concept": "NumericLiteral", "value": "2", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, { "concept": "NumericLiteral", "value": "3", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } ], "values": [ { "concept": "StringLiteral", "value": "选项1" }, { "concept": "StringLiteral", "value": "选项2" }, { "concept": "StringLiteral", "value": "选项3" } ] }
| [1 -> '选项1', 2 -> '选项2', 3 -> '选项3']
| nasl.util.NewMap<__IDENTIFIER__>({ 1: '选项1', 2: '选项2', 3: '选项3' })
|
basics/expressions | Paginate | 分页 | { "concept": "Paginate", "list": { "concept": "CallQueryComponent", "select": { "concept": "QuerySelectExpression", "distinct": false, "star": true, "selectElements": [ { "concept": "QueryFieldExpression", "isDotStar": true, "entityAsName": "OrderProduct", "propertyName": "", "asName": "" } ] }, "from": { "concept": "QueryFromExpression", "entityNamespace": "app.dataSources.defaultDS.entities", "entityName": "OrderProduct", "joinParts": [], "asName": "" }, "where": { "concept": "BinaryExpression", "left": { "concept": "BinaryExpression", "left": { "concept": "QueryFieldExpression", "isDotStar": false, "entityAsName": "OrderProduct", "propertyName": "createdBy", "asName": "createdBy" }, "right": { "concept": "StringLiteral", "value": "张三" }, "operator": "==" }, "right": { "concept": "BinaryExpression", "left": { "concept": "QueryFieldExpression", "isDotStar": false, "entityAsName": "OrderProduct", "propertyName": "createdTime", "asName": "" }, "right": { "concept": "Identifier", "namespace": "", "name": "startDateTime" }, "operator": ">" }, "operator": "&&" }, "ideVersion": "2.22" }, "page": { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "size": { "concept": "NumericLiteral", "value": "1000", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } }
| for OrderProduct in OrderProductEntity where OrderProduct.createdBy == '张三' && OrderProduct.createdTime > startDateTime select { orderProduct: OrderProduct, } paginate 1, 1000
| PAGINATE(FROM(app.dataSources.defaultDS.entities.OrderProductEntity, OrderProduct => $ .WHERE(() => OrderProduct.createdBy == '张三' && OrderProduct.createdTime > startDateTime) .SELECT(() => ({ orderProduct: OrderProduct, }))), 1, 1000)
|
{ "concept": "Paginate", "list": { "concept": "OqlQueryComponent", "dataSource": "app.dataSources.defaultDS", "code": "SELECT * FROM Product WHERE createdTime > \$\{createdTime}" }, "page": { "concept": "Identifier", "namespace": "", "name": "page" }, "size": { "concept": "Identifier", "namespace": "", "name": "size" } }
| sql"SELECT * FROM Product WHERE createdTime > ${createdTime}" paginate page, size
| PAGINATE(nasl.oql.query(`SELECT * FROM Product WHERE createdTime > ${createdTime}`), page, size)
|
{ "concept": "Paginate", "list": { "concept": "Identifier", "name": "productList" }, "page": { "concept": "Identifier", "name": "page" }, "size": { "concept": "Identifier", "name": "size" } }
| productList paginate page, size
| PAGINATE(productList, page, size)
|
basics/statements | Abort | 中止表达式 | | | |
basics/statements | Start | 开始节点 | | | |
basics/statements | End | 结束节点 | | | |
basics/statements | IfStatement | 条件分支 | { "concept": "IfStatement", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "right": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "operator": "==" }, "consequent": [ { "concept": "Assignment", "label": "赋值", "left": { "concept": "Identifier", "namespace": "", "name": "result" }, "right": { "concept": "NullLiteral" } } ], "alternate": [ { "concept": "Assignment", "label": "赋值", "left": { "concept": "Identifier", "namespace": "", "name": "result" }, "right": { "concept": "BinaryExpression", "left": { "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "ListSum", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "list" } } ] }, "right": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "operator": "/" } } ] }
| if (list.length == 0) { result = null } else { result = ListSum(list) / list.length }
| if (list.length == 0) { result = null } else { result = nasl.util.ListSum(list) / list.length }
|
basics/statements | SwitchStatement | 选择分支 | { "concept": "SwitchStatement", "cases": [ { "concept": "SwitchCase", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "right": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "operator": "==" }, "consequent": [ { "concept": "CallLogic", "uuid": "1a3ec5f53ff84d5f87cd9d81b741bd39", "calleeNamespace": "nasl.logging", "calleeName": "INFO", "shortcut": true, "arguments": [ { "concept": "Argument", "keyword": "模板", "expression": { "concept": "StringLiteral", "value": "情况1" } } ] } ] }, { "concept": "SwitchCase", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "right": { "concept": "NumericLiteral", "value": "10", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "operator": "<=" }, "consequent": [ { "concept": "CallLogic", "uuid": "08d83151df934c3e904ab8704e14b2ae", "calleeNamespace": "nasl.logging", "calleeName": "INFO", "shortcut": true, "arguments": [ { "concept": "Argument", "keyword": "模板", "expression": { "concept": "StringLiteral", "value": "情况2" } } ] } ] }, { "concept": "SwitchCase", "consequent": [ { "concept": "CallLogic", "uuid": "11fe6dacbd3f42749c14c272fad6ffbb", "calleeNamespace": "nasl.logging", "calleeName": "INFO", "shortcut": true, "arguments": [ { "concept": "Argument", "keyword": "模板", "expression": { "concept": "StringLiteral", "value": "其它情况" } } ] } ] } ] }
| switch { list.length == 0 => { nasl::logging::INFO('情况1') } list.length <= 10 => { nasl::logging::INFO('情况2') } _ => { nasl::logging::INFO('其它情况') } }
| if (list.length == 0) { nasl.logging.INFO('情况1') } else if (list.length <= 10) { nasl.logging.INFO('情况2') } else { nasl.logging.INFO('其它情况') }
|
basics/statements | SwitchCase | 选择分支情况 | { "concept": "SwitchCase", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "right": { "concept": "NumericLiteral", "value": "10", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "operator": "<=" }, "consequent": [ { "concept": "CallLogic", "uuid": "08d83151df934c3e904ab8704e14b2ae", "calleeNamespace": "nasl.logging", "calleeName": "INFO", "shortcut": true, "arguments": [ { "concept": "Argument", "keyword": "模板", "expression": { "concept": "StringLiteral", "value": "情况2" } } ] } ] }
| list.length <= 10 => { nasl::logging::INFO('情况2') }
| if (list.length <= 10) { nasl.logging.INFO('情况2') }
|
else{ "concept": "SwitchCase", "consequent": [ { "concept": "CallLogic", "uuid": "11fe6dacbd3f42749c14c272fad6ffbb", "calleeNamespace": "nasl.logging", "calleeName": "INFO", "shortcut": true, "arguments": [ { "concept": "Argument", "keyword": "模板", "expression": { "concept": "StringLiteral", "value": "其它情况" } } ] } ] }
| _ => { nasl::logging::INFO('其它情况') }
| if (______) { nasl.logging.INFO('其它情况') }
|
basics/statements | ForEachStatement | ForEach 循环分支 | { "concept": "ForEachStatement", "each": { "concept": "Identifier", "namespace": "", "name": "list" }, "item": { "concept": "Param", "name": "item", "description": "" }, "index": { "concept": "Param", "name": "index", "description": "" }, "start": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "body": [ { "concept": "IfStatement", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "item" }, "property": { "concept": "Identifier", "namespace": "", "name": "productReport" } }, "property": { "concept": "Identifier", "namespace": "", "name": "accepted" } }, "right": { "concept": "BooleanLiteral", "value": "true" }, "operator": "==" }, "consequent": [ { "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "Add", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "fullAcceptedList" } }, { "concept": "Argument", "keyword": "item", "expression": { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ] } ], "alternate": [ { "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "Add", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "fullAcceptedList" } }, { "concept": "Argument", "keyword": "item", "expression": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ] } ] } ] }
| for (item in list, index) { if (item.productReport.accepted == true) { Add(fullAcceptedList, 1) } else { Add(fullAcceptedList, 0) } }
| ForEach(list, 0, ______, (item, index) => { if (item.productReport.accepted == true) { nasl.util.Add(fullAcceptedList, 1) } else { nasl.util.Add(fullAcceptedList, 0) } })
|
{ "concept": "ForEachStatement", "each": { "concept": "Identifier", "namespace": "", "name": "list" }, "item": { "concept": "Param", "name": "item", "description": "" }, "index": { "concept": "Param", "name": "index", "description": "" }, "start": { "concept": "NumericLiteral", "value": "3", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } }, "end": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "operator": "-", "right": { "concept": "NumericLiteral", "value": "3", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } }, "body": [ { "concept": "IfStatement", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "item" }, "property": { "concept": "Identifier", "namespace": "", "name": "productReport" } }, "property": { "concept": "Identifier", "namespace": "", "name": "accepted" } }, "right": { "concept": "BooleanLiteral", "value": "true" }, "operator": "==" }, "consequent": [ { "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "Add", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "fullAcceptedList" } }, { "concept": "Argument", "keyword": "item", "expression": { "concept": "NumericLiteral", "value": "1", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ] } ], "alternate": [ { "concept": "CallFunction", "label": "内置函数", "calleeNamespace": "nasl.util", "calleeName": "Add", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "fullAcceptedList" } }, { "concept": "Argument", "keyword": "item", "expression": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ] } ] } ] }
| for (item in list, index in 3 to list.length - 3) { if (item.productReport.accepted == true) { Add(fullAcceptedList, 1) } else { Add(fullAcceptedList, 0) } }
| ForEach(list, 3, list.length - 3, (item, index) => { if (item.productReport.accepted == true) { nasl.util.Add(fullAcceptedList, 1) } else { nasl.util.Add(fullAcceptedList, 0) } })
|
basics/statements | WhileStatement | While 循环分支 | { "concept": "WhileStatement", "test": { "concept": "BinaryExpression", "left": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "list" }, "property": { "concept": "Identifier", "namespace": "", "name": "length" } }, "operator": ">", "right": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } }, "body": [ { "concept": "CallFunction", "calleeNamespace": "nasl.util", "calleeName": "RemoveAt", "typeArguments": [], "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "list" } }, { "concept": "Argument", "keyword": "index", "expression": { "concept": "NumericLiteral", "value": "0", "typeAnnotation": { "concept": "TypeAnnotation", "typeKind": "primitive", "typeNamespace": "nasl.core", "typeName": "Long", "inferred": false, "ruleMap": {} } } } ] } ] }
| while (list.length > 0) { RemoveAt(list, 0); }
| while (list.length > 0) { nasl.util.RemoveAt(list, 0); }
|
basics/statements | Assignment | 赋值语句 | { "concept": "Assignment", "label": "赋值", "left": { "concept": "Identifier", "namespace": "", "name": "result" }, "right": { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "product" }, "property": { "concept": "Identifier", "namespace": "", "name": "price" } } }
| | |
basics/statements | BatchAssignment | 批量赋值语句 | { "concept": "BatchAssignment", "label": "批量赋值", "left": { "concept": "SelectMembers", "hideMembers": false, "expression": { "concept": "Identifier", "namespace": "", "name": "result" }, "members": [ { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "result" }, "property": { "concept": "Identifier", "namespace": "", "name": "accepted" } }, { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "result" }, "property": { "concept": "Identifier", "namespace": "", "name": "executed" } }, { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "result" }, "property": { "concept": "Identifier", "namespace": "", "name": "fullAccepted" } }, { "concept": "MemberExpression", "object": { "concept": "Identifier", "namespace": "", "name": "result" }, "property": { "concept": "Identifier", "namespace": "", "name": "success" } } ] }, "rights": [ { "concept": "SelectMembers", "hideMembers": false, "expression": { "uuid": "52f1329c82414b9a8c320815cf703425", "concept": "CallLogic", "label": "调用逻辑", "calleeNamespace": "app.logics", "calleeName": "computeRatio", "handleError": false, "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "executedList" } } ] }, "members": [] }, { "concept": "SelectMembers", "hideMembers": false, "expression": { "uuid": "aabee80d05b94a64ab797bae0f11aa85", "concept": "CallLogic", "label": "调用逻辑", "calleeNamespace": "app.logics", "calleeName": "computeRatio", "handleError": false, "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "successList" } } ] }, "members": [] }, { "concept": "SelectMembers", "hideMembers": false, "expression": { "uuid": "a274f5173af049feaee53c1b968c17c1", "concept": "CallLogic", "label": "调用逻辑", "calleeNamespace": "app.logics", "calleeName": "computeRatio", "handleError": false, "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "acceptedList" } } ] }, "members": [] }, { "concept": "SelectMembers", "hideMembers": false, "expression": { "uuid": "6ac10af536c446acbc7179b4f525d3d6", "concept": "CallLogic", "label": "调用逻辑", "calleeNamespace": "app.logics", "calleeName": "computeRatio", "handleError": false, "arguments": [ { "concept": "Argument", "keyword": "list", "expression": { "concept": "Identifier", "namespace": "", "name": "fullAcceptedList" } } ] }, "members": [] } ], "assignmentLines": [ { "concept": "AssignmentLine", "leftIndex": [ 0, 2 ], "rightIndex": [ 3 ] }, { "concept": "AssignmentLine", "leftIndex": [ 0, 0 ], "rightIndex": [ 2 ] }, { "concept": "AssignmentLine", "leftIndex": [ 0, 3 ], "rightIndex": [ 1 ] }, { "concept": "AssignmentLine", "leftIndex": [ 0, 1 ], "rightIndex": [ 0 ] } ], "autoConnection": true }
|