generation

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	//ArgumentPrefix argument name prefix
	ArgumentPrefix = "arg"
	//ReturnPrefix return name prefix
	ReturnPrefix = "ret"

	Header = `// GENERATED CODE
// --------------
// please do not edit manually instead use the "zbusc" to regenerate

`
)

Variables

This section is empty.

Functions

func Generate

func Generate(opt Options, inf interface{}) error

Generate generates stubs for given interface

Example
type Test interface {
	Hello(name string) string
	Add(a, b float64) string
	Divide(a, b float64) (float64, error)
}

var inf = (*Test)(nil)
err := Generate(Options{Module: "example", Name: "test", Package: "stubs", Version: "1.0"}, inf)
if err != nil {
	panic(err)
}

func Generator

func Generator(fqn string) (*jen.File, error)

Generator builds a generator code

Types

type Options

type Options struct {
	Module  string
	Name    string
	Version string
	Package string
}

Options defines a stub optiosn (ObjectID)

func NewOptions

func NewOptions() Options

NewOptions creates a new options from command line arguments. It terminates if required options are not provided

Jump to

Keyboard shortcuts

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