Code Monkey home page Code Monkey logo

yggdrasill's Introduction

中文简介
English

yggdrasill 把数据库的表转换成go语言的struct,支持 PostgreSQL, MySQL
eg:
generat model

安装

安装到GOPATHbin目录.

GO111MODULE=on go get -u github.com/lpxxn/yggdrasill/cmd/yggdrasill

帮助

yggdrasill -help 
Usage of yggdrasill:
  -dir string
        Destination dir for files generated. (default "./tmp")
  -dsn string
        dsn (default "postgresql")
  -package_name string
        package name default model. (default "model")
  -table_names value
        if it is empty, will generate all tables in database
  -target string
        mysql postgresql[pg] (default "postgresql")
  -template_path string
        custom template file path

命令

MySql

-targetmysql 默认生成数据库内的所有表

yggdrasill -target=mysql -dsn="root:123456@tcp(127.0.0.1:3306)/test" 

也可以生成指定表,使用 -table_names 指定想生成的表

yggdrasill -target=mysql -dsn="root:123456@tcp(127.0.0.1:3306)/test" -table_names=employee -table_names=user

PostgreSql

-targetpostgresql或者pg 默认生成数据库内的所有表

yggdrasill -target=pg -dsn="postgres://:@127.0.0.1:5432/test?sslmode=disable"

使用 -table_names 指定想生成的表

yggdrasill -target=pg -dsn="root:123456@tcp(127.0.0.1:3306)/test" -table_names=employee -table_names=user

自定义 template 使用 -template_path 自定义模板

yggdrasill  -target=pg -dsn="postgres://:@127.0.0.1:5432/test?sslmode=disable" -package_name=db_model -template_path=../../test/test_template.tml 

yggdrasill's People

Contributors

lpxxn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yggdrasill's Issues

mysql生成后没有文件

➜ model git:(master) ✗ yggdrasill -target=mysql -dsn="root:mysql@tcp(localhost:3306)/dev"
MySQL Connecting dsn : root:mysql@tcp(localhost:3306)/dev
generate finished...
➜ model git:(master) ✗ ll ./tmp
➜ model git:(master) ✗

文件夹里空的

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.