parser

package
v0.0.0-...-969569d Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 17 Imported by: 0

README

gihub.com/dejavuzhou/ginbro/parser package

function

  1. fetch Mysql database schema
  2. parse golang code file template with database schema

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dst string) (err error)

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

Types

type ParseEngine

type ParseEngine struct {
	OutPath       string
	OutPackage    string
	MysqlAddr     string
	MysqlUser     string
	MysqlPassword string
	MysqlDatabase string
	MysqlCharset  string
	AppSecret     string
	AppListen     string
	Tables        []*schema
	AuthTable     string
	AuthPassword  string
	// contains filtered or unexported fields
}

ParseEngine parser engine

func NewGuiParseEngine

func NewGuiParseEngine(mysqlUser, mysqlPassword, mysqlAddr, mysqlDatabase, mysqlCharset, outDir, appListen, authTable, authColumn string) (*ParseEngine, error)

NewParseEngine create a parser engine

func NewParseEngine

func NewParseEngine(mysqlUser, mysqlPassword, mysqlAddr, mysqlDatabase, mysqlCharset, outDir, appListen, authTable, authColumn string) *ParseEngine

func (*ParseEngine) BareDatabaseSchema

func (p *ParseEngine) BareDatabaseSchema() error

BareDatabaseSchema create a bare project

func (*ParseEngine) Close

func (p *ParseEngine) Close()

Close the mysql database

func (*ParseEngine) GenerateGormModel

func (p *ParseEngine) GenerateGormModel()

GenerateGormModel just generate GORM model file

func (*ParseEngine) GenerateProjectCode

func (p *ParseEngine) GenerateProjectCode()

GenerateProjectCode generate go models and handlers file

func (*ParseEngine) GoFmt

func (p *ParseEngine) GoFmt()

GoFmt run gofmt for the generated project

func (*ParseEngine) ParseDatabaseSchema

func (p *ParseEngine) ParseDatabaseSchema() error

ParseDatabaseSchema get MySQL database schema

func (*ParseEngine) SaveFlagsToUserConfigFile

func (p *ParseEngine) SaveFlagsToUserConfigFile() error

SaveFlagsToUserConfigFile write flags value to viper config file

Jump to

Keyboard shortcuts

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