Versions in this module Expand all Collapse all v1 v1.0.1 Feb 19, 2024 Changes in this version + var Expr = createExpr(LowerSnakeCase) + var TypeOf = createTypeOf(LowerSnakeCase) + var Val = createVal(LowerSnakeCase) + func GeneratedFileSuffix(filename string) string + func IsEmptyValue(rv reflect.Value) bool + func IsGoFile(filename string) bool + func IsGoTestFile(filename string) bool + func IsValidIdent(s string) bool + func LowerCamelCase(s string) string + func LowerSnakeCase(s string) string + func Stringify(snippet Snippet) string + func TryCatch(f func()) (err error) + func UpperCamelCase(s string) string + func UpperSnakeCase(s string) string + type ArrayType struct + Elem SnippetType + Len int + func Array(tpe SnippetType, len int) *ArrayType + func (tpe *ArrayType) Bytes() []byte + type Body []Snippet + func Block(bodies ...Snippet) Body + func (body Body) Bytes() []byte + type BuiltInType string + const Bool + const Byte + const Complex128 + const Complex64 + const Error + const Float32 + const Float64 + const Int + const Int16 + const Int32 + const Int64 + const Int8 + const Rune + const String + const Uint + const Uint16 + const Uint32 + const Uint64 + const Uint8 + const Uintptr + func (tpe BuiltInType) Bytes() []byte + type ChanType struct + Elem SnippetType + func Chan(tpe SnippetType) *ChanType + func (tpe *ChanType) Bytes() []byte + type EllipsisType struct + Elem SnippetType + func Ellipsis(tpe SnippetType) *EllipsisType + func (tpe *EllipsisType) Bytes() []byte + type File struct + PkgName string + func NewFile(pkgName string, filename string) *File + func (file *File) Bytes() []byte + func (file *File) Expr(f string, args ...interface{}) SnippetExpr + func (file *File) TypeOf(tpe reflect.Type) SnippetType + func (file *File) Use(importPath string, exposedName string) string + func (file *File) Val(v interface{}) Snippet + func (file *File) WriteBlock(ss ...Snippet) + func (file *File) WriteFile() (int, error) + type FuncType struct + Body []Snippet + Name *SnippetIdent + Params []*SnippetField + Recv *SnippetField + Results []*SnippetField + func Func(params ...*SnippetField) *FuncType + func (f *FuncType) Bytes() []byte + func (f FuncType) Do(bodies ...Snippet) *FuncType + func (f FuncType) MethodOf(recv *SnippetField) *FuncType + func (f FuncType) Named(name string) *FuncType + func (f FuncType) Return(results ...*SnippetField) *FuncType + type ImportPathAliaser func(importPath string) string + type InterfaceType struct + Methods []SnippetCanBeInterfaceMethod + func Interface(methods ...SnippetCanBeInterfaceMethod) *InterfaceType + func (tpe *InterfaceType) Bytes() []byte + type MapType struct + Key SnippetType + Value SnippetType + func Map(key SnippetType, value SnippetType) *MapType + func (tpe *MapType) Bytes() []byte + type NamedType struct + Name *SnippetIdent + func Type(name string) *NamedType + func (tpe *NamedType) Bytes() []byte + type SliceType struct + Elem SnippetType + func Slice(tpe SnippetType) *SliceType + func (tpe *SliceType) Bytes() []byte + type Snippet interface + Bytes func() []byte + type SnippetAssignStmt struct + Lhs []SnippetCanAddr + Rhs []Snippet + Token token.Token + func Assign(lhs ...SnippetCanAddr) *SnippetAssignStmt + func AssignWith(tok token.Token, lhs ...SnippetCanAddr) *SnippetAssignStmt + func Define(lhs ...SnippetCanAddr) *SnippetAssignStmt + func (stmt *SnippetAssignStmt) Bytes() []byte + func (stmt SnippetAssignStmt) By(rhs ...Snippet) *SnippetAssignStmt + type SnippetBuiltIn string + const Break + const Continue + const Fallthrough + const False + const Iota + const Nil + const True + func (tpe SnippetBuiltIn) Bytes() []byte + type SnippetCallExpr struct + Ellipsis bool + Modifier token.Token + Params []Snippet + X Snippet + func Call(name string, params ...Snippet) *SnippetCallExpr + func CallWith(s Snippet, params ...Snippet) *SnippetCallExpr + func Convert(tpe SnippetType, target Snippet) *SnippetCallExpr + func (expr *SnippetCallExpr) Bytes() []byte + func (expr SnippetCallExpr) AsDefer() *SnippetCallExpr + func (expr SnippetCallExpr) AsGo() *SnippetCallExpr + func (expr SnippetCallExpr) WithEllipsis() *SnippetCallExpr + type SnippetCanAddr interface + type SnippetCanBeInterfaceMethod interface + type SnippetClause struct + Body []Snippet + List []Snippet + func Clause(ss ...Snippet) *SnippetClause + func (stmt *SnippetClause) Bytes() []byte + func (stmt SnippetClause) Do(bodies ...Snippet) *SnippetClause + type SnippetComments []string + func Comments(lines ...string) SnippetComments + func (comments SnippetComments) Bytes() []byte + type SnippetCompositeLit struct + Elts []Snippet + Type SnippetType + func Compose(tpe SnippetType, elts ...Snippet) *SnippetCompositeLit + func (lit *SnippetCompositeLit) Bytes() []byte + type SnippetExpr string + func (tpe SnippetExpr) Bytes() []byte + type SnippetField struct + Alias bool + Names []*SnippetIdent + Tag string + Type SnippetType + func Var(tpe SnippetType, names ...string) *SnippetField + func (f *SnippetField) Bytes() []byte + func (f SnippetField) AsAlias() *SnippetField + func (f SnippetField) WithComments(comments ...string) *SnippetField + func (f SnippetField) WithTag(tag string) *SnippetField + func (f SnippetField) WithTags(tags map[string][]string) *SnippetField + func (f SnippetField) WithoutTag() *SnippetField + type SnippetForStmt struct + Body []Snippet + Cond Snippet + Init Snippet + Post Snippet + func For(init Snippet, cond Snippet, post Snippet) *SnippetForStmt + func (stmt *SnippetForStmt) Bytes() []byte + func (stmt SnippetForStmt) Do(bodies ...Snippet) *SnippetForStmt + type SnippetIdent string + func Id(n string) *SnippetIdent + func IdsFromNames(names ...string) []*SnippetIdent + func (id SnippetIdent) Bytes() []byte + func (id SnippetIdent) LowerCamelCase() *SnippetIdent + func (id SnippetIdent) LowerSnakeCase() *SnippetIdent + func (id SnippetIdent) UpperCamelCase() *SnippetIdent + func (id SnippetIdent) UpperSnakeCase() *SnippetIdent + type SnippetIfStmt struct + AsElse bool + Body []Snippet + Cond Snippet + ElseList []*SnippetIfStmt + Init Snippet + func If(cond Snippet) *SnippetIfStmt + func (stmt *SnippetIfStmt) Bytes() []byte + func (stmt SnippetIfStmt) Do(bodies ...Snippet) *SnippetIfStmt + func (stmt SnippetIfStmt) Else(ifStmt *SnippetIfStmt) *SnippetIfStmt + func (stmt SnippetIfStmt) InitWith(init Snippet) *SnippetIfStmt + func (stmt SnippetIfStmt) WithoutInit() *SnippetIfStmt + type SnippetKeyValueExpr struct + Key Snippet + Value Snippet + func KeyValue(key Snippet, value Snippet) *SnippetKeyValueExpr + func (tpe *SnippetKeyValueExpr) Bytes() []byte + type SnippetLit string + func Lit(s string) *SnippetLit + func (lit SnippetLit) Bytes() []byte + type SnippetParenExpr struct + Elem Snippet + func Paren(s Snippet) *SnippetParenExpr + func (tpe *SnippetParenExpr) Bytes() []byte + type SnippetRangeStmt struct + Body []Snippet + Key *SnippetIdent + Value *SnippetIdent + X Snippet + func ForRange(x Snippet, keyAndValue ...string) *SnippetRangeStmt + func (stmt *SnippetRangeStmt) Bytes() []byte + func (stmt SnippetRangeStmt) Do(bodies ...Snippet) *SnippetRangeStmt + type SnippetReturnStmt struct + Results []Snippet + func Return(snippets ...Snippet) *SnippetReturnStmt + func (stmt *SnippetReturnStmt) Bytes() []byte + type SnippetSelectStmt struct + Clauses []*SnippetClause + func Select(clauses ...*SnippetClause) *SnippetSelectStmt + func (stmt *SnippetSelectStmt) Bytes() []byte + type SnippetSelectorExpr struct + Selectors []Snippet + X Snippet + func Sel(x Snippet, selectors ...Snippet) *SnippetSelectorExpr + func (expr *SnippetSelectorExpr) Bytes() []byte + type SnippetSpec interface + type SnippetStarExpr struct + X SnippetType + func Star(tpe SnippetType) *SnippetStarExpr + func (expr *SnippetStarExpr) Bytes() []byte + type SnippetSwitchStmt struct + Clauses []*SnippetClause + Cond Snippet + Init Snippet + func Switch(cond Snippet) *SnippetSwitchStmt + func (stmt *SnippetSwitchStmt) Bytes() []byte + func (stmt SnippetSwitchStmt) InitWith(init Snippet) *SnippetSwitchStmt + func (stmt SnippetSwitchStmt) When(clauses ...*SnippetClause) *SnippetSwitchStmt + type SnippetType interface + type SnippetTypeAssertExpr struct + Type SnippetType + X Snippet + func TypeAssert(tpe SnippetType, x Snippet) *SnippetTypeAssertExpr + func (expr *SnippetTypeAssertExpr) Bytes() []byte + type SnippetTypeDecl struct + Specs []SnippetSpec + Token token.Token + func DeclConst(specs ...SnippetSpec) *SnippetTypeDecl + func DeclType(specs ...SnippetSpec) *SnippetTypeDecl + func DeclVar(specs ...SnippetSpec) *SnippetTypeDecl + func (decl *SnippetTypeDecl) Bytes() []byte + type SnippetUnaryExpr struct + Elem SnippetCanAddr + func Unary(addr SnippetCanAddr) *SnippetUnaryExpr + func (tpe *SnippetUnaryExpr) Bytes() []byte + type StructType struct + Fields []*SnippetField + func Struct(fields ...*SnippetField) *StructType + func (tpe *StructType) Bytes() []byte