minimal

package
v0.0.0-...-559bc06 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePackageJSON

func CreatePackageJSON(projectName string) *plugin.CodeGeneratorResponse_File

func CreateTSConfig

func CreateTSConfig() *plugin.CodeGeneratorResponse_File

func RuntimeLibrary

func RuntimeLibrary() *plugin.CodeGeneratorResponse_File

Types

type APIContext

type APIContext struct {
	Models      []*Model
	Services    []*Service
	Enums       []*Enum
	Imports     Imports
	TwirpPrefix string
	// contains filtered or unexported fields
}

func NewAPIContext

func NewAPIContext(twirpVersion string) APIContext

func (*APIContext) AddEnum

func (ctx *APIContext) AddEnum(e *Enum)

func (*APIContext) AddModel

func (ctx *APIContext) AddModel(m *Model)

func (*APIContext) ApplyMarshalFlags

func (ctx *APIContext) ApplyMarshalFlags()

ApplyMarshalFlags will inspect the CanMarshal and CanUnmarshal flags for models where the flags are enabled and recursively set the same values on all the models that are field types.

func (*APIContext) PopulateImports

func (ctx *APIContext) PopulateImports()

type Enum

type Enum struct {
	Name     string
	Options  []EnumOption
	Filename string
}

type EnumOption

type EnumOption struct {
	Key   string
	Value interface{}
}

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(twirpVersion string, p map[string]string) *Generator

type Import

type Import = map[string]bool

type Imports

type Imports map[filename]Import

func (Imports) Set

func (i Imports) Set(key filename, value string)

func (Imports) SetEnum

func (i Imports) SetEnum(key filename, value string)

type Model

type Model struct {
	Name         string
	Primitive    bool
	Fields       []ModelField
	CanMarshal   bool
	CanUnmarshal bool
	Filename     string
}

type ModelField

type ModelField struct {
	Name       string
	Type       string
	JSONName   string
	JSONType   string
	IsMessage  bool
	IsEnum     bool
	IsRepeated bool
}

type Service

type Service struct {
	Name    string
	Package string
	Methods []ServiceMethod
}

type ServiceMethod

type ServiceMethod struct {
	Name       string
	Path       string
	InputArg   string
	InputType  string
	OutputType string
}

Jump to

Keyboard shortcuts

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