gen

package
v0.0.0-...-d12e05a Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:   "gen",
	Usage:  "gen template code with database",
	Flags:  flags,
	Action: action,
}

Functions

func GenGoImports

func GenGoImports(cols []Column) []string

func ReadDir

func ReadDir(name string, isEmbed bool) ([]fs.DirEntry, error)

func ReadFile

func ReadFile(name string, isEmbed bool) ([]byte, error)

Types

type Column

type Column struct {
	TableName    string
	Name         string
	SQLType      string
	Comment      string
	IsPrimaryKey bool
}

type Config

type Config struct {
	DS     *DS
	Target *ReverseTarget
}

Config config file

type Custom

type Custom struct {
	TemplateDir string            `yaml:"template-dir"`
	OutDir      string            `yaml:"out-dir"`
	Var         map[string]string `yaml:"var"`
	TagName     string            `yaml:"tag-name"`
}

type DS

type DS struct {
	Type string
	Dsn  string
}

type ReverseTarget

type ReverseTarget struct {
	Custom *Custom
	Tables map[string]TableVar
}

type Table

type Table struct {
	Name          string
	StructName    string
	Columns       []Column
	PrimaryKey    Column
	AutoIncrement bool
	Comment       string
	StoreEngine   string
	GoImports     []string
}

Table represents a database table

type TableVar

type TableVar map[string]string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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