Documentation
¶
Index ¶
- Variables
- func AddQuery(rawUrl string, key string, value string) (string, error)
- func Copy(src interface{}) interface{}
- func CopySlice[T any](data []T) []T
- func ExistDir(name string) (bool, error)
- func ExistFile(name string) (bool, error)
- func FanOut[T any](data types.IFanOut[T], number int) []T
- func FileSize(file *os.File) (int64, error)
- func FileSizeByPath(path string) (int64, error)
- func FuncCost(start time.Time, printer Printer)
- func GetDateAgo(ago int64, format ...string) string
- func GetTimeFromTimestamp(tm int64, format ...string) string
- func Md5File(path string) (string, error)
- func Mkdirs(path string, perms ...os.FileMode) error
- func QueryUrl(rawUrl string, key string) (string, error)
- func ReadDir(path string) ([]string, []string, error)
- func ReadFile(path string) ([]byte, error)
- func ReadLine(buffer *bufio.Reader) ([]byte, error)
- func ReadLines(path string) ([][]byte, error)
- func ReverseSlice[T any](data []T)
- func RunPeriod(interval time.Duration, handler func(), closeCh ...chan struct{})
- func RunSafe(handler func(), errHandler ...types.ErrHandler)
- func ScanStd(handler LineHandler, hints ...string) error
- func SelectAll[T any](data T, prefix ...string) string
- func SortComparator[T types.IComparator](data T)
- func SortSlice[T types.Ordered](data []T, reverseOpts ...bool)
- func SortSliceWithComparator[T any](data []T, comparator func(i, j int) bool)
- func SplitFile(path string) (string, string, error)
- func UniqueSlice[T comparable](data []T) []T
- func WaitGroup(number int, handler types.WaitGroupHandler, closeHandler ...func()) error
- func WriteFile(path string, content []byte, append bool) (int64, error)
- type IBufferPool
- type ICacheBuffer
- type ILimit
- type IPriorityChan
- type Interface
- type LineHandler
- type Printer
- type SortedMap
- type Tuple
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPermOpen = os.FileMode(0666)
View Source
var LineBreak = []byte{'\n'}
Functions ¶
func Copy ¶
func Copy(src interface{}) interface{}
Copy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type.
func FileSizeByPath ¶
FileSizeByPath 通过路径计算文件的大小(Byte单位)
func GetTimeFromTimestamp ¶
GetTimeFromTimestamp 根据时间戳打印对应的日期
func ReadLine ¶
ReadLine 按行读取文件内容 为了提升性能,使用前需将文件转换为buffer reader file, err := os.Open(path)
if err != nil { return err }
defer file.Close() buffer := bufio.NewReader(file) ReadLine(buffer)
func RunSafe ¶
func RunSafe(handler func(), errHandler ...types.ErrHandler)
func SortSliceWithComparator ¶
SortSliceWithComparator 针对切片的自定义排序
Types ¶
type IBufferPool ¶
func NewBufferPool ¶
func NewBufferPool(baseline int) IBufferPool
type ICacheBuffer ¶
func NewCacheBuffer ¶
func NewCacheBuffer[T any](fetcher types.FetchHandler[T]) ICacheBuffer[T]
type IPriorityChan ¶
type IPriorityChan[T any] interface { Get() T TryGet() T GetWithTimeout(timeout time.Duration) (T, error) HandleSignal(highHandler types.PriorityHandler, lowHandler types.PriorityHandler) error }
func NewPriorityChan ¶
func NewPriorityChan[T any](size int) IPriorityChan[T]
type Interface ¶
type Interface interface {
DeepCopy() interface{}
}
Interface for delegating copy process to type
type LineHandler ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.