Documentation ¶
Index ¶
- Constants
- func CloneIntoGitHome(url, branch string) (dir string, err error)
- func EscapeGolangKeyword(s string) string
- func GetHead(source string) string
- func Index(slice []string, item string) int
- func IsEmptyStringOrWhiteSpace(s string) bool
- func IsTemplateVariable(text string) bool
- func SafeString(in string) string
- func TemplateVariable(text string) string
- func Title(s string) string
- func TrimWhiteSpace(s string) string
- func Untitle(s string) string
- type DefaultTemplate
Constants ¶
const (
// DoNotEditHead added to the beginning of a file to prompt the user not to edit
DoNotEditHead = "// Code generated by goctl. DO NOT EDIT."
)
Variables ¶
This section is empty.
Functions ¶
func CloneIntoGitHome ¶
func EscapeGolangKeyword ¶
EscapeGolangKeyword escapes the golang keywords.
func IsTemplateVariable ¶
IsTemplateVariable returns true if the text is a template variable. The text must start with a dot and be a valid template.
func SafeString ¶
SafeString converts the input string into a safe naming style in golang
func TemplateVariable ¶
TemplateVariable returns the variable name of the template.
func Title ¶
Title returns a string value with s[0] which has been convert into upper case that there are not empty input text
func TrimWhiteSpace ¶
Types ¶
type DefaultTemplate ¶
type DefaultTemplate struct {
// contains filtered or unexported fields
}
DefaultTemplate is a tool to provides the text/template operations
func (*DefaultTemplate) Execute ¶
func (t *DefaultTemplate) Execute(data any) (*bytes.Buffer, error)
Execute returns the codes after the template executed
func (*DefaultTemplate) GoFmt ¶
func (t *DefaultTemplate) GoFmt(format bool) *DefaultTemplate
GoFmt sets the value to goFmt and marks the generated codes will be formatted or not
func (*DefaultTemplate) Parse ¶
func (t *DefaultTemplate) Parse(text string) *DefaultTemplate
Parse accepts a source template and returns DefaultTemplate
Directories ¶
Path | Synopsis |
---|---|
Package name provides methods to verify naming style and format naming style See the method IsNamingValid, FormatFilename
|
Package name provides methods to verify naming style and format naming style See the method IsNamingValid, FormatFilename |