You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
常用命令
api demo 代码生成
# 创建工作空间并进入该目录
$ mkdir -p ~/workspace/api && cd ~/workspace/api
# 执行指令生成 demo 服务
$ goctl api new demo
Done.
gRPC demo 代码生成
# 创建工作空间并进入该目录
$ mkdir -p ~/workspace/rpc && cd ~/workspace/rpc
# 执行指令生成 demo 服务
$ goctl rpc new demo
Done.
mysql 代码生成
- user.sql
CREATE TABLE user (
id bigint AUTO_INCREMENT,
name varchar(255) NULL COMMENT 'The username',
password varchar(255) NOT NULL DEFAULT '' COMMENT 'The user password',
mobile varchar(255) NOT NULL DEFAULT '' COMMENT 'The mobile phone number',
gender char(10) NOT NULL DEFAULT 'male' COMMENT 'gender,male|female|unknown',
nickname varchar(255) NULL DEFAULT '' COMMENT 'The nickname',
type tinyint(1) NULL DEFAULT 0 COMMENT 'The user type, 0:normal,1:vip, for test golang keyword',
create_at timestamp NULL,
update_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE mobile_index (mobile),
UNIQUE name_index (name),
PRIMARY KEY (id)
) ENGINE = InnoDB COLLATE utf8mb4_general_ci COMMENT 'user table';
goctl model mysql ddl --src user.sql --dir .