Documentation
¶
Index ¶
- func APIRefTemplateHelpers(apiRefCollector *APIReferenceCollector) template.FuncMap
- func DynamicFilesTemplateHelpers() template.FuncMap
- func GeneratedCommentHeader(config languages.Config) codejen.FileMapper
- func If[Input any](condition bool, innerJenny codejen.OneToMany[Input]) codejen.OneToMany[Input]
- func NoopImportSanitizer(s string) string
- func PathPrefixer(prefix string, opts ...PathPrefixerOption) codejen.FileMapper
- func TypeResolvingTemplateHelpers(context languages.Context) template.FuncMap
- func TypesTemplateHelpers() template.FuncMap
- type APIReference
- type APIReferenceCollector
- func (collector *APIReferenceCollector) BuilderMethod(builder ast.Builder, methodReference MethodReference)
- func (collector *APIReferenceCollector) FunctionsForPackage(pkg string) []FunctionReference
- func (collector *APIReferenceCollector) MethodsForBuilder(builder ast.Builder) []MethodReference
- func (collector *APIReferenceCollector) MethodsForObject(object ast.Object) []MethodReference
- func (collector *APIReferenceCollector) ObjectMethod(object ast.Object, methodReference MethodReference)
- func (collector *APIReferenceCollector) RegisterFunction(pkg string, functionReference FunctionReference)
- type APIReferenceFormatter
- type ArgumentReference
- type BuildOptions
- type CustomTemplates
- type DirectImportMap
- type DynamicFiles
- type FunctionReference
- type ImportMapConfig
- type ImportMapOption
- func WithAliasSanitizer[M any](sanitizer func(string) string) ImportMapOption[M]
- func WithFormatter[M any](formatter func(M) string) ImportMapOption[M]
- func WithImportPathSanitizer[M any](sanitizer func(string) string) ImportMapOption[M]
- func WithPackagesImportMap[M any](packagesImportMap map[string]string) ImportMapOption[M]
- type MethodReference
- type PathPrefixerOption
- type RepositoryTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIRefTemplateHelpers ¶ added in v0.0.12
func APIRefTemplateHelpers(apiRefCollector *APIReferenceCollector) template.FuncMap
func DynamicFilesTemplateHelpers ¶ added in v0.0.13
func GeneratedCommentHeader ¶
func GeneratedCommentHeader(config languages.Config) codejen.FileMapper
GeneratedCommentHeader produces a FileMapper that injects a comment header onto a codejen.File indicating the jenny or jennies that constructed the file.
func NoopImportSanitizer ¶
func PathPrefixer ¶
func PathPrefixer(prefix string, opts ...PathPrefixerOption) codejen.FileMapper
PathPrefixer returns a FileMapper that injects the provided path prefix to files passed through it.
func TypesTemplateHelpers ¶ added in v0.0.15
Types ¶
type APIReference ¶
type APIReference struct { Collector *APIReferenceCollector Language string Formatter APIReferenceFormatter Tmpl *template.Template }
func (APIReference) JennyName ¶
func (jenny APIReference) JennyName() string
type APIReferenceCollector ¶
type APIReferenceCollector struct {
// contains filtered or unexported fields
}
func NewAPIReferenceCollector ¶
func NewAPIReferenceCollector() *APIReferenceCollector
func (*APIReferenceCollector) BuilderMethod ¶
func (collector *APIReferenceCollector) BuilderMethod(builder ast.Builder, methodReference MethodReference)
func (*APIReferenceCollector) FunctionsForPackage ¶
func (collector *APIReferenceCollector) FunctionsForPackage(pkg string) []FunctionReference
func (*APIReferenceCollector) MethodsForBuilder ¶
func (collector *APIReferenceCollector) MethodsForBuilder(builder ast.Builder) []MethodReference
func (*APIReferenceCollector) MethodsForObject ¶
func (collector *APIReferenceCollector) MethodsForObject(object ast.Object) []MethodReference
func (*APIReferenceCollector) ObjectMethod ¶
func (collector *APIReferenceCollector) ObjectMethod(object ast.Object, methodReference MethodReference)
func (*APIReferenceCollector) RegisterFunction ¶
func (collector *APIReferenceCollector) RegisterFunction(pkg string, functionReference FunctionReference)
type APIReferenceFormatter ¶
type APIReferenceFormatter struct { KindName func(kind ast.Kind) string FunctionSignature func(context languages.Context, function FunctionReference) string ObjectName func(object ast.Object) string ObjectDefinition func(context languages.Context, object ast.Object) string MethodName func(method MethodReference) string MethodSignature func(context languages.Context, method MethodReference) string BuilderName func(builder ast.Builder) string ConstructorSignature func(context languages.Context, builder ast.Builder) string OptionName func(option ast.Option) string OptionSignature func(context languages.Context, builder ast.Builder, option ast.Option) string }
type ArgumentReference ¶
type BuildOptions ¶
type BuildOptions struct {
Languages []string
}
type CustomTemplates ¶ added in v0.0.9
type CustomTemplates struct { TmplFuncs template.FuncMap TemplateDirectories []string Data map[string]any ExtraData map[string]string }
CustomTemplates allows the addition of user-originated templates and files to be included in the codegen pipeline's output.
func (CustomTemplates) JennyName ¶ added in v0.0.9
func (jenny CustomTemplates) JennyName() string
type DirectImportMap ¶
type DirectImportMap struct { Imports *orderedmap.Map[string, string] // alias → importPath // contains filtered or unexported fields }
func NewDirectImportMap ¶
func NewDirectImportMap(opts ...ImportMapOption[DirectImportMap]) *DirectImportMap
func (DirectImportMap) IsIdentical ¶
func (im DirectImportMap) IsIdentical(aliasA string, aliasB string) bool
func (DirectImportMap) String ¶
func (im DirectImportMap) String() string
type DynamicFiles ¶ added in v0.0.13
type DynamicFiles struct { Tmpl *template.Template Data map[string]any FuncsProvider func(context languages.Context) template.FuncMap }
func (DynamicFiles) JennyName ¶ added in v0.0.13
func (jenny DynamicFiles) JennyName() string
type FunctionReference ¶
type FunctionReference struct { Name string Comments []string Arguments []ArgumentReference Return string }
type ImportMapConfig ¶
type ImportMapOption ¶
type ImportMapOption[M any] func(importMap *ImportMapConfig[M])
func WithAliasSanitizer ¶
func WithAliasSanitizer[M any](sanitizer func(string) string) ImportMapOption[M]
func WithFormatter ¶
func WithFormatter[M any](formatter func(M) string) ImportMapOption[M]
func WithImportPathSanitizer ¶
func WithImportPathSanitizer[M any](sanitizer func(string) string) ImportMapOption[M]
func WithPackagesImportMap ¶ added in v0.0.4
func WithPackagesImportMap[M any](packagesImportMap map[string]string) ImportMapOption[M]
type MethodReference ¶
type PathPrefixerOption ¶
type PathPrefixerOption func(*pathPrefixerCfg)
func ExcludeCreatedByJenny ¶ added in v0.0.9
func ExcludeCreatedByJenny(jennyNames ...string) PathPrefixerOption
func PrefixExcept ¶
func PrefixExcept(pathPrefix ...string) PathPrefixerOption
type RepositoryTemplate ¶
func (RepositoryTemplate) Generate ¶
func (jenny RepositoryTemplate) Generate(buildOpts BuildOptions) (codejen.Files, error)
func (RepositoryTemplate) JennyName ¶
func (jenny RepositoryTemplate) JennyName() string
Click to show internal directories.
Click to hide internal directories.