generators

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerGenerator added in v0.3.1

type ControllerGenerator struct {
	MethodCount       uint
	SubscribeChannels map[string]*asyncapi.Channel
	PublishChannels   map[string]*asyncapi.Channel
	Prefix            string
	Version           string
}

ControllerGenerator is a code generator for controllers that will turn an asyncapi specification into controller golang code.

func NewControllerGenerator added in v0.3.1

func NewControllerGenerator(side Side, spec asyncapi.Specification) ControllerGenerator

NewControllerGenerator will create a new controller code generator.

func (ControllerGenerator) Generate added in v0.3.1

func (asg ControllerGenerator) Generate() (string, error)

Generate will generate the controller code.

type ImportsGenerator

type ImportsGenerator struct {
	PackageName   string
	ModuleVersion string
	ModuleName    string
	CustomImports []string
}

ImportsGenerator is a code generator for imports that will add needed imports to the code, being asyncapi-codegen packages, standard library packages or custom packages.

func (ImportsGenerator) Generate

func (ig ImportsGenerator) Generate() (string, error)

Generate will generate the imports code.

type Options

type Options struct {
	// Application should be true for application code generation to be generated
	Application bool
	// User should be true for user code generation to be generated
	User bool
	// Types should be true for type code (or common code) generation to be generated
	Types bool
}

Options are the options to activate some parts of code generation.

type Side added in v0.3.1

type Side string

Side represents the side of the code generation based on asyncapi documentation, i.e in front (user) or behind (application) asyncapi specification.

const (
	// SideIsApplication is the application side based on asyncapi documentation,
	// i.e. the side that stand behind of the asyncapi specification.
	SideIsApplication Side = "app"
	// SideIsUser is the user side based on asyncapi documentation,
	// i.e. the side that use the asyncapi specification.
	SideIsUser Side = "user"
)

type SubscriberGenerator added in v0.3.1

type SubscriberGenerator struct {
	MethodCount uint
	Channels    map[string]*asyncapi.Channel
	Prefix      string
}

SubscriberGenerator is a code generator for subscribers that will turn an asyncapi specification into subscriber golang code.

func NewSubscriberGenerator added in v0.3.1

func NewSubscriberGenerator(side Side, spec asyncapi.Specification) SubscriberGenerator

NewSubscriberGenerator will create a new subscriber code generator.

func (SubscriberGenerator) Generate added in v0.3.1

func (asg SubscriberGenerator) Generate() (string, error)

Generate will generate the subscriber code.

type TypesGenerator

type TypesGenerator struct {
	asyncapi.Specification
}

TypesGenerator is a code generator for types that will generate all schemas contained in an asyncapi specification to golang structures code.

func (TypesGenerator) Generate

func (tg TypesGenerator) Generate() (string, error)

Generate will create a new types code generator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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