backend

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 1 Imported by: 12

Documentation

Overview

Package backend defines the Backend interface for generators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// The name of this backend.
	Name() string

	// Lang returns the target language that this backend supports.
	Lang() string

	// Generate generates codes.
	Generate(req *plugin.Request, log LogFunc) (res *plugin.Response)

	// Options returns the available options with their descriptions.
	Options() []plugin.Option

	// BuiltinPlugins returns a list of built-in plugins of the backend.
	BuiltinPlugins() []*plugin.Desc

	// GetPlugin returns a plugin that match the description or nil.
	GetPlugin(desc *plugin.Desc) plugin.Plugin
}

Backend handles the code generation for a language.

type LogFunc

type LogFunc struct {
	Info      func(v ...interface{})
	Warn      func(v ...interface{})
	MultiWarn func(warns []string)
}

LogFunc defines a set of log functions.

func DummyLogFunc added in v0.1.2

func DummyLogFunc() LogFunc

DummyLogFunc returns a set of log functions that does nothing.

type PostProcessor added in v0.1.2

type PostProcessor interface {
	PostProcess(path string, content []byte) ([]byte, error)
}

PostProcessor is an optional extension for the Backend interface if it requires a process phase after codes generation and before code persistence.

Jump to

Keyboard shortcuts

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