core

package
v0.0.0-...-952850d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const InternalDirName = "internal/"

Variables

This section is empty.

Functions

func BasePkg

func BasePkg(pkg string) string

func ListParameters

func ListParameters(namePrefix string, t []reflect.Type) string

func ListReturns

func ListReturns(r []reflect.Type) string

func ProcessSource

func ProcessSource(ag Agent, sd ServiceInfo)

func Run

func Run(basePrjDir string, pkg string, agent Agent, definitions interface{})

Run generation for services in dir {{basePrjDir}}/{{pkg}} using given agent

func TemplateBaseFunctions

func TemplateBaseFunctions() template.FuncMap

Types

type Agent

type Agent interface {
	Code(service ServiceInfo) []Source
}

type MethodInfo

type MethodInfo struct {
	Method     reflect.Method
	Receiver   reflect.Type
	Parameters []reflect.Type
	Returns    []reflect.Type
}

func NewMethodInfo

func NewMethodInfo(receiver reflect.Type) []MethodInfo

func (MethodInfo) MarshalJSON

func (d MethodInfo) MarshalJSON() ([]byte, error)

type Override

type Override interface {
	Override() bool
}

type ServiceInfo

type ServiceInfo struct {
	BaseDir    string
	Pkg        string
	Type       reflect.Type `json:"-"`
	Definition interface{}
	Methods    []MethodInfo
}

func NewServiceInfo

func NewServiceInfo(definition interface{}, t reflect.Type, baseDir string, pkg string) ServiceInfo

func (ServiceInfo) BaseName

func (s ServiceInfo) BaseName() string

func (ServiceInfo) FullPath

func (s ServiceInfo) FullPath(p ...string) string

func (ServiceInfo) FullnternalPath

func (s ServiceInfo) FullnternalPath(p ...string) string

func (ServiceInfo) Inject

func (s ServiceInfo) Inject() *jen.Statement

func (ServiceInfo) InternalPath

func (s ServiceInfo) InternalPath(p ...string) string

type Source

type Source struct {
	Filename string
	Code     []byte //TODO: writer/reader?
}

func NewSource

func NewSource(file string, code []byte) Source

func NewSourceOf

func NewSourceOf(file string) Source

func NewSourceSet

func NewSourceSet(file string, code []byte) []Source

Jump to

Keyboard shortcuts

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