Giter VIP home page Giter VIP logo

gcg's Introduction

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

gcg's People

Contributors

cinos1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.