generate

package
v0.0.0-...-8f6fd8a Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FuncType_CreateBefore   = "CreateBefore"
	FuncType_CreateTxBefore = "CreateTxBefore"
	FuncType_CreateTxAfter  = "CreateTxAfter"
	FuncType_CreateAfter    = "CreateAfter"
	FuncType_UpdateBefore   = "UpdateBefore"
	FuncType_UpdateTxBefore = "UpdateTxBefore"
	FuncType_UpdateTxAfter  = "UpdateTxAfter"
	FuncType_UpdateAfter    = "UpdateAfter"
	FuncType_InfoBefore     = "InfoBefore"
	FuncType_InfoAfter      = "InfoAfter"
	FuncType_ListBefore     = "ListBefore"
	FuncType_ListAfter      = "ListAfter"
	FuncType_DeleteBefore   = "DeleteBefore"
	FuncType_DeleteTxBefore = "DeleteTxBefore"
	FuncType_DeleteTxAfter  = "DeleteTxAfter"
	FuncType_DeleteAfter    = "DeleteAfter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr struct {
	Name      string
	Type      string
	CtxFunc   string
	IToM      string
	JSON      string
	Enums     string
	MaxLength string
	MinLength string
	Max       string
	Min       string
	Params    string
	Desc      string
}

func (Attr) Param

func (a Attr) Param(t string) string

Param 获取接口文档参数说明

type File

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

type Func

type Func struct {
	Name     string
	Sort     int64
	Includes map[string]int64
	Excludes map[string]struct{}
}

func (Func) Check

func (f Func) Check(n string) *MFunc

type Generator

type Generator struct {
	Pkg     *Package
	Project string

	Output string
	Debug  bool

	TrimPrefix  string
	LineComment bool
	Template    string

	Func map[string][]Func // 所有的ModelController都需要的方法
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(gonum int, trimprefix, output string, linecomment, debug bool, template string) *Generator

func (*Generator) AddPackage

func (g *Generator) AddPackage(pkg *packages.Package)

func (*Generator) Generate

func (g *Generator) Generate()

func (*Generator) ParsePackage

func (g *Generator) ParsePackage(patterns []string, tags []string)

type MFunc

type MFunc struct {
	Name string
	Sort int64
}

type MFuncs

type MFuncs []MFunc

func (MFuncs) Len

func (m MFuncs) Len() int

func (MFuncs) Less

func (m MFuncs) Less(i, j int) bool

func (MFuncs) Swap

func (m MFuncs) Swap(i, j int)

type Mapper

type Mapper struct {
	File    *File
	Name    string
	Attr    []Attr
	DBIndex string
	API     string
}

Value represents a declared constant.

func (Mapper) Render

func (m Mapper) Render() Render

type Package

type Package struct {
	Name string
	Path string
	// contains filtered or unexported fields
}

type Render

type Render struct {
	Args        string
	PackageName string
	Project     string
	Name        string
	DBIndex     string
	Desc        string

	Create           bool
	CreateSave       bool
	CreateParams     []Attr
	CreateParamsDecs []string
	CreateBefore     []MFunc
	CreateTxBefore   []MFunc
	CreateTxAfter    []MFunc
	CreateAfter      []MFunc
	CreateSecurity   []string

	Update           bool
	UpdateSave       bool
	UpdateParams     []Attr
	UpdateParamsDecs []string
	UpdateBefore     []MFunc
	UpdateTxBefore   []MFunc
	UpdateTxAfter    []MFunc
	UpdateAfter      []MFunc
	UpdateSecurity   []string

	List         bool
	ListPreload  bool
	ListPreloadV []string
	ListBefore   []MFunc
	ListAfter    []MFunc
	ListSecurity []string

	Info         bool
	InfoPreload  bool
	InfoPreloadV []string
	InfoBefore   []MFunc
	InfoAfter    []MFunc
	InfoSecurity []string

	Delete         bool
	DeleteBefore   []MFunc
	DeleteTxBefore []MFunc
	DeleteTxAfter  []MFunc
	DeleteAfter    []MFunc
	DeleteSecurity []string
}

Jump to

Keyboard shortcuts

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