template

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Args

func Args(vs ...any) []any

Args is a function used to pass arguments to templates.

func ConvertKey added in v0.37.0

func ConvertKey(sentence string) string

ConvertKey is used in template to convert schema property key name according to chosen strategy.

func CutSuffix

func CutSuffix(s, suffix string) string

CutSuffix is a function used to remove a suffix to a string.

func DescribeStruct

func DescribeStruct(st any) string

DescribeStruct will describe a struct in a human readable way using `%+v` format from the standard library.

func HasField

func HasField(v any, name string) bool

HasField will check if a struct has a field with the given name.

func HelpersFunctions

func HelpersFunctions() template.FuncMap

HelpersFunctions returns the functions that can be used as helpers in a golang template.

func MultiLineComment

func MultiLineComment(comment string) string

MultiLineComment will prefix each line of a comment with "// " in order to make it a valid multiline golang comment.

func Namify

func Namify(sentence string) string

Namify will convert a sentence to a golang conventional type name.

func NamifyWithoutParams

func NamifyWithoutParams(sentence string) string

NamifyWithoutParams will convert a sentence to a golang conventional type name. and will remove all parameters that can appear between '{' and '}'.

func SetConvertKeyFn added in v0.37.0

func SetConvertKeyFn(name string) error

SetConvertKeyFn sets the function used to convert schema property key names.

Types

This section is empty.

Jump to

Keyboard shortcuts

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