chaos

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

chaos

codecov go report card test status Apache-2.0 license Go.Dev reference Go project version

Install

go get github.com/chyroc/chaos

Usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainAny added in v0.4.0

func ContainAny(s string, substrList []string) bool

ContainAny contain any of list

func CountPrefix added in v0.3.0

func CountPrefix(s, substr string) int

CountPrefix 和 strings.Count 类似,不过 CountPrefix 只会统计以 substr 开头的个数

当 s=**1** substr=* 的时候,返回 2 当 substr 为空的时候,一定返回 0

func FindLastAfterSubstr added in v0.2.0

func FindLastAfterSubstr(s, substr string) string

FindLastAfterSubstr 寻找字符串 s 中,匹配最后一个 substr 后的字符串

当 substr 为空的时候,必定返回空字符串 当 s==1/2/3 substr=/ 返回 3

func TeeWriter

func TeeWriter(writers []io.Writer, opt *TeeWriterOption) io.Writer

TeeWriter write data to multi writer

Types

type TeeWriterOption

type TeeWriterOption struct {
	// When an error occurs when writing data in multiple writers, exit immediately,
	// instead of writing all the writers,
	// the default is false
	// 当在多个 writer 中写数据发生错误的时候,立刻退出,而不是将所有 writer 都写完,默认是 false
	BreakWhenErr bool `json:"break_when_err"`
}

Directories

Path Synopsis
_examples
internal
cio

Jump to

Keyboard shortcuts

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