reverse/example/custom.yml
Jerry c2a874ad2b
All checks were successful
continuous-integration/drone/push Build is passing
template add generate TableName() func (#13)
template add table_name option: true or false

template add generate TableName() func

Co-authored-by: Jerry <85411418@qq.com>
Reviewed-on: #13
2020-06-18 07:43:01 +00:00

37 lines
742 B
YAML

kind: reverse
name: mydb
source:
database: sqlite
conn_str: ../testdata/test.db
targets:
- type: codes
language: golang
include_tables:
- a
- b
exclude_tables:
- c
table_mapper: snake
column_mapper: snake
table_prefix: ""
multiple_files: true
table_name: true
template: |
package models
{{$ilen := len .Imports}}
{{if gt $ilen 0}}
import (
{{range .Imports}}"{{.}}"{{end}}
)
{{end}}
{{range .Tables}}
type {{TableMapper .Name}} struct {
{{$table := .}}
{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{ColumnMapper $col.Name}} {{Type $col}} `{{Tag $table $col}}`
{{end}}
}
{{end}}
template_path: ./template/goxorm.tmpl
output_dir: ./models