Documentation ¶
Index ¶
- Constants
- Variables
- func GenImports(data GenImportsData) (string, error)
- func GenPackage(data GenPackageData) (string, error)
- func GeneratePublishEvents(o PublishEventsOptions) (string, error)
- func LoadSource(pkg string) (*packages.Package, error)
- type Event
- type GenImportsData
- type GenPackageData
- type GenerateType
- type Generator
- type Id
- type ImportAlias
- type ImportPkg
- type Method
- type Options
- type Param
- type PublishEventsOptions
- type Response
- type Subscriber
Constants ¶
View Source
const LoadMode = packages.NeedName | packages.NeedFiles | packages.NeedImports | packages.NeedTypes | packages.NeedSyntax | packages.NeedTypesInfo
View Source
const Version = "v0.8.2"
Variables ¶
View Source
var ( ErrServiceNotFound = errors.New("service not found") ErrEmptyService = errors.New("empty service") ErrNotInterface = errors.New("service is not an interface") ErrNoCtxParam = errors.New(`first param is not "context.Context"`) ErrInvalidResults = errors.New(`method results are not "error", neither "(SomeType, error)"`) ErrInvalidGenerateType = errors.New("invalid generate type") )
View Source
var ( ErrEventNotFound = errors.New("event not found") ErrEventDocNotFound = errors.New("event doc not found") )
Functions ¶
func GenImports ¶ added in v0.2.0
func GenImports(data GenImportsData) (string, error)
func GenPackage ¶ added in v0.2.0
func GenPackage(data GenPackageData) (string, error)
func GeneratePublishEvents ¶ added in v0.2.0
func GeneratePublishEvents(o PublishEventsOptions) (string, error)
Types ¶
type GenImportsData ¶ added in v0.2.0
type GenImportsData struct {
Imports map[ImportPkg]ImportAlias
}
type GenPackageData ¶ added in v0.2.0
type GenerateType ¶ added in v0.2.0
type GenerateType string
const ( GenerateTypeService GenerateType = "service" GenerateTypeSubscriber GenerateType = "subscriber" )
func GenerateTypeFromString ¶ added in v0.2.0
func GenerateTypeFromString(t string) (GenerateType, error)
type Generator ¶
type Generator struct { Version string SourceType string Package *packages.Package GenerateType GenerateType ServicePkg string ServiceType string PackageName string // package {{.PackageName}} GenComment bool Imports map[string]string // package->alias Methods []*Method }
func NewGenerator ¶
type ImportAlias ¶ added in v0.2.0
type ImportAlias = string
type Options ¶
type Options struct { ServicePkg string ServiceType string GenComment bool GenerateType GenerateType }
type PublishEventsOptions ¶ added in v0.2.0
type Subscriber ¶ added in v0.2.3
Click to show internal directories.
Click to hide internal directories.