generate

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Fallbacks bool
	// contains filtered or unexported fields
}

Service generate.Service is a type that represents a service for generating documentation. It implements the generate.Service interface. Service stores documentation for code identifiers in each file and can generate documentation for specific identifiers. It has methods to add documentation to a file, get all generations of stored documentation, and generate documentation for a given identifier.

func MockService

func MockService() *Service

MockService is a type that implements the generate.Service interface. It provides functionality for generating documentation for Go code. This type can be used to mock the Service interface and generate documentation in tests. Additionally, it provides methods to add documentation for a given file and identifier, retrieve all generations of documentation, and generate documentation for a given context.

func (*Service) GenerateDoc

func (svc *Service) GenerateDoc(ctx generate.Context) (string, error)

GenerateDoc returns the documentation for the identifier specified in a given file. It takes a generate.Context as an argument and returns the documentation as a string and an error. If there is no documentation for the identifier or file, it will return an empty string and an error. If Fallbacks is set to true, it will return an empty string instead of an error for missing documentation. This function implements the Service interface generate.Service.

func (*Service) Generations

func (svc *Service) Generations() []generate.Generation

Generations returns a slice of generate.Generation(https://pkg.go.dev/github.com/modernice/jotbot/generate#Generation) that represents all the documented identifiers in the Service. Each Generation has its file path, identifier name, and its corresponding documentation.

func (*Service) WithDoc

func (svc *Service) WithDoc(path, identifier, doc string) *Service

WithDoc sets the documentation for a given identifier in a specific file. It returns a pointer to the Service to allow for method chaining. This method belongs to the generate.Service interface generate.Service.

Jump to

Keyboard shortcuts

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