codegen

package
v0.280.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

File is a code generation file.

func NewFile

func NewFile(cfg FileConfig) *File

NewFile creates a new code generation file.

func NewMakefile

func NewMakefile(cfg FileConfig) *File

func (*File) GoContent added in v0.63.1

func (f *File) GoContent() (_ []byte, err error)

GoContent returns the formatted Go source of the file.

func (*File) Import

func (f *File) Import(path string) string

Import includes the provided import path in the file's imports and returns a package identifier.

func (*File) P

func (f *File) P(args ...interface{})

P prints args to the generated file.

func (*File) RawContent added in v0.63.1

func (f *File) RawContent() []byte

RawContent returns the raw content of the file.

func (*File) Write

func (f *File) Write(p []byte) (int, error)

Write implements io.Writer.

type FileConfig

type FileConfig struct {
	// Filename of the generated file.
	Filename string
	// Package of the generated file.
	Package string
	// GeneratedBy line to print to the generated file.
	GeneratedBy string
	// BuildTag is an optional build tag to include in the file header.
	BuildTag string
}

FileConfig configures a code generation file.

Jump to

Keyboard shortcuts

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