Documentation ¶
Index ¶
- func FileName(p string) string
- func FileNameFromTypeName(input, output, typename string) string
- func IsFieldExported(name string) bool
- func LowerFirst(s string) string
- func New(fn Generator) error
- func NewStructFields(structType *types.Struct) (map[string]StructField, error)
- func UpperCommonInitialism(s string) string
- func UpperFirst(s string) string
- func Walk(visitor Visitor, T types.Type) bool
- type Generator
- type Option
- type OptionItem
- type StructField
- type Tag
- type TypeNames
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileNameFromTypeName ¶
func IsFieldExported ¶
func LowerFirst ¶
func NewStructFields ¶
func NewStructFields(structType *types.Struct) (map[string]StructField, error)
func UpperCommonInitialism ¶
func UpperFirst ¶
Types ¶
type StructField ¶
type StructField struct { // Name of the struct field. Name string `example:"Name"` // Useful when the output directory doesn't match the existing ones. PkgPath string `example:"github.com/alextanhongpin/go-codegen/test"` PkgName string `example:"test"` Exported bool `example:"true"` // Stores the original position of the field in the struct. Ordinal int Tag *Tag `example:"get:'Renamed'"` // To ignore getter. Type types.Type }
StructField for the example below.
type Foo struct { Name sql.NullString `json:"name" }
Click to show internal directories.
Click to hide internal directories.