utils

package
v0.0.0-...-762e71e Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileTimeLayout defines output file time layout
	FileTimeLayout = "2006-01-02_15:04:05"
	// LogTimeLayout defines log time layout
	LogTimeLayout = "2006-01-02 15:04:05"
)

Variables

View Source
var (
	// ErrFileOutOfSize describes file out of size
	ErrFileOutOfSize = errors.New("file out of size")
	// ErrEmptyFile describes empty file
	ErrEmptyFile = errors.New("empty file")
	// ErrSourceIsNotFile describes source is not file
	ErrSourceIsNotFile = errors.New("source is not file")
	// ErrDestinationIsNotDir describes is not directory
	ErrDestinationIsNotDir = errors.New("destination is not directory")
)
View Source
var (
	// MaxFileSize defines max size for reading file
	MaxFileSize int64 = 1024 * 1024 * 1024
)

Functions

func Batch

func Batch(bytes [][]byte, processingFunc ConvertFunc) (map[int]string, error)

Batch defines bytes batch processing

func Convert

func Convert(c Converter) (map[int]string, error)

Convert convert chinese from simplicity to traditional or simplicity to traditional

func DestFileName

func DestFileName(src, dest string) (string, error)

DestFileName returns destination file name

func ReadAll

func ReadAll(src string) ([][]byte, error)

ReadAll read all text from file

Types

type ConvertFunc

type ConvertFunc func(in string) (string, error)

ConvertFunc defines convert func when doing batch

type Converter

type Converter interface {
	Convert() (map[int]string, error)
}

Converter is the interface that wraps basic Convert method

Jump to

Keyboard shortcuts

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