logo
0
0
WeChat Login

Gen

通用代码生成器,可支持自定义模板

Installation

go install e.coding.net/dengjq/go/gen

Usage

gen ddl config.json

Configuration File

How does the simplest configuration file look like?

{
  "db_type": "postgres",
  "dsn": "",
  "schema": "aaa",
  "show_sql": false,
  "name": "djq_hehe",
  "attrs": "id\tcreate_time\tname",
  "comments": "id\t创建时间\t名称",
  "values": "6\t2024/10/24 22:23\t名称1",
  "targets": [
    {
      "output_dir": "output/aaa/markdown",
      "file_name_template": "{{Name}}.md",
      "template_file": "template/markdown.tmpl",
      "package": "model",
      "reference_package": "",
      "is_force": true
    },
    {
      "output_dir": "output/aaa/xorm",
      "file_name_template": "{{NameUpper}}.go",
      "template_file": "template/go-xorm.tmpl",
      "package": "model",
      "reference_package": "",
      "is_force": true
    },
    {
      "output_dir": "output/aaa/jpa",
      "file_name_template": "{{NameUpper}}.java",
      "template_file": "template/java-jpa.tmpl",
      "package": "com.example.javatest.entity",
      "is_force": true
    },
    {
      "output_dir": "output/aaa/jpa-dao",
      "file_name_template": "{{NameUpper}}Dao.java",
      "template_file": "template/java-jpa-dao.tmpl",
      "package": "com.example.javatest.dao",
      "reference_package": "com.example.javatest.entity",
      "is_force": true
    }
  ]
}

About

代码生成器

415.00 KiB
0 forks0 stars1 branches11 TagREADMEBSD-3-Clause license
Language
Go87.9%
Java12.1%