package client var MARK_DOWN = `###项目介绍 ####特性: - xml配置RESTfull API、业务涉及的结构体(Bean)、数据库表结构。自动生成项目结构,形成开发规范 - 自动化生成RESTfull API,绑定相关参数,不需要关心网络参数及返回相关的编码。 - Bean生成通过配置形成生成,支持类型继承,自动将继承参数复制到新的结构体 - 支持SqlMap,自动根据数据库结构生成。 - 技术栈使用gin+xormplus ###开发准备 - 1 请将以上go代码复制到: {!}{!}{!}$GOPATH/{project_name}/main.go{!}{!}{!} - 2 下载依赖包: - git clone https://git.qianqiusoft.com/qianqiusoft/light-apiengine.git $GOPATH/src/git.qianqiusoft.com/qianqiusoft/light-apiengine git clone https://git.qianqiusoft.com/qianqiusoft/light-apiengine-client.git $GOPATH/src/git.qianqiusoft.com/qianqiusoft/light-apiengine-client - 3 {!}{!}{!}cd $GOPATH/light-hello; go get && go build[code]{!}{!}{!} - 4 执行light-hello文件 {!}{!}{!}./{project_name}{!}{!}{!} - 5 程序自动生成相关项目文件,取消main.go两处注释即可 {!}{!}{!} package main import ( //生成代码后请手动取消此处注释 //"{project_name}/routers" _ "github.com/go-sql-driver/mysql" "git.qianqiusoft.com/qianqiusoft/light-apiengine/engine" sysrouters "git.qianqiusoft.com/qianqiusoft/light-apiengine/routers" "git.qianqiusoft.com/qianqiusoft/light-apiengine-client/client" "git.qianqiusoft.com/qianqiusoft/light-apiengine/config" ) func main() { if config.AppConfig.RunMode != "release" { go client.NewEngineClient("{project_name}").GenerateCurrentProject() } if config.AppConfig.RunMode != "gen" { apiengine := engine.Default() sysrouters.InitRouter(apiengine) //生成代码后请手动取消此处注释 routers.InitRouter(apiengine) apiengine.Run() } } {!}{!}{!} ###开发项目 配置文件: {!}{!}{!}{project_name}.xml{!}{!}{!} 生成文件当中,以{!}{!}{!}_gen.go{!}{!}{!}结尾的文件都会被覆盖,请不要手动更改文件,如果开发过程中发现必须改这个文件的,可以提出来修改代码生成框架。 ###RESTful API配置 {!}{!}{!} {!}{!}{!} ###数据库表格配置 {!}{!}{!}
{!}{!}{!} 代码生成器将会生成以下结构体代码: {!}{!}{!} type Hello struct { //主键 Id string {!}xorm:"'id' varchar(36) pk notnull "json:"id"{!} //用户ID UserId string {!}xorm:"'user_id' varchar(36) notnull "json:"user_id"{!} //域 Domain string {!}xorm:"'domain' varchar(50) notnull "json:"domain"{!} //创建人 CreateBy string {!}xorm:"'create_by' varchar(36) notnull "json:"create_by"{!} //创建时间 CreateTime time.Time {!}xorm:"'create_time' notnull "json:"create_time"{!} //最后更新人 LastUpdateBy string {!}xorm:"'last_update_by' varchar(36) notnull "json:"last_update_by"{!} //最后更新时间 LastUpdateDate time.Time {!}xorm:"'last_update_date' notnull "json:"last_update_date"{!} //是否删除 0:删除 1:正常 DelFlag int32 {!}xorm:"'del_flag' notnull "json:"del_flag"{!} } {!}{!}{!} ###业务Bean配置 {!}{!}{!} {!}{!}{!} - 支持继承功能,如: {!}{!}{!} {!}{!}{!} 其中:{!}{!}{!}inher="$hello"{!}{!}{!}表示继承自Hello这个结构体,属性{!}{!}{!}children{!}{!}{!}的{!}{!}{!}type="string array"{!}{!}{!}表示string数组{!}{!}{!}[]string{!}{!}{!}将会生成以下代码: {!}{!}{!} type MyBean struct { //helloworld Id string {!}json:"id"{!} //helloworld Name string {!}json:"name"{!} //id Prpo1 string {!}json:"prpo1"{!} //name Children []MyBean {!}json:"children"{!} } {!}{!}{!} ###内置功能 ###数据库配置 - 1.打开config/app.conf - 2.配置数据源datasource结点 - 注意:运行程序,程序会自动根据连接串连接到数据库并创建相关的表结构 ###Docker发布镜像 - 更改app.conf字段 runmode = release - 运行./build_docker.sh `