Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/openingo/jdkits
Java Develop Common Kits
https://github.com/openingo/jdkits
jdk kits
Last synced: about 1 month ago
JSON representation
Java Develop Common Kits
- Host: GitHub
- URL: https://github.com/openingo/jdkits
- Owner: openingo
- License: other
- Created: 2020-05-15T06:33:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T01:27:00.000Z (about 2 years ago)
- Last Synced: 2024-10-12T15:42:07.062Z (about 1 month ago)
- Topics: jdk, kits
- Language: Java
- Size: 315 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jdkits
Java Develop Common Kits![maven](https://img.shields.io/maven-central/v/org.openingo.kits/jdkits.svg)
```xml
org.openingo.kits
jdkits
new_version```
### DDLKit使用
> 默认使用InnoDB
##### 创建一个VARCHAR Column
```java
DDLKit.createColumn("name", DDLKit.VARCHAR, "名字", 20, "");
```也可以这样
```java
DDLKit.createVarcharColumn("name", "名字", 20, "");
```##### 创建一个INT Column
```java
DDLKit.createIntColumn("age", "年龄", 4, 1);
```##### 创建有符号的 INT Column
```java
DDLKit.createSignedIntColumn("age", "年龄", 4, 1);
```##### 修改DDL charset
```java
DDLKit.Table table = DDLKit.createTable("user", "用户");
table.setCharset(DDLKit.CHARSET_UTF8);
table.addColumns(columns);
String ddl = table.tableDDL();
```> - DDLKit.CHARSET_UTF8 -> utf8
>
> - DDLKit.CHARSET_UTF8MB4 -> utf8mb4##### 示例
```java
List columns = new ArrayList<>();DDLKit.Column name = DDLKit.createColumn("name", DDLKit.VARCHAR, "名字", 20, "");
columns.add(name);
DDLKit.Column age = DDLKit.createSignedTinyIntColumn("age", "年龄", 4, 1);
columns.add(age);
DDLKit.Column addr = DDLKit.createColumn("addr", DDLKit.VARCHAR, "地址", 4, "");
columns.add(addr);DDLKit.Table table = DDLKit.createTable("user", "用户");
table.setCharset(DDLKit.CHARSET_UTF8);
table.addColumns(columns);
String ddl = table.tableDDL();
``````sql
CREATE TABLE `user` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '索引',
`name` varchar(20) DEFAULT NULL COMMENT '名字',
`age` tinyint(4) NOT NULL DEFAULT '1' COMMENT '年龄',
`addr` varchar(4) DEFAULT NULL COMMENT '地址',
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COMMENT='用户';
```