gen

package
v0.0.0-...-a00536e Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gen implements code generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Funcs

func Funcs() template.FuncMap

Funcs returns functions which used in templates.

func Template

func Template() *template.Template

Template parses and returns vendored code generation templates.

Types

type FileSystem

type FileSystem interface {
	WriteFile(baseName string, source []byte) error
}

FileSystem represents a directory of generated package.

type Generator

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

func NewGenerator

func NewGenerator(spec *ogen.Spec) (*Generator, error)

func (*Generator) WriteSource

func (g *Generator) WriteSource(fs FileSystem, pkgName string, t *template.Template) error

WriteSource writes generated definitions to fs.

type Parameter

type Parameter struct {
	Name       string
	SourceName string
	Type       string
}

type ParameterType

type ParameterType string
var (
	ParameterTypeQuery  ParameterType = "Query"
	ParameterTypeHeader ParameterType = "Header"
	ParameterTypePath   ParameterType = "Path"
	ParameterCookie     ParameterType = "Cookie"
)

Jump to

Keyboard shortcuts

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