orm

command module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

orm

快速开始

  • YAML 定义数据结构
version: v1
object: table
name: user
comment: ""
attributes:
  table: user
  engine: innodb
  charset: utf8mb4
tags:
  - json
  - yaml
fields:
  - name: id
    type: int32
    comment: name of Hello
    attributes:
      autoIncrement: true
  - name: name
    type: string
    comment: name of Hello
    attributes:
      primary: true
      index: true
  - name: Age
    type: int32
    comment: age of Hello
    attributes:
      nullable: true
  - name: Sex
    type: bool
    attributes:
      dbtype: TINYINT
  - name: FooBar
    type: int32
    comment: fooBar
    tags:
      json: foo
      yaml: bar
    attributes:
      nullable: true
  - name: CreateAt
    type: datetime
    comment: create_at
  - name: UpdateAt
    type: datetime
    comment: update_at
    attributes:
      nullable: true
uniques:
  - fields:
      - name
indexes:
  - fields:
      - age
      - sex
primary:
  - id
---
version: v1
object: query
name: summary
tags:
  - json
  - yaml
fields:
  - name: id
    type: int32
    comment: name of Hello
    attributes:
      autoIncrement: true
  - name: name
    type: string
    comment: name of Hello
    attributes:
      primary: true
      index: true
  - name: Age
    type: int32
    comment: age of Hello
    attributes:
      nullable: true
  - name: Sex
    type: bool
    attributes:
      dbtype: TINYINT
  • 命令生成代码与脚本
$: orm -h
Usage:
  orm [command]

Available Commands:
  code        code command
  decode      orm decode string
  encode      orm encode string
  help        Help about any command
  password    orm password string
  script      script command

Flags:
  -p, --go-package-name string   go package name (default "model")
  -h, --help                     help for orm
  -i, --input string             input directory (default ".")
  -o, --output string            output directory (default ".")
  -t, --template-suffix string   template suffix (default ".gogo")
      --version                  version for orm
  -c, --workdir string           orm workdir (default: $HOME/.orm)

Use "orm [command] --help" for more information about a command.

修改模板

安装 orm 命令后,完成首次代码生成后,默认代码生成模板文件会安装到 $HOME/.orm 文件夹。

用户可以根据自己的需求修改代码生成模板实现个性化配置。

生成 Golang 代码

$: orm -i ./examples -o ./examples/model code golang

生成 Mysql 脚本

$: orm -i ./examples -o ./examples/mysql script mysql

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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