Back to godoc.org

Package golang

v0.1.0-alpha
Latest Go to latest

The latest major version is .

Published: Feb 9, 2020 | License: Apache-2.0 | Module: github.com/tamasfe/repose

Index

type Echo

type Echo struct{}

Echo provides code generation for the Echo framework

func (*Echo) DefaultOptions

func (e *Echo) DefaultOptions() interface{}

DefaultOptions implements Generator

func (*Echo) Description

func (e *Echo) Description() string

Description implements Generator

func (*Echo) DescriptionMarkdown

func (e *Echo) DescriptionMarkdown() string

DescriptionMarkdown implements DescriptionMarkdown

func (*Echo) Generate

func (e *Echo) Generate(ctx context.Context, options interface{}, sp *spec.Spec, target string) (interface{}, error)

Generate implements Generator

func (*Echo) GenerateScaffold

func (e *Echo) GenerateScaffold(ctx context.Context, sp *spec.Spec, opts *EchoOptions) (jen.Code, error)

func (*Echo) GenerateServer

func (e *Echo) GenerateServer(ctx context.Context, sp *spec.Spec, opts *EchoOptions) (jen.Code, error)

GenerateServer generates the server interface, And the register function.

func (*Echo) GenerateWrapper

func (e *Echo) GenerateWrapper(ctx context.Context, sp *spec.Spec, opts *EchoOptions) (jen.Code, error)

GenerateWrapper generates wrapper for an Echo instance and the server interface.

func (*Echo) Name

func (e *Echo) Name() string

Name implements Generator

func (*Echo) Targets

func (e *Echo) Targets() map[string]string

Targets implements Generator

type EchoOptions

type EchoOptions struct {
	ServerName            string `yaml:"serverName,omitempty" description:"Name of the server interface"`
	ServerImplName        string `yaml:"serverImplName,omitempty" description:"Name of the server interface implementation"`
	AllowNoResponse       bool   "" /* 154 byte string literal not displayed */
	ServerPackagePath     string "" /* 169 byte string literal not displayed */
	TypesPackagePath      string "" /* 175 byte string literal not displayed */
	ResponsePostfix       string `yaml:"responsePostfix" description:"Postfix to add for response types, configure it to avoid collisions with actual types"`
	ShortScaffoldComments bool   `yaml:"shortScaffoldComments" description:"Shorter scaffold comments for each method implementation"`
	ServerMiddleware      bool   "" /* 141 byte string literal not displayed */
}

EchoOptions is the options for the Echo target.

func (*EchoOptions) MarshalYAML

func (e *EchoOptions) MarshalYAML() (interface{}, error)

MarshalYAML implements YAML Marshaler

type General

type General struct{}

General generates framework-independent code.

func (*General) DefaultOptions

func (g *General) DefaultOptions() interface{}

DefaultOptions implements Generator

func (*General) Description

func (g *General) Description() string

Description implements Generator

func (*General) DescriptionMarkdown

func (g *General) DescriptionMarkdown() string

DescriptionMarkdown implements DescriptionMarkdown

func (*General) Generate

func (g *General) Generate(ctx context.Context, options interface{}, specification *spec.Spec, target string) (interface{}, error)

Generate implements Generator

func (*General) GenerateHelpers

func (g *General) GenerateHelpers(ctx context.Context, schema *spec.Schema, opts *GeneralOptions) (jen.Code, error)

GenerateHelpers generates various helper functions for a type.

func (*General) GenerateSpec

func (g *General) GenerateSpec(ctx context.Context, spBytes []byte, funcName string) (jen.Code, error)

GenerateSpec generates code that stores the specifications in base64, and a function to decode them to a map of bytes.

func (*General) GenerateType

func (g *General) GenerateType(ctx context.Context, schema *spec.Schema, opts *GeneralOptions) (jen.Code, error)

GenerateType generates a single type from a schema

func (*General) GenerateTypes

func (g *General) GenerateTypes(ctx context.Context, specification *spec.Spec, opts *GeneralOptions) (jen.Code, error)

GenerateTypes generates types from the spec

func (*General) GetOpts

func (g *General) GetOpts(ctx context.Context) (*GeneralOptions, error)

func (*General) Name

func (g *General) Name() string

Name implements Generator

func (*General) Targets

func (g *General) Targets() map[string]string

Targets implements Generator

type GeneralOptions

type GeneralOptions struct {
	GenerateTypeHelpers       bool   `yaml:"generateTypeHelpers" description:"Generate helper functions and methods for types"`
	GenerateGettersAndSetters bool   "" /* 173 byte string literal not displayed */
	GenerateMarshalMethods    bool   `yaml:"generateMarshalMethods" description:"Generate marshal/unmarshal methods for types that need them"`
	TypesPackagePath          string `yaml:"typesPackagePath,omitempty" description:"Package path to already generated types (used internally)"`
	ExpandEnums               bool   `yaml:"expandEnums" description:"Expand enums into const (...) blocks if possible"`
}

GeneralOptions are options the General target.

func (*GeneralOptions) MarshalYAML

func (g *GeneralOptions) MarshalYAML() (interface{}, error)

MarshalYAML implements YAML Marshaler

type StdLib

type StdLib struct{}

StdLib generates code for the standard library.

func (*StdLib) DefaultOptions

func (s *StdLib) DefaultOptions() interface{}

DefaultOptions implements Target

func (*StdLib) Description

func (s *StdLib) Description() string

Description implements Target

func (*StdLib) DescriptionMarkdown

func (s *StdLib) DescriptionMarkdown() string

DescriptionMarkdown implements DescriptionMarkdown

func (*StdLib) Generate

func (s *StdLib) Generate(ctx context.Context, options interface{}, specification *spec.Spec, target string) (interface{}, error)

Generate implements Target

func (*StdLib) GenerateCallbacks

func (s *StdLib) GenerateCallbacks(ctx context.Context, specification *spec.Spec, opts *StdLibOptions) (jen.Code, error)

GenerateClient generates Go HTTP requests.

func (*StdLib) GenerateClient

func (s *StdLib) GenerateClient(ctx context.Context, specification *spec.Spec, opts *StdLibOptions) (jen.Code, error)

GenerateClient generates Go HTTP requests.

func (*StdLib) GenerateRequest

func (s *StdLib) GenerateRequest(ctx context.Context, funcName jen.Code, url jen.Code, path string, op *spec.Operation, opts *StdLibOptions) (jen.Code, error)

func (*StdLib) Name

func (s *StdLib) Name() string

Name implements Target

func (*StdLib) Targets

func (s *StdLib) Targets() map[string]string

Targets implements Target

type StdLibOptions

type StdLibOptions struct {
	TypesPackagePath string "" /* 133 byte string literal not displayed */
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier