GithubHelp home page GithubHelp logo

duck's Introduction

duck

sql to struct with gorm tag

usage

$ duck -h

Specify the table name, generate struct according to the field

Usage:
  duck [flags]
  duck [command]

Available Commands:
  help        Help about any command
  init        Generate configuration file

Flags:
      --config string   config file (default is ./duck_config.toml)
  -h, --help            help for duck
  -n, --name string     table_name (default "country")
  -s, --schema string   table_schema (default "world")

e.g.

$ duck -s world -n country

type Country struct {
    Code              string    `gorm:"column:Code"`
    Name              string    `gorm:"column:Name"`
    Continent         string    `gorm:"column:Continent"`
    Region            string    `gorm:"column:Region"`
    SurfaceArea       string    `gorm:"column:SurfaceArea"`
    IndepYear         int32     `gorm:"column:IndepYear"`
    Population        int64     `gorm:"column:Population"`
    LifeExpectancy    string    `gorm:"column:LifeExpectancy"`
    GNP               string    `gorm:"column:GNP"`
    GNPOld            string    `gorm:"column:GNPOld"`
    LocalName         string    `gorm:"column:LocalName"`
    GovernmentForm    string    `gorm:"column:GovernmentForm"`
    HeadOfState       string    `gorm:"column:HeadOfState"`
    Capital           int64     `gorm:"column:Capital"`
    Code2             string    `gorm:"column:Code2"`
}

func (t *Country) TableName() string {
	return "country"
}

duck's People

Contributors

lysander66 avatar

Stargazers

somewheve 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.