printer

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

printer

This directory contains code for generating files of code.

Documentation

Overview

Package printer provides support for writing generated code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

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

Code represents a file of code to be printed.

func (*Code) Indent

func (c *Code) Indent()

Indent adds one level of indentation.

func (*Code) Outdent

func (c *Code) Outdent()

Outdent remvoes one level of indentation.

func (*Code) Print

func (c *Code) Print(args ...interface{})

Print adds a line of code using the current indentation. Accepts printf-style format strings and arguments.

func (*Code) PrintIf added in v0.3.0

func (c *Code) PrintIf(condition bool, args ...interface{})

PrintIf adds a line of code using the current indentation if a condition is true. Accepts printf-style format strings and arguments.

func (*Code) String

func (c *Code) String() string

String returns the accumulated code as a string.

Jump to

Keyboard shortcuts

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