gcg

command module
v0.0.0-...-ed667ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

gcg

go 代码生成工具 基于sqlx echo mysql

go code generater based on sqlx echo by mysql

install

go get github.com/guoanfamily/gcg

use

  1. create a folder in go src folder named with your projectname
mkdir projectname
cd projectname
  1. create a config.yaml file and edit it like this:
- Name: service
  Database: mysql
  Username: root
  Password: ""
  Host: localhost
  Port: 3306
  Table: "company_info,ebook"
  ServicePort: 9091

3.init the project use command in your project folder

gcg init [-config=config.yaml]

4.the file struct like this

projectname
--controller
----controller.go
----gen_table.go
--model
----service
------gen_table.go
------gen_db.go
--router
----gen_table.go
----router.go
--main.go

5.run the project

go run main.go

6.additional command

if you want add table in your exist project,just run ,split tablename with ','

gcg add [-tables=tablename1,tablename2]

and then add this code in your router.go file

{{tablename}}Add(e)
//start server

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
gens
orm
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL