io

package module
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// time format of year month day and hour minute seconds
	TimeFormatYMDHMS = "2006-01-02T15:04:05"
	// time format of year month day
	TimeFormatYMD = "2006-01-02"
	// time format with time zone
	TimeFormatYMDHMSZ = "2006-01-02T15:04:05 -0700"
)
View Source
const EmojiListLit = `` /* 43350-byte string literal not displayed */

Variables

View Source
var ErrBadFmt = errors.New("bad format")

ErrBadFmt bad format in file

View Source
var ErrDupData = errors.New("dup data")

ErrDupData indicate duplicate data

View Source
var ErrNoSuch = errors.New("no such")

ErrNoSuch not exists

Functions

func DFSIter

func DFSIter(dir string, cb DFSCallback) map[string]error

func FileMd5

func FileMd5(fn string) (int, string, error)

FileMd5 calc file's md5

func GetLine

func GetLine(url string, lf LineFunc) error

GetLine get http content as file and calls lf on every line

func HasIndex added in v1.0.7

func HasIndex(target string, match []string) bool

HasIndex find if target exists in list match

func ListFiles added in v1.0.7

func ListFiles(dir string, extFilter, nameFilter []string) []string

ListFiles list all files under directory dir extFilter drops the very extension, nameFilter drops the very names

func RandEmoji added in v1.0.8

func RandEmoji(debug bool) rune

func RandInt

func RandInt(w int) int32

RandInt generate a int limited to w

func RandStr

func RandStr(w int) string

RandStr return random string length w

func ReadConfig

func ReadConfig(fn string, conf interface{}) error

ReadConfig read file to interface

func ReadFile

func ReadFile(fn string) ([]byte, error)

ReadFile read all file content as byte

func ReadLine

func ReadLine(fn string, lf LineFunc) error

ReadLine read line and calls back lf

func TimeStr

func TimeStr() string

TimeStr return standard time string

func UnixToBJ

func UnixToBJ(unix int64) time.Time

UnixToBJ unix timestamp to beijing time

func UnixToUSPacific

func UnixToUSPacific(unix int64) time.Time

UnixToUSPacific unix timestamp to the U.S time

func UnixToUTC

func UnixToUTC(unix int64) time.Time

UnixToUTC unix timestamp to utc time

Types

type CallbackError

type CallbackError struct {
	Original error
	LineNum  int
}

func (*CallbackError) Error

func (ce *CallbackError) Error() string

func (*CallbackError) Unwrap

func (ce *CallbackError) Unwrap() error

type DFSCallback

type DFSCallback func(string) error

DFSIter find every file at a dir and calls cb for every file

type LineFunc

type LineFunc func(line string) error

LineFunc read a file into lines

type VersionInfo added in v1.0.14

type VersionInfo struct {
	GoVersion  string
	VcsVersion string
	VcsTime    time.Time
}

func Version added in v1.0.14

func Version() VersionInfo

Jump to

Keyboard shortcuts

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