util

package
v1.3.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 14 Imported by: 142

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneIntoGitHome

func CloneIntoGitHome(url string) (dir string, err error)

func EscapeGolangKeyword

func EscapeGolangKeyword(s string) string

EscapeGolangKeyword escapes the golang keywords.

func GetHead

func GetHead(source string) string

GetHead returns a code head string with source filename

func Index

func Index(slice []string, item string) int

Index returns the index where the item equal,it will return -1 if mismatched

func SafeString

func SafeString(in string) string

SafeString converts the input string into a safe naming style in golang

func Title

func Title(s string) string

Title returns a string value with s[0] which has been convert into upper case that there are not empty input text

func Untitle

func Untitle(s string) string

Untitle returns a string value with s[0] which has been convert into lower case that there are not empty input text

Types

type DefaultTemplate

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

DefaultTemplate is a tool to provides the text/template operations

func With

func With(name string) *DefaultTemplate

With returns a instance of DefaultTemplate

func (*DefaultTemplate) Execute

func (t *DefaultTemplate) Execute(data interface{}) (*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

func (*DefaultTemplate) SaveTo

func (t *DefaultTemplate) SaveTo(data interface{}, path string, forceUpdate bool) error

SaveTo writes the codes to the target path

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

Jump to

Keyboard shortcuts

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