setting

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// go files
	GoMainFileTmpl = "main.go.tmpl"
	GoMainFile     = "main.go"
	GoFileSuffix   = ".go"
	ConfigFile     = "config.yml"
	// Iteration
	IterationFileTmpl = "iteration"
	// template
	InternalTmplDir = "templates"
	SyncDir         = "sync"
	// directive
	DirectiveSync Directive = "ardan:sync"
	DirectiveGen  Directive = "ardan:gen"
)

Variables

View Source
var (
	ErrDirectiveNone = errors.New("Directive is none")
	ErrFilenameNone  = errors.New("Filename is null")
)

Functions

func KebabCase added in v0.3.0

func KebabCase(name string) string

func SnakeCase added in v0.3.0

func SnakeCase(name string) string

Types

type Directive

type Directive = string

type GenSet added in v0.2.0

type GenSet struct {
	// Directive  string
	Repository       string
	ServiceInterface string
	Service          string
	Controller       string
}

type GenType added in v0.3.0

type GenType uint8

GenType generate code type

const (
	GenTypeAll              GenType = iota // all
	GenTypeQuery                           // query
	GenTypeRepository                      // repository
	GenTypeServiceInterface                // service interface
	GenTypeService                         // service
	GenTypeController                      // controller
)

func (GenType) String added in v0.3.0

func (i GenType) String() string

type Options

type Options struct {
	TmplDir   string
	OutputDir string
	FuncMap   template.FuncMap
	DBDriver  string // database driver name
	DBName    string // database name
	DBConnStr string // database connection string
	GoModName string
	Config    string // config file
	// project layout
	CmdDir          string // command root directory
	DocDir          string // documents root directory
	AppDir          string // application layer directory
	ModelDir        string // domain layer directory
	ServiceDir      string // service layer directory
	RepositoryDir   string // repository layer directory
	ServerDir       string // server layer directory
	ServerModuleDir string // server module directory
	ServerGlobalDir string // server global directory
	ControllerDir   string // controller directory
	HandlerDir      string // handler directory
	MiddlewareDir   string // middleware directory
	Sample          bool
}

Options setting options

type Setting

type Setting struct {
	Template   *template.Template
	FileSystem http.FileSystem
	Origins    []string // origin files
	Layouts    []string // project layout dir names
	Codes      []string // source code names
	Gens       []string // gen code names
	Samples    []string // sample names
	DBDriver   string   // database driver name
	DBName     string   // database name
	DBConnStr  string   // database connection string
	GoMod      string
	// layout
	InternalTmplDir string // internal template dir
	TmplDir         string // template dir
	Output          string // output root dir
	Cmd             string // cmd dir
	Sync            string // sync dir
	Doc             string // documents root directory
	App             string // application dir
	Model           string // domain layer directory
	Query           string // domain layer query directory
	Service         string // service layer directory
	Repository      string // repository layer directory
	Server          string // server layer directory
	ServerModule    string // server module directory
	ServerGlobal    string // server global directory
	Controller      string // controller directory
	Handler         string // handler directory
	Middleware      string // middleware directory
	Sample          bool
}

func New

func New(opt Options) *Setting

New init settings

func (*Setting) HasDirective added in v0.1.9

func (s *Setting) HasDirective(doc, directive string) (string, bool)

func (*Setting) HasPrefix added in v0.1.7

func (s *Setting) HasPrefix(path, layout string) bool

func (*Setting) IsController added in v0.2.0

func (s *Setting) IsController(path string) bool

func (*Setting) IsIteration added in v0.2.0

func (s *Setting) IsIteration(path string) bool

func (*Setting) IsQuery added in v0.3.0

func (s *Setting) IsQuery(path string) bool

func (*Setting) IsRepository added in v0.2.0

func (s *Setting) IsRepository(path string) bool

func (*Setting) IsService added in v0.2.0

func (s *Setting) IsService(path string) bool

func (*Setting) ParseDirectiveGen added in v0.2.0

func (s *Setting) ParseDirectiveGen(doc string) (*GenSet, error)

func (*Setting) SlashPath added in v0.3.5

func (s *Setting) SlashPath(path string) string

func (*Setting) SourceFile added in v0.1.7

func (s *Setting) SourceFile(srcname string) string

func (*Setting) TargetFile

func (s *Setting) TargetFile(srcname string, replName ...string) string

func (*Setting) TmplFile added in v0.1.9

func (s *Setting) TmplFile(path ...string) string

type TmplType

type TmplType = string
const (
	TmplTypeOrigin TmplType = ".orig"
	TmplTypeCode   TmplType = ".tmpl"
	TmplTypeView   TmplType = ".tmpl"
	TmplTypeSample TmplType = ".samp"
	TmplTypeBuild  TmplType = ".ardan"
	TmplTypeGen    TmplType = ".gen"
)

Jump to

Keyboard shortcuts

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