helper

package
v0.0.0-...-323ef38 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package helper 一些通用的辅助类函数

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpTextFile

func DumpTextFile(path, text string) error

DumpTextFile 将文本内容 text 输出到 path 指定的文件中

func DumpYAMLFile

func DumpYAMLFile(path string, obj interface{}) error

DumpYAMLFile 将 obj 转换成 YAML 格式的文本并输出到 path 指定的文件中

func LoadYAMLFile

func LoadYAMLFile(path string, obj interface{}) error

LoadYAMLFile 加载 YAML 格式的文件 path 中的内容到 obj,obj 必须量个指针。

func ReplaceContent

func ReplaceContent(content, replacement string) string

ReplaceContent 替换 content 中的 %content% 内容为 replacement

Types

type FieldError

type FieldError struct {
	File    string // 所在文件
	Message string // 错误信息
	Field   string // 所在的字段
}

FieldError 表示加载文件出错时的具体的错误信息

func (*FieldError) Error

func (err *FieldError) Error() string

Jump to

Keyboard shortcuts

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