templates

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const APIDefinition = `` /* 2908-byte string literal not displayed */

APIDefinition is the template for the go definition of the API.

View Source
const Client = `` /* 4185-byte string literal not displayed */

Client is the template for the client of the service.

View Source
const Dockerfile = `` /* 520-byte string literal not displayed */

Dockerfile is the template for the service's Dockerfile.

View Source
const Env = `package config

import "github.com/kelseyhightower/envconfig"

// Env holds all environmental variables for the service app.
type Env struct {
	Port string ` + "`" + `default:"{{.Port}}" envconfig:"PORT"` + "`" + `
	{{range .Environment -}}
	{{.Name | toLower | capitalize}} {{.Type}} ` + "`" + `default:"{{.Value}}" envconfig:"{{.Name | toUpper}}"` + "`" + `
	{{end}}
	{{range $d := .Dependencies -}}
	{{$d | replaceHyphens | toLower | capitalize}}Addr string ` + "`" + `default:"" envconfig:"{{$d | replaceHyphens | toUpper}}_ADDR"` + "`" + `
	{{end}}
}

// ProcessEnv processes the environment, filling an
// Env struct's fields with the found values.
func ProcessEnv() (e Env, err error) {
	err = envconfig.Process("app", &e)
	return e, err
}`

Env is the template for the environment config in go code.

View Source
const Errors = `` /* 399-byte string literal not displayed */

Errors is the template for the go definition of the errors code.

View Source
const HTTPErrorHandler = `` /* 296-byte string literal not displayed */

HTTPErrorHandler is the template for the go definition of the HTTP error handler code.

View Source
const HTTPRouter = `` /* 1122-byte string literal not displayed */

HTTPRouter is the template for the HTTP router in go code.

View Source
const HTTPWrapper = `` /* 4474-byte string literal not displayed */

HTTPWrapper is the template for HTTP boilerplate in go code.

View Source
const Impl = `` /* 2753-byte string literal not displayed */

Impl is the template for the main go implementation of the API.

View Source
const Main = `` /* 882-byte string literal not displayed */

Main is the template for the main functionality in go code.

View Source
const Struct = `package exports

// {{.Name | capitalize}} - generated API structure
type {{.Name | capitalize}} struct {
	{{range .Fields}}{{.Name | capitalize}} {{.Type | typeName}} ` + "`" + `json:"{{.Name}}"` + "`" + `
	{{end}}
}`

Struct is the template for API structures in go code.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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