model

package
v0.0.0-...-668b247 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DomainTmpl = `` /* 731-byte string literal not displayed */
View Source
const GoModTmpl = `module {{ . }}

go 1.18

`
View Source
const RepositoryTmpl = `` /* 1433-byte string literal not displayed */
View Source
const ServiceTmpl = `` /* 1689-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DBConfig DBConfig `toml:"db" yaml:"db"`
	Tables   []Table  `toml:"tables" yaml:"tables"`
}

type DBConfig

type DBConfig struct {
	DBName   string `toml:"db-name" yaml:"db-name"`
	Host     string `toml:"host" yaml:"host" default:"localhost"`
	Port     int    `toml:"port" yaml:"port" default:"3306"`
	User     string `toml:"user" yaml:"user"`
	Password string `toml:"password" yaml:"password"`
}

func ReadDBConfig

func ReadDBConfig(path string) (*DBConfig, error)

func (*DBConfig) DSN

func (c *DBConfig) DSN() string

type DomainTmplText

type DomainTmplText struct {
	PkgName        string
	ImportPkgPaths []string
	StructName     string
	Struct         string
}

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(projectPath, moduleName string) *Generator

func (*Generator) Gen

func (g *Generator) Gen(configPath string) error

func (*Generator) GenDomain

func (g *Generator) GenDomain(tables map[string][]Table) error

func (*Generator) GenGoMod

func (g *Generator) GenGoMod() error

func (*Generator) GenModel

func (g *Generator) GenModel(dbConfig DBConfig, tables map[string][]Table) error

func (*Generator) GenServiceFile

func (g *Generator) GenServiceFile(pkgName, structName string) error

type RepositoryTmplText

type RepositoryTmplText struct {
	PkgName        string
	ImportPkgPaths []string
	DomainPkgName  string
	StructName     string
}

type ServiceTmplText

type ServiceTmplText struct {
	PkgName        string
	ImportPkgPaths []string
	StructName     string
}

type Table

type Table struct {
	Name        string `toml:"name" yaml:"name"`
	StructName  string `toml:"struct-name" yaml:"struct-name"`
	PackageName string `toml:"package-name" yaml:"package-name"`
}

Jump to

Keyboard shortcuts

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