utils

package
v0.0.0-...-56c6da6 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeLayout1 = "2006-01-02 15:04:05"
	TimeLayout2 = "20060102150405"
)

Variables

View Source
var Local = time.FixedZone("CST", 8*3600)

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to string without a memory allocation.

func Exists

func Exists(path string) bool

判断文件或文件夹是否存在

func Get

func Get(url string) *requests.Response

func GetNow

func GetNow(layout string) string

func InSlice

func InSlice[T comparable](arr []T, t T) bool

func InitViper

func InitViper(name string) error

func ReadLines

func ReadLines(name string) []string

func RecoverError

func RecoverError(funcs ...func())

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts string to byte slice without a memory allocation.

func TimeFormat

func TimeFormat(layout, t string) string

func Uint64ToByte

func Uint64ToByte(num uint64) []byte

func Unique

func Unique[T comparable](arr []T) []T

func WriteLines

func WriteLines(name string, lines []string)

func Xpath

func Xpath(html string, expr string) []string

Types

type Config

type Config struct {
	Name string
}

Jump to

Keyboard shortcuts

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