Documentation ¶
Index ¶
- Variables
- func DenormalizeSlashes(path string) string
- func FindTemplates(root, base string) (map[string]TemplateLoader, error)
- func LcFirst(s string) string
- func NormalizeSlashes(path string) string
- func Render(opts Options) error
- func RenderSingleton(opts Options) error
- func ToGo(name string) string
- func ToGoPrivate(name string) string
- func UcFirst(s string) string
- type AssetLoader
- type Base64Loader
- type FileLoader
- type LazyTemplate
- type LazyTemplates
- type Once
- type Options
- type TemplateFuncs
- type TemplateList
- type TemplateLoader
- type TemplateLoaderMap
Constants ¶
This section is empty.
Variables ¶
var TemplateFunctions = TemplateFuncs{ "stringFuncs": func(funcName string) func(string) string { return templateStringMappers[funcName] }, "quoteWrap": func(s string) string { return fmt.Sprintf(`"%s"`, s) }, "id": strmangle.Identifier, "goVarname": goVarnameReplacer.Replace, "singular": strmangle.Singular, "plural": strmangle.Plural, "titleCase": strmangle.TitleCase, "camelCase": strmangle.CamelCase, "snakeCase": strcase.ToSnake, "ignore": strmangle.Ignore, "join": func(sep string, slice []string) string { return strings.Join(slice, sep) }, "joinSlices": strmangle.JoinSlices, "stringMap": strmangle.StringMap, "prefixStringSlice": strmangle.PrefixStringSlice, "containsAny": strmangle.ContainsAny, "generateTags": strmangle.GenerateTags, "generateIgnoreTags": strmangle.GenerateIgnoreTags, "parseEnumName": strmangle.ParseEnumName, "parseEnumVals": strmangle.ParseEnumVals, "isEnumNormal": strmangle.IsEnumNormal, "stripWhitespace": strmangle.StripWhitespace, "shouldTitleCaseEnum": strmangle.ShouldTitleCaseEnum, "onceNew": newOnce, "oncePut": Once.Put, "onceHas": Once.Has, "makeStringMap": strmangle.MakeStringMap, "setInclude": strmangle.SetInclude, "whereClause": strmangle.WhereClause, "usesPrimitives": usesPrimitives, "isPrimitive": isPrimitive, "isBuiltin": isBuiltin, "filterColumnsByAuto": database.FilterColumnsByAuto, "filterColumnsByDefault": database.FilterColumnsByDefault, "filterColumnsByEnum": database.FilterColumnsByEnum, "sqlColDefinitions": database.SQLColDefinitions, "columnNames": database.ColumnNames, "columnDBTypes": database.ColumnDBTypes, "getTable": database.GetTable, "go": ToGo, "goPrivate": ToGoPrivate, "prefixLines": prefixLines, "modelTypeAsText": getModelTypeAsText, }
templateFunctions is a map of all the functions that get passed into the templates. If you wish to pass a new function into your own template, add a function pointer here.
Functions ¶
func DenormalizeSlashes ¶
DenormalizeSlashes takes any backslashes and converts them to linux style slashes
func FindTemplates ¶
func FindTemplates(root, base string) (map[string]TemplateLoader, error)
FindTemplates uses a root path: (/home/user/gopath/src/../sqlboiler/) and a base path: /templates to create a bunch of file loaders of the form: templates/00_struct.tpl -> /absolute/path/to/that/file Note the missing leading slash, this is important for the --replace argument
func NormalizeSlashes ¶
NormalizeSlashes takes a path that was made on linux or windows and converts it to a native path.
func RenderSingleton ¶
func ToGoPrivate ¶
Types ¶
type AssetLoader ¶
type AssetLoader string
func (AssetLoader) Load ¶
func (a AssetLoader) Load() ([]byte, error)
func (AssetLoader) MarshalText ¶
func (a AssetLoader) MarshalText() ([]byte, error)
func (AssetLoader) String ¶
func (a AssetLoader) String() string
type Base64Loader ¶
type Base64Loader string
func (Base64Loader) Load ¶
func (b Base64Loader) Load() ([]byte, error)
func (Base64Loader) MarshalText ¶
func (b Base64Loader) MarshalText() ([]byte, error)
func (Base64Loader) String ¶
func (b Base64Loader) String() string
type FileLoader ¶
type FileLoader string
func (FileLoader) Load ¶
func (f FileLoader) Load() ([]byte, error)
func (FileLoader) MarshalText ¶
func (f FileLoader) MarshalText() ([]byte, error)
func (FileLoader) String ¶
func (f FileLoader) String() string
type LazyTemplate ¶
type LazyTemplate struct { Name string `json:"name"` Loader TemplateLoader `json:"loader"` }
type LazyTemplates ¶
type LazyTemplates []LazyTemplate
func LoadTemplates ¶
func LoadTemplates(templateDir []string, assetPrefix string) (LazyTemplates, error)
func (*LazyTemplates) AppendBase64Templates ¶
func (lt *LazyTemplates) AppendBase64Templates(base64Templates map[string]string)
func (LazyTemplates) Replacements ¶
func (lt LazyTemplates) Replacements(replacements []string) error
type Once ¶
type Once map[string]struct{}
set is to stop duplication from named enums, allowing a template loop to keep some state
type TemplateFuncs ¶
func (TemplateFuncs) Append ¶
func (f TemplateFuncs) Append(funcMap template.FuncMap)
func (TemplateFuncs) AppendFunc ¶
func (f TemplateFuncs) AppendFunc(name string, fn interface{})
type TemplateList ¶
func ParseTemplates ¶
func ParseTemplates(lazyTemplates []LazyTemplate, testTemplates bool, funcMap TemplateFuncs) (*TemplateList, error)
func (TemplateList) Templates ¶
func (t TemplateList) Templates() []string
Templates returns the name of all the templates defined in the template list
type TemplateLoader ¶
type TemplateLoader interface { encoding.TextMarshaler Load() ([]byte, error) }
type TemplateLoaderMap ¶
type TemplateLoaderMap map[string]TemplateLoader