gen

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gen contains (mostly) generated Jennifer code, that can be used at multiple places.

Generating code that generates code from existing code is useful, because we just have to write regular code.

The code is generated with "github.com/aloder/tojen", and then modified by hand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Comments

func Comments(comments ...string) jen.Code

Comments creates comments from a list of strings

func MustTemplate

func MustTemplate(template string, values IntoValues, options ...TemplatingOption) jen.Code

func PrimitiveFromString

func PrimitiveFromString(s *spec.Schema, ptr bool, varName, strName jen.Code) (jen.Code, error)

func Qual

func Qual(path, name string) *jen.Statement

func Raw

func Raw(str string) *jen.Statement

func Template

func Template(template string, values IntoValues, options ...TemplatingOption) (jen.Code, error)

Template mixes jen code with a string template.

Types

type IntoValues

type IntoValues interface {
	Values() Values
}

type TemplatingOption

type TemplatingOption func(*templatingOptions)

TemplatingOption is used to set templating options

func SkipNotFound

func SkipNotFound() TemplatingOption

SkipNotFound is an option to leave not found values untouched in the template.

type Values

type Values map[string]jen.Code

Values are code substitution values for templating.

func (Values) Values

func (v Values) Values() Values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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