Documentation ¶
Index ¶
- Variables
- func CompileRegex(pattern string) *regexp.Regexp
- func ExecuteTemplate(tmpl *template.Template, data interface{}) string
- func GetFunctionsFromPackageForStructs(structs Structs) (map[*Struct]Functions, error)
- func GetShortName(name string) (string, error)
- func GetStringFromPosition(start token.Pos, end token.Pos) (string, error)
- func GetTemplate(name string, text string) *template.Template
- func IsASCII(c byte) bool
- func IsLower(c byte) bool
- func IsPrivate(name string) bool
- func IsPublic(name string) bool
- func IsUpper(c byte) bool
- func SaveGoCodeToFile(filename string, content []byte) error
- func SaveToFile(filename string, content []byte) error
- func ShouldIgnore(name string) bool
- func ToGetterName(name string) (string, error)
- func ToSetterName(name string) (string, error)
- func ToString(bs []byte) string
- type Field
- type Fields
- type Function
- type Functions
- type Struct
- type Structs
Constants ¶
This section is empty.
Variables ¶
View Source
var GENERATED_BY_GOD = CompileRegex(`^Code generated by god.* DO NOT EDIT\.`)
Functions ¶
func CompileRegex ¶
func ExecuteTemplate ¶
func GetFunctionsFromPackageForStructs ¶
TODO
func GetShortName ¶
func GetStringFromPosition ¶
func SaveGoCodeToFile ¶
func SaveToFile ¶
func ShouldIgnore ¶
func ToGetterName ¶
func ToSetterName ¶
Types ¶
type Field ¶
type Field struct { Name string // 字段名 Type string // 字段类型 GetterName string // Getter 的名称 GetterAlreadyExist bool // Getter 是否在原本的代码中就存在,含同名 field 已经存在的情况 WillGenerateGetter bool // 是否要生成 Getter SetterName string SetterAlreadyExist bool WillGenerateSetter bool IsPublic bool ShouldIgnore bool HasGetter bool IgnoreReason string }
type Fields ¶
func GetFieldsFromStruct ¶
func GetFieldsFromStruct(structType *ast.StructType) (fields Fields, err error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.