printer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package printer prints generated code into go files.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidData = errors.New("invalid data")

ErrInvalidData is generic error returns when printer got unexpected data.

Functions

func ExtractImportPathFromPath

func ExtractImportPathFromPath(absPath, importPath string) (newImportPath, packageName string)

ExtractImportPathFromPath returns right part of the abs path from first part of the import path. Also returns the last element of the abs path as a package name.

func GetFirstLine

func GetFirstLine(text string) string

GetFirstLine returns first line of the text.

func SetStringIfEmpty

func SetStringIfEmpty(target *string, value string)

SetStringIfEmpty sets string value into pointer of string if target value is empty.

Types

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer contains method to print code.

func New

func New(log *zerolog.Logger, conf *config.Print, stdout io.Writer, version string) *Printer

New creates new printer object.

func (*Printer) Run

func (p *Printer) Run(service *model.Service) error

Run generetes code and prints it to go files.

Directories

Path Synopsis
Package tmpl contains templates of the printer.
Package tmpl contains templates of the printer.

Jump to

Keyboard shortcuts

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