util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DoNotEditHead added to the beginning of a file to prompt the user not to edit
	DoNotEditHead = "// Code generated by xmd. DO NOT EDIT!"
)

Variables

This section is empty.

Functions

func GetHead

func GetHead(source string) string

GetHead returns a code head string with source filename

Types

type DefaultTemplate

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

DefaultTemplate is a tool to provides the text/template operations

func With

func With(name string) *DefaultTemplate

With returns a instance of DefaultTemplate

func (*DefaultTemplate) Execute

func (t *DefaultTemplate) Execute(data interface{}) (*bytes.Buffer, error)

Execute returns the codes after the template executed

func (*DefaultTemplate) GoFmt

func (t *DefaultTemplate) GoFmt(format bool) *DefaultTemplate

GoFmt sets the value to goFmt and marks the generated codes will be formatted or not

func (*DefaultTemplate) Parse

func (t *DefaultTemplate) Parse(text string) *DefaultTemplate

Parse accepts a source template and returns DefaultTemplate

func (*DefaultTemplate) SaveTo

func (t *DefaultTemplate) SaveTo(data interface{}, path string, forceUpdate bool) error

SaveTo writes the codes to the target path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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