file

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoCreateError 文件没有创建异常
	NoCreateError = errcode.NewError(baseCode, "文件没有创建")
	// CanNotCreateError 无法创建文件异常
	CanNotCreateError = errcode.NewError(baseCode+1, "文件无法创建")
)
View Source
var (
	// TemplateFileError ...
	TemplateFileError = errcode.NewError(baseCode+100, "模板文件异常")
)

Functions

func WriteByTMPLFunc

func WriteByTMPLFunc(templatePath string, outPath string, values interface{}, funcs template.FuncMap) error

WriteByTMPLFunc 利用模板写文件 可以匹配函数的模板文件生成 输入: 模板路径 输出路径 参数 调用的函数

func WriteByTMPLSimple

func WriteByTMPLSimple(templatePath string, outPath string, values interface{}) error

WriteByTMPLFunc 利用模板写文件 简单的模板写文件函数,模板中不能包含 输入: 模板路径 输出路径 参数

Types

type FileWriteHandler

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

FileWriteHandler 一个支持线程操作操作的写文件对象

func NewFileWriteHandler

func NewFileWriteHandler(filePath string, channelSize int) (*FileWriteHandler, error)

NewFileWriteHandler 建立一个文件

func (*FileWriteHandler) Close

func (f *FileWriteHandler) Close()

Close ...

func (*FileWriteHandler) Create

func (f *FileWriteHandler) Create() error

Create ...

func (*FileWriteHandler) Write

func (f *FileWriteHandler) Write(p []byte) (n int, err error)

Write 实现Writter接口

Jump to

Keyboard shortcuts

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