golang

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFunctionString added in v0.0.8

func CreateFunctionString(s string) (ret string)

CreateFunctionString strips a string of any leading non-alphabetical chars, and all non-alphabetical and non-numerical characters that follow.

func DefaultFuncMap added in v0.0.16

func DefaultFuncMap() *template.FuncMap

DefaultFuncMap contains a function map with sensible defaults for go template rendering

func IsHttpStatusCode added in v0.0.16

func IsHttpStatusCode(s string) bool

func MustLoadGinServerTestConfig added in v0.0.16

func MustLoadGinServerTestConfig(configPath, openAPIPath string) config.Data

func MustLoadGoClientTestConfig added in v0.0.16

func MustLoadGoClientTestConfig(configPath, openAPIPath string) config.Data

func SanitiseName added in v0.0.16

func SanitiseName(s []string) string

SanitiseName should consume the result of an NodeTraverser's .GetName() function. It creates a string array that is compliant to go function name restrictions and joins the result before returning a single string.

func SanitiseType added in v0.0.16

func SanitiseType(n tree.NodeTraverser) string

SanitiseType sanitizes the prepares the contents of the Type field of a node for use by the renderer

func ToTitle added in v0.0.8

func ToTitle(s string) (ret string)

Types

type Renderer

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

func (*Renderer) Format added in v0.0.16

func (g *Renderer) Format(input []byte) ([]byte, error)

Format applies the same formatter in use in gofmt to a rendered template. This is the standard formatter for all go code.

func (*Renderer) GetOutputFilename

func (g *Renderer) GetOutputFilename(n tree.NodeTraverser) string

GetOutputFilename provides an appropriate filename for any rendered output based on the node provided.

func (*Renderer) GetTemplateFuncMap

func (g *Renderer) GetTemplateFuncMap() *template.FuncMap

func (*Renderer) RenderNode added in v0.0.16

func (g *Renderer) RenderNode(parsedTemplate *template.Template, node tree.NodeTraverser) ([]byte, error)

RenderNode writes the relevant information contained within an openapi node into the provided template and returns the result.

func (*Renderer) SetTemplateFuncMap

func (g *Renderer) SetTemplateFuncMap(f *template.FuncMap)

Jump to

Keyboard shortcuts

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