diff --git a/data/system/misc/timetamp.yaml b/data/system/misc/timetamp.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19c6105d6519887480ea38dbb6f2cfb118a20953 --- /dev/null +++ b/data/system/misc/timetamp.yaml @@ -0,0 +1,42 @@ +title: IP地址 +desc: 含有多种实现的示例。 +author: wwccss +version: 1.0 + +field: ip +instances: + - instance: privateC + note: C类IP地址 + prefix: 192.168. + fields: + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateB + note: B类IP地址 + prefix: 172. + fields: + - field: part2 + range: 16-31 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateA + note: A类IP地址 + prefix: 10. + fields: + - field: part2 + range: 0-254 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 \ No newline at end of file diff --git a/data/system/name/chinese-name.yaml b/data/system/name/chinese-name.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19c6105d6519887480ea38dbb6f2cfb118a20953 --- /dev/null +++ b/data/system/name/chinese-name.yaml @@ -0,0 +1,42 @@ +title: IP地址 +desc: 含有多种实现的示例。 +author: wwccss +version: 1.0 + +field: ip +instances: + - instance: privateC + note: C类IP地址 + prefix: 192.168. + fields: + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateB + note: B类IP地址 + prefix: 172. + fields: + - field: part2 + range: 16-31 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateA + note: A类IP地址 + prefix: 10. + fields: + - field: part2 + range: 0-254 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 \ No newline at end of file diff --git a/data/system/name/english-name.yaml b/data/system/name/english-name.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19c6105d6519887480ea38dbb6f2cfb118a20953 --- /dev/null +++ b/data/system/name/english-name.yaml @@ -0,0 +1,42 @@ +title: IP地址 +desc: 含有多种实现的示例。 +author: wwccss +version: 1.0 + +field: ip +instances: + - instance: privateC + note: C类IP地址 + prefix: 192.168. + fields: + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateB + note: B类IP地址 + prefix: 172. + fields: + - field: part2 + range: 16-31 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 + + - instance: privateA + note: A类IP地址 + prefix: 10. + fields: + - field: part2 + range: 0-254 + postfix: . + - field: part3 + range: 0-254 + postfix: . + - field: part4 + range: 1-254 \ No newline at end of file diff --git a/data/system/name/family-name.txt b/data/system/name/family-name.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/system/name/first-name.txt b/data/system/name/first-name.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/system/name/given-name.txt b/data/system/name/given-name.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/system/name/last-name.txt b/data/system/name/last-name.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/system/name/random-name.yaml b/data/system/name/random-name.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/demo/default.yaml b/demo/default.yaml index 8a3429a712ced7146dca5cb988045872ddf33c74..ba70995f5252bad6165c708c6367c480dd87ba66 100644 --- a/demo/default.yaml +++ b/demo/default.yaml @@ -62,45 +62,54 @@ fields: - field: field_common # 默认的列表类型,通过逗号隔成若干区段。 range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30 prefix: int_ # 前缀 - postfix: \t # 后缀 + postfix: "\t" # 后缀,特殊字符加引号,否则无法解析。 - field: field_step # 区间可以指定步长。 range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2 + postfix: "\t" - field: field_random # 通过R属性指定随机。R属性和步长不能同时出现。 range: 1-10:R # 1,5,8... + postfix: "\t" - field: field_file # 从一个文件中读取列表,并指定随机。 - range: _users.txt:R # 该文件中一行作为一个元素,并随机。 + range: users.txt:R # 该文件中一行作为一个元素,并随机。 + postfix: "\t" - field: field_loop # 自循环的字段。 range: a-z # a_b_c | d_e_f | g_h_i loop: 3 # 循环三次 loopfix: _ # 每次循环的连接符。 - postfix: "|" # 特殊字符加引号,否则无法解析。 + postfix: "\t" - field: field_repeat # 通过{}定义重复的元素。 range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3 + postfix: "\t" - field: field_format # 通过格式化字符串输出。 range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。 format: "passwd%02d" # 用%2d补零,使密码整体保持8位,%2d默认补空格。 + postfix: "\t" - field: field_use_another_file # 可以引用其他的定义文件。 - config: _numb_field.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。 + config: numb_field.yaml # 引用当前目录下面的numb_field.yaml文件里面的定义。 + postfix: "\t" - field: field_use_ranges_file # 引用其他的定义文件,该文件定义了多个range,他们共享了一些field层面的属性。 - from: _numb_ranges.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。 + from: numb_ranges.yaml # 引用当前目录下面的numb_field.yaml文件里面的定义。 use: medium # 使用该文件中定义的medium分组。 + postfix: "\t" - field: field_use_instance # 引用其他的定义文件,该文件定义了多个实例。 from: system.ip.v1.yaml # 引用data/system/ip/v1.yaml use: privateC,privateC # 使用该文件中定义的privateC和privateB两个实例。 + postfix: "\t" - field: field_use_excel # 从excel数据源里面取数据。 from: system.address.v1.china # 从data/system/address/v1.xlsx文件中读取名为china的工作簿。 select: city # 查询city字段。 - where: state like '%山东%' # 条件是 省份包含山东。 + where: state like '%山东%' # 条件是 省份包含山东。 + postfix: "\t" - field: field_with_children # 嵌套字段 fields: diff --git a/demo/default_en.yaml b/demo/default_en.yaml deleted file mode 100644 index 68f0d69b51c2191b775af8406014a35344958e8e..0000000000000000000000000000000000000000 --- a/demo/default_en.yaml +++ /dev/null @@ -1,124 +0,0 @@ -title: zendata config syntax -desc: - - # File composition - - # zendata defines the format for each field in YAML file. - # YAML file is composed of file description and field definition. - - # File description - - # title: A short text to summarize the data type defined by this file. - # desc: Detailed text to describe the data type defined in this file, optional. - # author: Optional. - # version: Version number, optional. - - # Field list - - # Field is defined in fields. - # A YAML file contains one or more fields. - # Field list starts from -field. - # A child field can be defined by fields. - - # Field definition - - # field: Field name; letters, digits, underlines and dots only. - # range: List range; the most important definition. - # loop: The number of loops; define how many times a field can loop. - # loopfix: The connector for each loop. - - # format: Support formatted output. - - # prefix: Prefix of this field. - # postfix: Postfix of this field. - - # length: The length of this field. If separators are not used, specify the field length in bytes. - # leftpad: Left-padded characters. If the length is not enough, specify a character. The default is space. - # rightpad: Right-padded characters. If the length is not enough, specify a character. - - # config: Refer to the definition in other file. - - # from: Refer to a definition file. - # use: Use instances defined in the referred file. - # select: If refer to an excel table, you can query a field in it. - # where: If refer to an excel table, you can use query conditions. - - # range definition - - # Use commas to connect elements. e.g. range: 1,2,3. - # Elements can be a range, e.g. range:1-10, A-Z. - # Use colons to define steps, e.g. range:1-10:2. - # Steps can be decimals, e.g. range: 1-10:0.1. - # Intervals can be set as random by R, e.g. range: 1-10:R. Set either random or a specified step. - # Use a file to specify a list, e.g. range: list.txt. If the file name is a relative path, it is based on the config file. - # Use {n} to repeat a element, e.g. range: user1{100},user2{100}. - # Use [], if intervals and elements are repeated, e.g. range: [user1,user2,user3]{100}. - -author: zentao -version: 1.0 - -fields: - - - field: field_common # The list type by default. Separated by commas. - range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30 - prefix: int_ # Prefix - postfix: \t # Postfix - - - field: field_step # Interval steps can be specified. - range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2 - - - field: field_random # Use R to specify randomly. Set either R or a specified step. - range: 1-10:R # 1,5,8... - - - field: field_file # Read a list from a file and set it as random. - range: _users.txt:R # Using the lines of users.txt as range and set it as random. - - - field: field_loop # Self-loop field. - range: a-z # a_b_c | d_e_f | g_h_i - loop: 3 # Loop three times. - loopfix: _ # The connector for each loop. - postfix: | - - - field: field_repeat # Use {} to define repeated elements. - range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3 - - - field: field_format # Output as formatted strings. - range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。 - format: "passwd%02d" - - - field: field_use_another_file # Other definition file can be referred. - config: _numb_field.yaml # Refer to the definition in nubmer.yaml of the current directory. - - - field: field_use_ranges_file # Other definition file can be referred, in which more than one ranges are defined. - from: _numb_ranges.yaml # Refer to the definition in _numb_ranges.yaml of the current directory. - use: medium # use medium range. - - - field: field_use_instance # Refer to other definition file which defines multiple instances. - from: system.ip.v1.yaml # Refer to data/system/ip/v1.yaml. - use: privateB,privateC # Use the two instances of privateC and privateB defined in this file. - - - field: field_use_excel # Read the data from the data source of excel. - from: system.address.v1.china # Read the book named china in data/system/address/v1.xlsx. - select: city # Query the field city. - where: cityCode = 852 # Query condition. - - - field: field_with_children # Embeded field. - fields: - - field: child1 - range: a-z - prefix: part1_ - postfix: '|' - - - field: child2 - range: A-Z - prefix: part2_ - postfix: '|' - - - field: child_with_child - prefix: part3_ - postfix: - fields: - - field: field_grandson - prefix: int_ - range: 10-20 - postfix: diff --git a/demo/_numb_field.yaml b/demo/number_field.yaml similarity index 100% rename from demo/_numb_field.yaml rename to demo/number_field.yaml diff --git a/demo/_numb_ranges.yaml b/demo/number_ranges.yaml similarity index 100% rename from demo/_numb_ranges.yaml rename to demo/number_ranges.yaml diff --git a/demo/test.yaml b/demo/test.yaml index 12af49d295b330722afb47bd5eceda0e07e0fb43..a29e42ebb87c6067ec3dbabaf176cd9b5e48b45e 100644 --- a/demo/test.yaml +++ b/demo/test.yaml @@ -24,4 +24,4 @@ fields: from: system.ip.private.yaml # 引用data/system/ip/v1.yaml use: all # 使用该文件中定义的privateC和privateB两个实例。 prefix: "[" # 复写前缀 - postfix: "]" # 特殊字符加引号,否则无法解析 + postfix: "]" # 特殊字符加引号,否则无法解析 \ No newline at end of file diff --git a/demo/_users.txt b/demo/users.txt similarity index 100% rename from demo/_users.txt rename to demo/users.txt diff --git a/demo/wp_posts.yaml b/demo/wp_posts.yaml deleted file mode 100644 index c6d6f14cfc07acb3ac3d464624fb20edd220590f..0000000000000000000000000000000000000000 --- a/demo/wp_posts.yaml +++ /dev/null @@ -1,60 +0,0 @@ -title: table wp_posts -desc: "" -author: automated export -version: "1.0" -fields: - - field: post_title - note: 文章标题 - fields: - - field: title1 - type: list - range: "[标题A,TitleB]" - postfix: "-" - - field: title2 - range: 1-999 - format: "%03d" - - field: post_content - node: 文章内容 - fields: - - field: field4.1 - type: list - range: [Epic,Feature,Story]:R{1} - prefix: "
" - postfix: ":
" - - field: field4.2 - postfix: "
Aaron 2020/06/18" - fields: - - field: field4.2.1 - loop: 3 - fields: - - field: field4.2.1.1 - postfix: "
" - loop: 3 - fields: - - field: field4.2.2 - range: a-z:R - postfix: " " - loop: 6 - - - field: post_author - range: "1" - - field: post_status - range: "publish" - - field: post_date - range: "[2020-06-06 06:06:06]" - - field: post_date_gmt - range: "[2020-06-06 06:06:06]" - - field: post_modified - range: "[2020-06-06 06:06:06]" - - field: post_modified_gmt - range: "[2020-06-06 06:06:06]" - - field: guid - range: "[http://localhost:8080/?p=3800]" - - field: post_excerpt - range: "" - - field: to_ping - range: "" - - field: pinged - range: "" - - field: post_content_filtered - range: "" diff --git a/demo/_zentao.sql b/demo/zentao.sql similarity index 100% rename from demo/_zentao.sql rename to demo/zentao.sql diff --git a/res/doc/sample.yaml b/res/doc/sample.yaml index 04ba362766d7edd17cc19b5901aa1708e889d484..bed0b7ca7306ac27823540b990edea22beb4690d 100644 --- a/res/doc/sample.yaml +++ b/res/doc/sample.yaml @@ -62,45 +62,54 @@ fields: - field: field_common # 默认的列表类型,通过逗号隔成若干区段。 range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30 prefix: int_ # 前缀 - postfix: \t # 后缀 + postfix: "\t" # 后缀,特殊字符加引号,否则无法解析。 - field: field_step # 区间可以指定步长。 range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2 + postfix: "\t" - field: field_random # 通过R属性指定随机。R属性和步长不能同时出现。 range: 1-10:R # 1,5,8... + postfix: "\t" - field: field_file # 从一个文件中读取列表,并指定随机。 - range: _users.txt:R # 该文件中一行作为一个元素,并随机。 + range: users.txt:R # 该文件中一行作为一个元素,并随机。 + postfix: "\t" - field: field_loop # 自循环的字段。 range: a-z # a_b_c | d_e_f | g_h_i loop: 3 # 循环三次 loopfix: _ # 每次循环的连接符。 - postfix: "|" # 特殊字符加引号,否则无法解析。 + postfix: "\t" - field: field_repeat # 通过{}定义重复的元素。 range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3 + postfix: "\t" - field: field_format # 通过格式化字符串输出。 range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。 format: "passwd%02d" # 用%2d补零,使密码整体保持8位,%2d默认补空格。 + postfix: "\t" - field: field_use_another_file # 可以引用其他的定义文件。 - config: _numb_field.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。 + config: number_field.yaml # 引用当前目录下面的number_field.yaml文件里面的定义。 + postfix: "\t" - field: field_use_ranges_file # 引用其他的定义文件,该文件定义了多个range,他们共享了一些field层面的属性。 - from: _numb_ranges.yaml # 引用当前目录下面的_numb_field.yaml文件里面的定义。 + from: number_ranges.yaml # 引用当前目录下面的number_field.yaml文件里面的定义。 use: medium # 使用该文件中定义的medium分组。 + postfix: "\t" - field: field_use_instance # 引用其他的定义文件,该文件定义了多个实例。 from: system.ip.v1.yaml # 引用data/system/ip/v1.yaml use: privateC,privateC # 使用该文件中定义的privateC和privateB两个实例。 + postfix: "\t" - field: field_use_excel # 从excel数据源里面取数据。 from: system.address.v1.china # 从data/system/address/v1.xlsx文件中读取名为china的工作簿。 select: city # 查询city字段。 - where: state like '%山东%' # 条件是 省份包含山东。 + where: state like '%山东%' # 条件是 省份包含山东。 + postfix: "\t" - field: field_with_children # 嵌套字段 fields: diff --git a/res/doc/sample_en.yaml b/res/doc/sample_en.yaml index 68f0d69b51c2191b775af8406014a35344958e8e..0fec0aeb7a39400ce3668bd54a723dedc5a94099 100644 --- a/res/doc/sample_en.yaml +++ b/res/doc/sample_en.yaml @@ -62,45 +62,54 @@ fields: - field: field_common # The list type by default. Separated by commas. range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30 prefix: int_ # Prefix - postfix: \t # Postfix + postfix: "\t" # Postfix - field: field_step # Interval steps can be specified. range: 1-10:2, 1-2:0.1 # 1,3,5,7,9,1, 1.1,1.2...,2 + postfix: "\t" - field: field_random # Use R to specify randomly. Set either R or a specified step. range: 1-10:R # 1,5,8... + postfix: "\t" - field: field_file # Read a list from a file and set it as random. - range: _users.txt:R # Using the lines of users.txt as range and set it as random. + range: users.txt:R # Using the lines of users.txt as range and set it as random. + postfix: "\t" - field: field_loop # Self-loop field. range: a-z # a_b_c | d_e_f | g_h_i loop: 3 # Loop three times. loopfix: _ # The connector for each loop. - postfix: | + postfix: "\t" - field: field_repeat # Use {} to define repeated elements. range: user-1{3},[user2,user3]{2} # user-1,user-1,user-1,user2,user3,user2,user3 + postfix: "\t" - field: field_format # Output as formatted strings. range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。 format: "passwd%02d" + postfix: "\t" - field: field_use_another_file # Other definition file can be referred. - config: _numb_field.yaml # Refer to the definition in nubmer.yaml of the current directory. + config: number_field.yaml # Refer to the definition in number_field.yaml of the current directory. + postfix: "\t" - field: field_use_ranges_file # Other definition file can be referred, in which more than one ranges are defined. - from: _numb_ranges.yaml # Refer to the definition in _numb_ranges.yaml of the current directory. + from: number_ranges.yaml # Refer to the definition in number_ranges.yaml of the current directory. use: medium # use medium range. + postfix: "\t" - field: field_use_instance # Refer to other definition file which defines multiple instances. from: system.ip.v1.yaml # Refer to data/system/ip/v1.yaml. use: privateB,privateC # Use the two instances of privateC and privateB defined in this file. + postfix: "\t" - field: field_use_excel # Read the data from the data source of excel. from: system.address.v1.china # Read the book named china in data/system/address/v1.xlsx. select: city # Query the field city. where: cityCode = 852 # Query condition. + postfix: "\t" - field: field_with_children # Embeded field. fields: diff --git a/src/utils/config/config.go b/src/utils/config/config.go index 1fb5b2281c580cc286031b667b11b14f660f6df7..5223a7b45afa7439ddd2144a65a5f51c3228e7c0 100644 --- a/src/utils/config/config.go +++ b/src/utils/config/config.go @@ -121,12 +121,12 @@ func InputForSet() { enCheck := "" var numb string - if conf.Language == "en" { + if conf.Language == "zh" { enCheck = "*" numb = "1" } zhCheck := "" - if conf.Language == "zh" { + if conf.Language == "en" { zhCheck = "*" numb = "2" } @@ -134,9 +134,9 @@ func InputForSet() { numbSelected := stdinUtils.GetInput("(1|2)", numb, "enter_language", enCheck, zhCheck) if numbSelected == "1" { - conf.Language = "en" - } else { conf.Language = "zh" + } else { + conf.Language = "en" } SaveConfig(conf) diff --git a/test/definition/_ddl.sql b/test/definition/_ddl.sql deleted file mode 100644 index 6b9e78728cc7579836aeab2a19996699285cc680..0000000000000000000000000000000000000000 --- a/test/definition/_ddl.sql +++ /dev/null @@ -1,36 +0,0 @@ --- DROP TABLE IF EXISTS `zt_action`; -CREATE TABLE IF NOT EXISTS `zt_action` ( - `id` mediumint(8) unsigned NOT NULL auto_increment, - `objectType` varchar(30) NOT NULL default '', - `objectID` mediumint(8) unsigned NOT NULL default '0', - `product` varchar(255) NOT NULL, - `project` mediumint(9) NOT NULL, - `actor` varchar(100) NOT NULL default '', - `action` varchar(30) NOT NULL default '', - `date` datetime NOT NULL, - `comment` text NOT NULL, - `extra` text NOT NULL, - `read` enum('0','1') NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `date` (`date`), - KEY `actor` (`actor`), - KEY `project` (`project`), - KEY `objectID` (`objectID`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- DROP TABLE IF EXISTS `zt_block`; -CREATE TABLE IF NOT EXISTS `zt_block` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `account` char(30) NOT NULL, - `module` varchar(20) NOT NULL, - `title` varchar(100) NOT NULL, - `source` varchar(20) NOT NULL, - `block` varchar(20) NOT NULL, - `params` text NOT NULL, - `order` tinyint(3) unsigned NOT NULL DEFAULT '0', - `grid` tinyint(3) unsigned NOT NULL DEFAULT '0', - `height` smallint(5) unsigned NOT NULL DEFAULT '0', - `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `accountModuleOrder` (`account`,`module`,`order`), - KEY `account` (`account`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/test/definition/_numb_field.yaml b/test/definition/_numb_field.yaml deleted file mode 100644 index 41742cc08faaf72b3bcae534cdd845a5e9ee3dbd..0000000000000000000000000000000000000000 --- a/test/definition/_numb_field.yaml +++ /dev/null @@ -1,15 +0,0 @@ -title: number -desc: -author: wwccss -version: 1.0 - -field: number -note: 数值类型数据 -prefix: "'" -postfix: "'" -loop: 2 -loopfix: "," -ranges: - small: 1-9 - medium: 11-99 - large: 10001-99999 diff --git a/test/definition/_numb_ranges.yaml b/test/definition/_numb_ranges.yaml deleted file mode 100644 index 583e24f6029c8dbd257ec5ff77220d1e49f7307a..0000000000000000000000000000000000000000 --- a/test/definition/_numb_ranges.yaml +++ /dev/null @@ -1,12 +0,0 @@ -title: number -desc: -author: wwccss -version: 1.0 - -field: number -note: 数值类型数据 -range: 11-99 -prefix: "'" -postfix: "'" -loop: 2 -loopfix: "," \ No newline at end of file diff --git a/test/definition/basic.yaml b/test/definition/basic.yaml deleted file mode 100644 index 2a7a86ab6adf688b6cba2e3d1f916a04176bc2ff..0000000000000000000000000000000000000000 --- a/test/definition/basic.yaml +++ /dev/null @@ -1,32 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: char - range: a-z - - field: numb - range: 1-9 - - - field: basic - note: 基本属性 - range: a-z - loop: 3 - loopfix: "," - prefix: "'" - postfix: "'" - - - field: step - note: 指定步长 - range: 1-10:2, 1-2:0.1 - loop: 3 - loopfix: "," - prefix: "'" - postfix: "'" - - - field: random - note: R属性指定随机 - range: 1-10:R - loop: 6 - loopfix: "," \ No newline at end of file diff --git a/test/definition/format.yaml b/test/definition/format.yaml deleted file mode 100644 index 7199cd6a73b26d30b702a76c216c155ebab3ae09..0000000000000000000000000000000000000000 --- a/test/definition/format.yaml +++ /dev/null @@ -1,22 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: int - note: 基本属性 - range: 1-10 - format: "%+d" - postfix: ", " - - - field: float - note: 指定步长 - range: 1.0-2.0:0.1 - format: "%.3f" - postfix: ", " - - - field: char - note: R属性指定随机 - range: a-z:2 - format: "char is %s" \ No newline at end of file diff --git a/test/definition/inherit.yaml b/test/definition/inherit.yaml deleted file mode 100644 index c53289ebb8346439b53bc1c5d20da08fb9c6f38b..0000000000000000000000000000000000000000 --- a/test/definition/inherit.yaml +++ /dev/null @@ -1,18 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: basic - note: inherit from basic field - loop: 2 - loopfix: " " - prefix: "{" - postfix: "}" - - - field: refer2 - note: inherit from reference field - loop: 2 - prefix: "=" - postfix: "-" \ No newline at end of file diff --git a/test/definition/nested.yaml b/test/definition/nested.yaml deleted file mode 100644 index 99d8233527d1fcb5cc5b23c6876cbffecbc6b271..0000000000000000000000000000000000000000 --- a/test/definition/nested.yaml +++ /dev/null @@ -1,25 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: nested - fields: - - field: field1.1 - type: list - range: 1-9 - postfix: ". " - - field: field1.2 - prefix: "'" - postfix: "'" - loop: 2 - loopfix: "," - fields: - - field: field1.2.1 - type: list - range: X-Z - - field: field1.2.2 - type: list - range: 1-9 - loop: 2 \ No newline at end of file diff --git a/test/definition/refer.yaml b/test/definition/refer.yaml deleted file mode 100644 index e8bcff907888ca99fae6307955ff2e50c48820e9..0000000000000000000000000000000000000000 --- a/test/definition/refer.yaml +++ /dev/null @@ -1,26 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: refer - from: system.ip.v1.yaml - use: privateC - - - field: refer2 - from: _numb.yaml - use: small,large - loop: 4 - loopfix: " " - prefix: "-" - postfix: "-" - - - field: excel - from: system.address.v1.city - select: name - where: state like '%山东%' - prefix: "'" - postfix: "'" - loop: 3 - loopfix: "-" \ No newline at end of file diff --git a/test/definition/repeat.yaml b/test/definition/repeat.yaml deleted file mode 100644 index a7610dc01df58e74f5faefa97485bc3ec8c897f2..0000000000000000000000000000000000000000 --- a/test/definition/repeat.yaml +++ /dev/null @@ -1,16 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: objectype - range: [bug,task,story]:2{3},[testcase]{2} - postfix: " " - - - field: objectid - range: 1.0-9.0:3{2} - postfix: " " - - - field: action - range: [create,resolve,close]{2},[create,finish,close]{10} \ No newline at end of file diff --git a/test/unit/test.go b/test/unit/test.go deleted file mode 100644 index 25324c6fd29a6adfd58c9e4c1bcca59d43132357..0000000000000000000000000000000000000000 --- a/test/unit/test.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import ( - "fmt" - "strings" -) - -func main() { - //urlStr := "http://127.0.0.1:8848/?F=field3&lines=12" - //file := "test/code/test.yaml" - // - //yamlContent, _ := ioutil.ReadFile(file) - //yamlContent = gen.ReplaceSpecialChars(yamlContent) - // - //data := url.Values{"config": {string(yamlContent)}} - //httpUtils.PostForm(urlStr, data) - - a := "我的" - b := "dsfdsfdf是我的吗" - index := strings.Index(a, b) - fmt.Println(index) -} diff --git a/test/unit/test.yaml b/test/unit/test.yaml deleted file mode 100644 index 54385fd93afa7d25c9bed35217a2b837ba78d3a0..0000000000000000000000000000000000000000 --- a/test/unit/test.yaml +++ /dev/null @@ -1,62 +0,0 @@ -title: test -desc: This is a test file. -author: zentao -version: 1.0 - -fields: - - field: field1 - note: 字符区间步长、随机 - range: a-f:R,0-9:2 - format: "%3d" - loop: 3 - loopfix: "," - prefix: "[" - postfix: "] " - - - field: field2 - note: 单词、重复 - range: [bug,task,story]:2{2},[testcase]{2} - postfix: " " - - - field: field3 - note: 引用同级目录中的yaml文件,取small和large两个分组的值 - from: demo/numb.yaml - use: large - postfix: " " - expect: 101,102,103... - - - field: field4 - note: 引用內置IP地址数据定义中的C类地址 - from: system.ip.v1.yaml - use: privateC - postfix: " " - expect: 192.168.0.1 ...​ - - - field: field5 - node: 检索、引用內置城市Excel中的数据 - from: system.address.v1.city - select: name - where: state like '%西藏%' - postfix: " " - expect: 青岛、济南 ...​ - - - field: fieldA - node: 嵌套字段 - fields: - - field: fieldA.1 - type: list - range: 1-999 - postfix: "." - - field: fieldA.2 - prefix: '[' - postfix: ']' - loop: 2 - loopfix: "," - fields: - - field: fieldA.2.1 - type: list - range: X-Z - - field: fieldA.2.2 - type: list - range: 1-9 - loop: 2 diff --git a/test/ztf/_debug.php b/test/ztf/_debug.php deleted file mode 100644 index 4c0872e93579efbb60dba81d8856f55b8f8c6a4e..0000000000000000000000000000000000000000 --- a/test/ztf/_debug.php +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env php - -1) { - $ret = 'zd-amd64.exe'; - } else if (!$is64bit && strpos($os,"win") > -1) { - $ret = 'zd-x86.exe'; - } - - if ($ret == '') { - die('Please test on 64/32 bits windows, 64 bits linux or mac system.\n'); - } else { - print("$ret \n"); - } - - return $ret; -} - -function is64bit() { - $int = "9223372036854775807"; - $int = intval($int); - if ($int == 9223372036854775807) { - /* 64bit */ - return true; - } else if ($int == 2147483647) { - /* 32bit */ - return false; - } else { - /* error */ - return false; - } -} diff --git a/test/ztf/ddl_to_yaml.exp b/test/ztf/ddl_to_yaml.exp deleted file mode 100644 index 509d8337f0db72d97d738bf9076065f255a8f8d9..0000000000000000000000000000000000000000 --- a/test/ztf/ddl_to_yaml.exp +++ /dev/null @@ -1,2 +0,0 @@ ->> 104 ->> field: id \ No newline at end of file diff --git a/test/ztf/ddl_to_yaml.php b/test/ztf/ddl_to_yaml.php deleted file mode 100755 index c4b5d0d552f80c5519bf833f23f4ddb648b8bbb0..0000000000000000000000000000000000000000 --- a/test/ztf/ddl_to_yaml.php +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env php -> - 2. line of id field >> -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -i ../test/definition/_ddl.sql -o ../test/output", $output); -$str = join("\n", $output); -print("$str\n"); - -$content = file_get_contents('../test/output/zt_action.yaml'); -$arr = explode("\n", $content); -$count = sprintf("%d", count($arr)); -print(">> $count\n"); - -$line = $arr[5]; -print(">> $line\n"); \ No newline at end of file diff --git a/test/ztf/excel_src.exp b/test/ztf/excel_src.exp deleted file mode 100644 index e598ee9284cad54313cb24840309d0bcf9a18a9b..0000000000000000000000000000000000000000 --- a/test/ztf/excel_src.exp +++ /dev/null @@ -1 +0,0 @@ ->> '济南市-青岛市-淄博市' \ No newline at end of file diff --git a/test/ztf/excel_src.php b/test/ztf/excel_src.php deleted file mode 100755 index 17c2effbef83fcbeb8cfa22cd7dbcecf4925f0d6..0000000000000000000000000000000000000000 --- a/test/ztf/excel_src.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env php -> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/refer.yaml -c 7 -field excel -o ../test/output/output.txt -f text", $output); -print(">> $output[0]\n"); \ No newline at end of file diff --git a/test/ztf/field_basic.exp b/test/ztf/field_basic.exp deleted file mode 100644 index b3de2383c4081a80b1e35f029e89bf2f3afeeb75..0000000000000000000000000000000000000000 --- a/test/ztf/field_basic.exp +++ /dev/null @@ -1,5 +0,0 @@ ->> Usage: ->> 3 ->> 'a,b,c' ->> output.txt ->> '1,3,5' \ No newline at end of file diff --git a/test/ztf/field_basic.php b/test/ztf/field_basic.php deleted file mode 100755 index 44750500d8e6465db2c817428b8b927b0388b0b6..0000000000000000000000000000000000000000 --- a/test/ztf/field_basic.php +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env php -> - 2. basic output >> - 3. step output >> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -h", $output); -print(">> $output[0]\n"); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 3 -field basic -o ../test/output/output.txt -f text", $output); -$count = sprintf("%d", count($output)); -print(">> $count\n"); -print(">> $output[0]\n"); - -$output = []; -exec('ls ../test/output/output.txt -f text', $output); -print(">> $output[0]\n"); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 7 -field step -o ../test/output/output.txt -f text", $output); -print(">> $output[0]\n"); \ No newline at end of file diff --git a/test/ztf/field_format.exp b/test/ztf/field_format.exp deleted file mode 100644 index 060cb2e6b8b8b434056807d2a79a2439cc6a5516..0000000000000000000000000000000000000000 --- a/test/ztf/field_format.exp +++ /dev/null @@ -1 +0,0 @@ ->> 2, 1.100, char is c \ No newline at end of file diff --git a/test/ztf/field_format.php b/test/ztf/field_format.php deleted file mode 100755 index 0336957237eb73b4edfc27c602754585c5ddefa0..0000000000000000000000000000000000000000 --- a/test/ztf/field_format.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env php -> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/format.yaml -c 3 -field int,float,char -o ../test/output/output.txt -f text", $output); -print(">> $output[1]\n"); \ No newline at end of file diff --git a/test/ztf/field_inherit.exp b/test/ztf/field_inherit.exp deleted file mode 100644 index 3dbe0df2f3f808e60e808e7a32a9c3d92f92cc4e..0000000000000000000000000000000000000000 --- a/test/ztf/field_inherit.exp +++ /dev/null @@ -1,2 +0,0 @@ ->> {a b} ->> ='1,2' '3,4'- \ No newline at end of file diff --git a/test/ztf/field_inherit.php b/test/ztf/field_inherit.php deleted file mode 100755 index b47337bf6d09da08d0deca370288ed3e44b65bc0..0000000000000000000000000000000000000000 --- a/test/ztf/field_inherit.php +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env php -> - 2. inherit from reference field >> -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -d ../test/definition/basic.yaml -y ../test/definition/inherit.yaml -c 3 -field basic -o ../test/output/output.txt -f text", $output); -print(">> $output[0]\n"); - -$output = []; -exec("$cmd -d ../test/definition/refer.yaml -y ../test/definition/inherit.yaml -c 3 -field refer2 -o ../test/output/output.txt -f text", $output); -print(">> $output[0]\n"); \ No newline at end of file diff --git a/test/ztf/field_nested.exp b/test/ztf/field_nested.exp deleted file mode 100644 index b656bd628ebeb2527b3d0586d6404b13f0210b21..0000000000000000000000000000000000000000 --- a/test/ztf/field_nested.exp +++ /dev/null @@ -1 +0,0 @@ ->> 1. 'X12,Y34' \ No newline at end of file diff --git a/test/ztf/field_nested.php b/test/ztf/field_nested.php deleted file mode 100755 index 841c3794f1281b77b47478d84cb619e84fc6b48b..0000000000000000000000000000000000000000 --- a/test/ztf/field_nested.php +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env php -> -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/nested.yaml -c 3 -field nested", $output); -print(">> $output[0]\n"); \ No newline at end of file diff --git a/test/ztf/field_random.exp b/test/ztf/field_random.exp deleted file mode 100644 index 2e8b12ee56a90ff3708975dd985ae70345405738..0000000000000000000000000000000000000000 --- a/test/ztf/field_random.exp +++ /dev/null @@ -1,2 +0,0 @@ ->> 6 ->> is random \ No newline at end of file diff --git a/test/ztf/field_random.php b/test/ztf/field_random.php deleted file mode 100755 index 57ccfe6a0bf1ca2ae0890dbd8eb9273b7149c5b8..0000000000000000000000000000000000000000 --- a/test/ztf/field_random.php +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env php -> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 7 -field random -o ../test/output/output.txt -f text", $output); -$line = $output[0]; -print("Got $line\n"); - -// 1,2,2,2,8,1 -$numbs = explode(",", $line); -$count = sprintf("%d", count($numbs)); -print(">> $count\n"); - -$result = 'not random'; -$i = 0; -for($i = 0; $i < $count; $i++) { - if ($numbs[$i] != $i + 1) { // at lease one not equal sequence numb 1,2,3,4,5,6 - $result = 'is random'; - break; - } -} -print(">> $result\n"); \ No newline at end of file diff --git a/test/ztf/field_refer.exp b/test/ztf/field_refer.exp deleted file mode 100644 index 46781730832b216490856b803e2d83eda57920eb..0000000000000000000000000000000000000000 --- a/test/ztf/field_refer.exp +++ /dev/null @@ -1 +0,0 @@ ->> 192.168.0.1 \ No newline at end of file diff --git a/test/ztf/field_refer.php b/test/ztf/field_refer.php deleted file mode 100755 index 25e71379b94778795b70000af865e1de85927ed6..0000000000000000000000000000000000000000 --- a/test/ztf/field_refer.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env php -> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/refer.yaml -c 7 -field refer -o ../test/output/output.txt -f text", $output); -print(">> $output[0]\n"); \ No newline at end of file diff --git a/test/ztf/field_repeat.exp b/test/ztf/field_repeat.exp deleted file mode 100644 index 945c791a11dc23d6385f372b1792d3ae85e8dae3..0000000000000000000000000000000000000000 --- a/test/ztf/field_repeat.exp +++ /dev/null @@ -1 +0,0 @@ ->> story 1.0 create \ No newline at end of file diff --git a/test/ztf/field_repeat.php b/test/ztf/field_repeat.php deleted file mode 100755 index 53a97a805133ac3d73693d95fda038398e82e8ed..0000000000000000000000000000000000000000 --- a/test/ztf/field_repeat.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env php -> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/repeat.yaml -c 7 -o ../test/output/output.txt -f text", $output); -print(">> $output[3]\n"); \ No newline at end of file diff --git a/test/ztf/output_style.exp b/test/ztf/output_style.exp deleted file mode 100644 index 65fc6185895b2981607a9de2fa1ec74ce09f6418..0000000000000000000000000000000000000000 --- a/test/ztf/output_style.exp +++ /dev/null @@ -1,5 +0,0 @@ ->> 4 ->> a1 ->> a ->> INSERT INTO (char,numb) VALUES('a','1'); ->> a \ No newline at end of file diff --git a/test/ztf/output_style.php b/test/ztf/output_style.php deleted file mode 100755 index eeccb0e9df306db34a37b917529f434040e0ece1..0000000000000000000000000000000000000000 --- a/test/ztf/output_style.php +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env php -> - 2. value from text >> - 3. value from json >> - 4. value from xml >> - 5. first line of sql >> - -[esac] -*/ - -include_once __DIR__ . DIRECTORY_SEPARATOR . '_utils.php'; -$cmd = getZDCmd(); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.txt -f text", $output); -$content = file_get_contents('../test/output/output.txt'); -$arr = explode("\n", $content); -$count = sprintf("%d", count($arr)); -print(">> $count\n"); -print(">> $arr[0]\n"); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.json -f json", $output); -$content = file_get_contents('../test/output/output.json'); -$json = json_decode($content); -$val = $json[0][0]; -print(">> $val\n"); - -$output = []; -exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.sql -f sql", $output); -$content = file_get_contents('../test/output/output.sql'); -$arr = explode("\n", $content); -print(">> $arr[0]\n"); - -if (!function_exists('simplexml_load_file')) { - print("lib simplexml_load_file missing, pls use 'sudo apt-get install php7.0-simplexml' to install\n"); -} else { - $output = []; - exec("$cmd -y ../test/definition/basic.yaml -c 3 -field char,numb -o ../test/output/output.xml -f xml", $output); - $xml = simplexml_load_file('../test/output/output.xml'); // sudo apt-get install php7.0-simplexml - $val = $xml->table->row->col[0]; - print(">> $val\n"); -} diff --git a/xdoc/1-build-mac.sh b/xdoc/1-build-mac.sh index 27b5674bde9847715aafcc891661d05d46ce0c73..5b183877dc7a0c4bcb533ca2204ba5502d21a5fc 100755 --- a/xdoc/1-build-mac.sh +++ b/xdoc/1-build-mac.sh @@ -1,7 +1,5 @@ rm -rf build mkdir build -cp -r data build/ -cp -r demo build/ go-bindata -o=res/res.go -pkg=res res/ res/doc diff --git a/xdoc/4-build.sh b/xdoc/4-build.sh index e4e3397c4963d179be25865ff693bef93c44f6a5..1de8aa1b239ab8c8337ad747f624784a15f935f9 100755 --- a/xdoc/4-build.sh +++ b/xdoc/4-build.sh @@ -1,19 +1,45 @@ +cp -r data build/ +rm -rf build/data/system/domain +rm -rf build/data/system/email +rm -rf build/data/system/misc +rm -rf build/data/system/name + +cp -r demo build/ +rm -rf build/demo/out + cd build +rm -rf zendata +mkdir -p zendata/1.1 +mkdir -p zendata/1.1/win32 +mkdir -p zendata/1.1/win64 +mkdir -p zendata/1.1/linux +mkdir -p zendata/1.1/mac + cp zd-x86.exe zd.exe -zip -r zd-win-x86-1.1.zip zd.exe data demo +zip -r zd.zip zd.exe data demo +cp zd.zip zendata/1.1/win32 rm zd.exe +rm zd.zip cp zd-amd64.exe zd.exe -zip -r zd-win-amd64-1.1.zip zd.exe data demo +zip -r zd.zip zd.exe data demo +cp zd.zip zendata/1.1/win64 rm zd.exe +rm zd.zip cp zd-linux zd -tar -zcvf zd-linux-1.1.tar.gz zd data demo +tar -zcvf zd.tar.gz zd data demo +cp zd.tar.gz zendata/1.1/linux rm zd +rm zd.tar.gz cp zd-mac zd -zip -r zd-mac-1.1.zip zd data demo +zip -r zd.zip zd data demo +cp zd.zip zendata/1.1/mac rm zd +rm zd.zip + +zip -r zendata-1.1.zip zendata cd .. \ No newline at end of file