codegen

package
v0.0.0-...-bc45db9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package codegen generates custom datatypes, PDK plugin code and SDK host code from a `schema.Plugin` in the Go and MoonBit programming languages.

Index

Constants

View Source
const VERSION = "0.1.0"

VERSION is on a line by itself for use with "bump_version": https://github.com/Shyp/bump_version

Variables

View Source
var (
	ErrNoCodeGeneration = errors.New("code generation not supported for version v0")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	PkgName string
	Lang    string // "go" or "mbt"
	Plugin  *schema.Plugin

	CustTypesFilename string
	CustTypes         string

	CustTypesTestsFilename string
	CustTypesTests         string
	// contains filtered or unexported fields
}

Client represents a codegen client.

func New

func New(language string, plugin *schema.Plugin, opts *ClientOpts) (*Client, error)

New returns a new codegen `Client` for either "go" or "mbt" and the provided plugin with the given package name.

func (*Client) GenCustomTypes

func (c *Client) GenCustomTypes() (GeneratedFiles, error)

func (*Client) GenHostDir

func (c *Client) GenHostDir(dirName string) error

func (*Client) GenHostSDK

func (c *Client) GenHostSDK() (GeneratedFiles, error)

GenHostSDK generates Host SDK code to call the extension plugin.

func (*Client) GenPluginDir

func (c *Client) GenPluginDir(dirName string) error

func (*Client) GenPluginPDK

func (c *Client) GenPluginPDK() (GeneratedFiles, error)

GenPluginPDK generates Plugin PDK code to process plugin calls.

func (*Client) GenTypesDir

func (c *Client) GenTypesDir(dirName string) error

type ClientOpts

type ClientOpts struct {
	// Force causes existing file to be overwritten.
	Force bool
	// Quiet prevents warning messages from being printed
	Quiet bool
}

ClientOpts represents options to the codegen Client.

type GeneratedFiles

type GeneratedFiles map[string]string

GeneratedFiles represents the files in the generated code.

Jump to

Keyboard shortcuts

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