meta

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package meta contains types that represent generated code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Package string
	Imports Imports
	Types   Types
	Methods Methods `meta:"ptr;filter"`
}

File represents a generated code file

func NewFile

func NewFile(pkg string) *File

NewFile creates a new File with all fields initialized

func (*File) FilterMethods added in v0.0.2

func (f *File) FilterMethods(fn func(*Method) bool, n int) Methods

FilterMethods returns a copy of Methods, omitting elements that are rejected by the given function. The n argument determines the maximum number of elements to return (n < 1: all elements).

func (*File) String

func (f *File) String() string

String generates the file content

type Imports

type Imports map[string]struct{}

Imports represents a set of import paths

func (Imports) String

func (is Imports) String() string

String generates the import statement

type Method

type Method struct {
	RcvName, RcvType string
	Name             string
	ArgName, ArgType string
	RetVals          string
	FldName, FldType string
	Misc             map[string]interface{}
	Tmpl             string
}

Method represents a generated method

func (Method) String

func (m Method) String() string

String generates the method code

type Methods

type Methods []*Method

Methods represents a collection of generated methods

func (Methods) String

func (ms Methods) String() string

String generates the code for all methods

type Type added in v0.2.1

type Type struct {
	Name  string
	Embed string
	Misc  map[string]interface{}
	Tmpl  string
}

Type represents a type declaration

func (Type) String added in v0.2.1

func (t Type) String() string

String generates the type code

type Types added in v0.2.1

type Types []Type

Types represents a set of types

func (Types) String added in v0.2.1

func (ts Types) String() string

String generates the code for all types

Jump to

Keyboard shortcuts

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