utils

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) (int64, error)

func FindIndex added in v0.0.31

func FindIndex[T comparable](array []T, v T) int

index of the first element equaling to v, otherwise return -1

func Map

func Map[T any, M any](s []T, f func(T) M) []M

func RandomString

func RandomString(n int) string

func TopoSort added in v0.0.25

func TopoSort(size int, dependon func(i, j int) bool) (res []int, err error)

dependon: whether i dependon j. Complexity: O(n^2)

Types

type ByteValue

type ByteValue = yutils.ByteValue

type Checksum

type Checksum = yutils.Checksum

comparable

func FileChecksum

func FileChecksum(name string) Checksum

SHA256 hash for file content. for any error, return empty hash

func ReaderChecksum

func ReaderChecksum(reader io.Reader) Checksum

type CtntType

type CtntType = yutils.CtntType
const (
	Cplain CtntType = iota
	Cbinary
	Csource
)

type HashValue

type HashValue = yutils.HashValue

type LangTag

type LangTag = yutils.LangTag
const (
	Lcpp LangTag = iota
	Lcpp11
	Lcpp14
	Lcpp17
	Lcpp20
	Lpython2
	Lpython3
	Lgo
	Ljava
	Lc
	Lplain
	Lpython
)

func SourceLang added in v0.0.26

func SourceLang(s string) LangTag

根据字符串推断程序语言

Jump to

Keyboard shortcuts

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