utils

package
v0.0.0-...-56394c6 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuncMap = template.FuncMap{
	"pluralize":   inflector.Pluralize,
	"singularize": inflector.Singularize,
	"title":       strings.Title,
	"firstLower":  FirstCharLower,
	"toLower":     strings.ToLower,
	"toSnakeCase": snaker.CamelToSnake,
	"firstChar":   GetFirstChar,
}

FuncMap is a set of functions to use in templates

Functions

func CheckErr

func CheckErr(e error)

CheckErr checks error and print it if it exists

func Copy

func Copy(src, dest string) error

Copy copies src to dest, doesn't matter if src is a directory or a file

func FirstCharLower

func FirstCharLower(s string) string

FirstCharLower lowers first char of string

func GenerateFile

func GenerateFile(templateFile string, outputPath string, data interface{})

GenerateFile produces a file from template and data (data structure)

func GetFirstChar

func GetFirstChar(s string) string

GetFirstChar returns the first char of string

Types

type SelectedModel

type SelectedModel struct {
	Namespace string
	ModelName string
	Methods   []string
}

SelectedModel is a structure that holds model name and selected methods

func SelectMethodsModels

func SelectMethodsModels(typeName string) (selectedModels []SelectedModel)

SelectMethodsModels asks user which models and methods to generate

Jump to

Keyboard shortcuts

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