Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/duke-git/lancet

A comprehensive, efficient, and reusable util function library of Go.
https://github.com/duke-git/lancet

generics go golang library lodash utils

Last synced: 6 days ago
JSON representation

A comprehensive, efficient, and reusable util function library of Go.

Awesome Lists containing this project

README

        



![Go version](https://img.shields.io/badge/go-%3E%3Dv1.18-9cf)
[![Release](https://img.shields.io/badge/release-2.3.3-green.svg)](https://github.com/duke-git/lancet/releases)
[![GoDoc](https://godoc.org/github.com/duke-git/lancet/v2?status.svg)](https://pkg.go.dev/github.com/duke-git/lancet/v2)
[![Go Report Card](https://goreportcard.com/badge/github.com/duke-git/lancet/v2)](https://goreportcard.com/report/github.com/duke-git/lancet/v2)
[![test](https://github.com/duke-git/lancet/actions/workflows/codecov.yml/badge.svg?branch=main&event=push)](https://github.com/duke-git/lancet/actions/workflows/codecov.yml)
[![codecov](https://codecov.io/gh/duke-git/lancet/branch/main/graph/badge.svg?token=FC48T1F078)](https://codecov.io/gh/duke-git/lancet)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/duke-git/lancet/blob/main/LICENSE)


Lancet is a comprehensive, efficient, and reusable util function library of go. Inspired by the java apache common package and lodash.js.

## Website | [简体中文](./README_zh-CN.md)

## Features

- 👏 Comprehensive, efficient and reusable.
- 💪 700+ go util functions, support string, slice, datetime, net, crypt...
- 💅 Only depends on two kinds of libraries: go standard library and golang.org/x.
- 🌍 Unit test for every exported function.

## Installation

### Note:

1. For users who use go1.18 and above, it is recommended to install lancet v2.x.x. Cause in v2.x.x all functions were rewritten with generics of go1.18.

```go
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
```

2. For users who use version below go1.18, you should install v1.x.x. The latest of v1.x.x is v1.4.4.

```go
go get github.com/duke-git/lancet // below go1.18, install latest version of v1.x.x
```

## Usage

Lancet organizes the code into package structure, and you need to import the corresponding package name when use it. For example, if you use string-related functions,import the strutil package like below:

```go
import "github.com/duke-git/lancet/v2/strutil"
```

## Example

Here takes the string function Reverse (reverse order string) as an example, and the strutil package needs to be imported.

```go
package main

import (
"fmt"
"github.com/duke-git/lancet/v2/strutil"
)

func main() {
s := "hello"
rs := strutil.Reverse(s)
fmt.Println(rs) //olleh
}
```

## Documentation

### Index

- [Algorithm](#user-content-algorithm)
- [Compare](#user-content-compare)
- [Concurrency](#user-content-concurrency)
- [Condition](#user-content-condition)
- [Convertor](#user-content-convertor)
- [Cryptor](#user-content-cryptor)
- [Datetime](#user-content-datetime)
- [Datastructure](#user-content-datastructure)
- [Fileutil](#user-content-fileutil)
- [Formatter](#user-content-formatter)
- [Function](#user-content-function)
- [Maputil](#user-content-maputil)
- [Mathutil](#user-content-mathutil)
- [Netutil](#user-content-netutil)
- [Pointer](#user-content-pointer)
- [Random](#user-content-random)
- [Retry](#user-content-retry)
- [Slice](#user-content-slice)
- [Stream](#user-content-stream)
- [Structs](#user-content-structs)
- [Strutil](#user-content-strutil)
- [System](#user-content-system)
- [Tuple](#user-content-tuple)
- [Validator](#user-content-validator)
- [Xerror](#user-content-xerror)

1. Algorithm package implements some basic algorithm. eg. sort, search.        index

```go
import "github.com/duke-git/lancet/v2/algorithm"
```

#### Function list:

- **BubbleSort** : sorts slice with bubble sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BubbleSort)]
[[play](https://go.dev/play/p/GNdv7Jg2Taj)]
- **CountSort** : sorts slice with bubble sort algorithm, don't change original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#CountSort)]
[[play](https://go.dev/play/p/tB-Umgm0DrP)]
- **HeapSort** : sorts slice with heap sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#HeapSort)]
[[play](https://go.dev/play/p/u6Iwa1VZS_f)]
- **InsertionSort** : sorts slice with insertion sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#InsertionSort)]
[[play](https://go.dev/play/p/G5LJiWgJJW6)]
- **MergeSort** : sorts slice with merge sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#MergeSort)]
[[play](https://go.dev/play/p/ydinn9YzUJn)]
- **QuickSort** : sorts slice with quick sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#QuickSort)]
[[play](https://go.dev/play/p/7Y7c1Elk3ax)]
- **SelectionSort** : sorts slice with selection sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#SelectionSort)]
[[play](https://go.dev/play/p/oXovbkekayS)]
- **ShellSort** : sorts slice with shell sort algorithm, will change the original slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#ShellSort)]
[[play](https://go.dev/play/p/3ibkszpJEu3)]
- **BinarySearch** : returns the index of target within a sorted slice, use binary search (recursive call itself).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinarySearch)]
[[play](https://go.dev/play/p/t6MeGiUSN47)]
- **BinaryIterativeSearch** : returns the index of target within a sorted slice, use binary search (no recursive).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#BinaryIterativeSearch)]
[[play](https://go.dev/play/p/Anozfr8ZLH3)]
- **LinearSearch** : returns the index of target in slice base on equal function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LinearSearch)]
[[play](https://go.dev/play/p/IsS7rgn5s3x)]
- **LRUCache** : implements memory cache with lru algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/algorithm.md#LRUCache)]
[[play](https://go.dev/play/p/-EZjgOURufP)]

2. Compare package provides a lightweight comparison function on any type.        index

```go
import "github.com/duke-git/lancet/v2/compare"
```

#### Function list:

- **Equal** : Checks if two values are equal or not. (check both type and value)
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#Equal)]
[[play](https://go.dev/play/p/wmVxR-to4lz)]
- **EqualValue** : Checks if two values are equal or not. (check value only)
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#EqualValue)]
[[play](https://go.dev/play/p/fxnna_LLD9u)]
- **LessThan** : Checks if value `left` less than value `right`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessThan)]
[[play](https://go.dev/play/p/cYh7FQQj0ne)]
- **GreaterThan** : Checks if value `left` greater than value `right`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterThan)]
[[play](https://go.dev/play/p/9-NYDFZmIMp)]
- **LessOrEqual** : Checks if value `left` less than or equal than value `right`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#LessOrEqual)]
[[play](https://go.dev/play/p/e4T_scwoQzp)]
- **GreaterOrEqual** : Checks if value `left` less greater or equal than value `right`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#GreaterOrEqual)]
[[play](https://go.dev/play/p/vx8mP0U8DFk)]
- **InDelta** : Checks if two values are equal or not within a delta.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/compare.md#InDelta)]

3. Concurrency package contain some functions to support concurrent programming. eg, goroutine, channel, async.        index

```go
import "github.com/duke-git/lancet/v2/concurrency"
```

#### Function list:

- **NewChannel** : create a Channel pointer instance.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#NewChannel)]
[[play](https://go.dev/play/p/7aB4KyMMp9A)]
- **Bridge** : link multiply channels into one channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/Bridge.md#NewChannel)]
[[play](https://go.dev/play/p/qmWSy1NVF-Y)]
- **FanIn** : merge multiple channels into one channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#FanIn)]
[[play](https://go.dev/play/p/2VYFMexEvTm)]
- **Generate** : creates a channel, then put values into the channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Generate)]
[[play](https://go.dev/play/p/7aB4KyMMp9A)]
- **Or** : read one or more channels into one channel, will close when any readin channel is closed.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Or)]
[[play](https://go.dev/play/p/Wqz9rwioPww)]
- **OrDone** : read a channel into another channel, will close until cancel context.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#OrDone)]
[[play](https://go.dev/play/p/lm_GoS6aDjo)]
- **Repeat** : create channel, put values into the channel repeatedly until cancel the context.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Repeat)]
[[play](https://go.dev/play/p/k5N_ALVmYjE)]
- **RepeatFn** : create a channel, executes fn repeatedly, and put the result into the channel, until close context.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#RepeatFn)]
[[play](https://go.dev/play/p/4J1zAWttP85)]
- **Take** : create a channel whose values are taken from another channel with limit number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Take)]
[[play](https://go.dev/play/p/9Utt-1pDr2J)]
- **Tee** : split one chanel into two channels, until cancel the context.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/concurrency.md#Tee)]
[[play](https://go.dev/play/p/3TQPKnCirrP)]

4. Condition package contains some functions for conditional judgment. eg. And, Or, TernaryOperator...       index

```go
import "github.com/duke-git/lancet/v2/condition"
```

#### Function list:

- **Bool** : returns the truthy value of anything.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Bool)]
[[play](https://go.dev/play/p/ETzeDJRSvhm)]
- **And** : returns true if both a and b are truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#And)]
[[play](https://go.dev/play/p/W1SSUmt6pvr)]
- **Or** : returns false if neither a nor b is truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Or)]
[[play](https://go.dev/play/p/UlQTxHaeEkq)]
- **Xor** : returns true if a or b but not both is truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xor)]
[[play](https://go.dev/play/p/gObZrW7ZbG8)]
- **Nor** : returns true if neither a nor b is truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nor)]
[[play](https://go.dev/play/p/g2j08F_zZky)]
- **Xnor** : returns true if both a and b or neither a nor b are truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Xnor)]
[[play](https://go.dev/play/p/OuDB9g51643)]
- **Nand** : returns false if both a and b are truthy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#Nand)]
[[play](https://go.dev/play/p/vSRMLxLIbq8)]
- **TernaryOperator** : ternary operator.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/condition.md#TernaryOperator)]
[[play](https://go.dev/play/p/ElllPZY0guT)]

5. Convertor package contains some functions for data conversion.        index

```go
import "github.com/duke-git/lancet/v2/convertor"
```

#### Function list:

- **ColorHexToRGB** : convert color hex to color rgb.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorHexToRGB)]
[[play](https://go.dev/play/p/o7_ft-JCJBV)]
- **ColorRGBToHex** : convert rgb color to hex color.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ColorRGBToHex)]
[[play](https://go.dev/play/p/nzKS2Ro87J1)]
- **ToBool** : convert string to bool.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBool)]
[[play](https://go.dev/play/p/ARht2WnGdIN)]
- **ToBytes** : convert value to byte slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToBytes)]
[[play](https://go.dev/play/p/fAMXYFDvOvr)]
- **ToChar** : convert string to char slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChar)]
[[play](https://go.dev/play/p/JJ1SvbFkVdM)]
- **ToChannel** : convert a collection of elements to a read-only channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToChannel)]
[[play](https://go.dev/play/p/hOx_oYZbAnL)]
- **ToFloat** : convert value to float64, if param is a invalid floatable, will return 0.0 and error.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToFloat)]
[[play](https://go.dev/play/p/4YTmPCibqHJ)]
- **ToInt** : convert value to int64 value, if input is not numerical, return 0 and error.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInt)]
[[play](https://go.dev/play/p/9_h9vIt-QZ_b)]
- **ToJson** : convert value to a json string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToJson)]
[[play](https://go.dev/play/p/2rLIkMmXWvR)]
- **ToMap** : convert a slice of structs to a map based on iteratee function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToMap)]
[[play](https://go.dev/play/p/tVFy7E-t24l)]
- **ToPointer** : return a pointer of passed value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToPointer)]
[[play](https://go.dev/play/p/ASf_etHNlw1)]
- **ToString** : convert value to string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToString)]
[[play](https://go.dev/play/p/nF1zOOslpQq)]
- **StructToMap** : convert struct to map, only convert exported struct field.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#StructToMap)]
[[play](https://go.dev/play/p/KYGYJqNUBOI)]
- **MapToSlice** : convert map to slice based on iteratee function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#MapToSlice)]
[[play](https://go.dev/play/p/dmX4Ix5V6Wl)]
- **EncodeByte** : encode data to byte slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#EncodeByte)]
[[play](https://go.dev/play/p/DVmM1G5JfuP)]
- **DecodeByte** : decode byte slice data to target object.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DecodeByte)]
[[play](https://go.dev/play/p/zI6xsmuQRbn)]
- **DeepClone** : creates a deep copy of passed item, can't clone unexported field of struct.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#DeepClone)]
[[play](https://go.dev/play/p/j4DP5dquxnk)]
- **CopyProperties** : copies each field from the source struct into the destination struct.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#CopyProperties)]
[[play](https://go.dev/play/p/oZujoB5Sgg5)]
- **ToInterface** : converts reflect value to its interface type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToInterface)]
[[play](https://go.dev/play/p/syqw0-WG7Xd)]
- **Utf8ToGbk** : converts utf8 encoding data to GBK encoding data
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#Utf8ToGbk)]
[[play](https://go.dev/play/p/9FlIaFLArIL)]
- **GbkToUtf8** : converts GBK encoding data to utf8 encoding data.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#GbkToUtf8)]
[[play](https://go.dev/play/p/OphmHCN_9u8)]
- **ToStdBase64** : converts a value to a string encoded in standard Base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToStdBase64)]
- **ToUrlBase64** : converts a value to a string encoded in url Base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToUrlBase64)]
- **ToRawStdBase64** : converts a value to a string encoded in raw standard Base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawStdBase64)]
- **ToRawUrlBase64** : converts a value to a string encoded in raw url Base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/convertor.md#ToRawUrlBase64)]

6. Cryptor package is for data encryption and decryption.       index

```go
import "github.com/duke-git/lancet/v2/cryptor"
```

#### Function list:

- **AesEcbEncrypt** : encrypt byte slice data with key use AES ECB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbEncrypt)]
[[play](https://go.dev/play/p/zI6xsmuQRbn)]
- **AesEcbDecrypt** : decrypt byte slice data with key use AES ECB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesEcbDecrypt)]
[[play](https://go.dev/play/p/zI6xsmuQRbn)]
- **AesCbcEncrypt** : encrypt byte slice data with key use AES CBC algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcEncrypt)]
[[play](https://go.dev/play/p/IOq_g8_lKZD)]
- **AesCbcDecrypt** : decrypt byte slice data with key use AES CBC algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCbcDecrypt)]
[[play](https://go.dev/play/p/IOq_g8_lKZD)]
- **AesCtrCrypt** : encrypt/ decrypt byte slice data with key use AES CRC algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCtrCrypt)]
[[play](https://go.dev/play/p/SpaZO0-5Nsp)]
- **AesCfbEncrypt** : encrypt byte slice data with key use AES CFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbEncrypt)]
[[play](https://go.dev/play/p/tfkF10B13kH)]
- **AesCfbDecrypt** : decrypt byte slice data with key use AES CFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesCfbDecrypt)]
[[play](https://go.dev/play/p/tfkF10B13kH)]
- **AesOfbEncrypt** : encrypt byte slice data with key use AES OFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbEncrypt)]
[[play](https://go.dev/play/p/VtHxtkUj-3F)]
- **AesOfbDecrypt** : decrypt byte slice data with key use AES OFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesOfbDecrypt)]
[[play](https://go.dev/play/p/VtHxtkUj-3F)]
- **AesGcmEncrypt** : encrypt byte slice data with key use AES GCM algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmEncrypt)]
[[play](https://go.dev/play/p/rUt0-DmsPCs)]
- **AesGcmDecrypt** : decrypt byte slice data with key use AES GCM algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#AesGcmDecrypt)]
[[play](https://go.dev/play/p/rUt0-DmsPCs)]
- **Base64StdEncode** : encode string with base64 encoding.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdEncode)]
[[play](https://go.dev/play/p/VOaUyQUreoK)]
- **Base64StdDecode** : decode string with base64 encoding.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Base64StdDecode)]
[[play](https://go.dev/play/p/RWQylnJVgIe)]
- **DesEcbEncrypt** : encrypt byte slice data with key use DES ECB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbEncrypt)]
[[play](https://go.dev/play/p/8qivmPeZy4P)]
- **DesEcbDecrypt** : decrypt byte slice data with key use DES ECB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesEcbDecrypt)]
[[play](https://go.dev/play/p/8qivmPeZy4P)]
- **DesCbcEncrypt** : encrypt byte slice data with key use DES CBC algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcEncrypt)]
[[play](https://go.dev/play/p/4cC4QvWfe3_1)]
- **DesCbcDecrypt** : decrypt byte slice data with key use DES CBC algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCbcDecrypt)]
[[play](https://go.dev/play/p/4cC4QvWfe3_1)]
- **DesCtrCrypt** : encrypt/decrypt byte slice data with key use DES CRY algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCtrCrypt)]
[[play](https://go.dev/play/p/9-T6OjKpcdw)]
- **DesCfbEncrypt** : encrypt byte slice data with key use DES CFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbEncrypt)]
[[play](https://go.dev/play/p/y-eNxcFBlxL)]
- **DesCfbDecrypt** : decrypt byte slice data with key use DES CFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesCfbDecrypt)]
[[play](https://go.dev/play/p/y-eNxcFBlxL)]
- **DesOfbEncrypt** : encrypt byte slice data with key use DES OFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbEncrypt)]
[[play](https://go.dev/play/p/74KmNadjN1J)]
- **DesOfbDecrypt** : decrypt byte slice data with key use DES OFB algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#DesOfbDecrypt)]
[[play](https://go.dev/play/p/74KmNadjN1J)]
- **HmacMd5** : return the md5 hmac hash of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5)]
[[play](https://go.dev/play/p/uef0q1fz53I)]
- **HmacMd5WithBase64** : return the md5 hmac hash of base64 string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacMd5WithBase64)]
- **HmacSha1** : return the hmac hash of string use sha1.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1)]
[[play](https://go.dev/play/p/1UI4oQ4WXKM)]
- **HmacSha1WithBase64** : return the hmac hash of string use sha1 with base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha1WithBase64)]
[[play](https://go.dev/play/p/47JmmGrnF7B)]
- **HmacSha256** : return the hmac hash of string use sha256.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256)]
[[play](https://go.dev/play/p/HhpwXxFhhC0)]
- **HmacSha256WithBase64** : return the hmac hash of string use sha256 with base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha256WithBase64)]
[[play](https://go.dev/play/p/EKbkUvPTLwO)]
- **HmacSha512** : return the hmac hash of string use sha512.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512)]
[[play](https://go.dev/play/p/59Od6m4A0Ud)]
- **HmacSha512WithBase64** : return the hmac hash of string use sha512 with base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#HmacSha512WithBase64)]
[[play](https://go.dev/play/p/c6dSe3E2ydU)]
- **Md5Byte** : return the md5 string of byte slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5Byte)]
[[play](https://go.dev/play/p/suraalH8lyC)]
- **Md5ByteWithBase64** : return the md5 string of byte slice with base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5ByteWithBase64)]
[[play](https://go.dev/play/p/Tcb-Z7LN2ax)]
- **Md5String** : return the md5 value of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5String)]
[[play](https://go.dev/play/p/1bLcVetbTOI)]
- **Md5StringWithBase64** : return the md5 value of string with base64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5StringWithBase64)]
[[play](https://go.dev/play/p/Lx4gH7Vdr5_y)]
- **Md5File** : return the md5 value of file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Md5File)]
- **Sha1** : return the sha1 value (SHA-1 hash algorithm) of base64 string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1)]
[[play](https://go.dev/play/p/_m_uoD1deMT)]
- **Sha1WithBase64** : return the sha1 value (SHA-1 hash algorithm) of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha1WithBase64)]
[[play](https://go.dev/play/p/fSyx-Gl2l2-)]
- **Sha256** : return the sha256 value (SHA-256 hash algorithm) of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256)]
[[play](https://go.dev/play/p/tU9tfBMIAr1)]
- **Sha256WithBase64** : return the sha256 value (SHA256 hash algorithm) of base64 string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha256WithBase64)]
[[play](https://go.dev/play/p/85IXJHIal1k)]
- **Sha512** : return the sha512 value (SHA-512 hash algorithm) of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512)]
[[play](https://go.dev/play/p/3WsvLYZxsHa)]
- **Sha512WithBase64** : return the sha512 value (SHA-512 hash algorithm) of base64 string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#Sha512WithBase64)]
[[play](https://go.dev/play/p/q_fY2rA-k5I)]
- **GenerateRsaKey** : create rsa private and public pemo file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKey)]
[[play](https://go.dev/play/p/zutRHrDqs0X)]
- **RsaEncrypt** : encrypt data with ras algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncrypt)]
[[play](https://go.dev/play/p/uef0q1fz53I)]
- **RsaDecrypt** : decrypt data with ras algorithm.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecrypt)]
[[play](https://go.dev/play/p/uef0q1fz53I)]
- **GenerateRsaKeyPair** : creates rsa private and public key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#GenerateRsaKeyPair)]
[[play](https://go.dev/play/p/sSVmkfENKMz)]
- **RsaEncryptOAEP** : encrypts the given data with RSA-OAEP.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaEncryptOAEP)]
[[play](https://go.dev/play/p/sSVmkfENKMz)]
- **RsaDecryptOAEP** : decrypts the data with RSA-OAEP
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/cryptor.md#RsaDecryptOAEP)]
[[play](https://go.dev/play/p/sSVmkfENKMz)]

7. Datetime package supports date and time format and compare.        index

```go
import "github.com/duke-git/lancet/v2/datetime"
```

#### Function list:

- **AddDay** : add or sub day to the time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddDay)]
[[play](https://go.dev/play/p/dIGbs_uTdFa)]
- **AddHour** : add or sub day to the time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddHour)]
[[play](https://go.dev/play/p/rcMjd7OCsi5)]
- **AddMinute** : add or sub day to the time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddMinute)]
[[play](https://go.dev/play/p/nT1heB1KUUK)]
- **AddYear** : add or sub year to the time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#AddYear)]
[[play](https://go.dev/play/p/MqW2ujnBx10)]
- **BeginOfMinute** : return the date time at the begin of minute of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMinute)]
[[play](https://go.dev/play/p/ieOLVJ9CiFT)]
- **BeginOfHour** : return the date time at the begin of hour of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfHour)]
[[play](https://go.dev/play/p/GhdGFnDWpYs)]
- **BeginOfDay** : return the date time at the begin of day of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfDay)]
[[play](https://go.dev/play/p/94m_UT6cWs9)]
- **BeginOfWeek** : return the date time at the begin of week of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfWeek)]
[[play](https://go.dev/play/p/ynjoJPz7VNV)]
- **BeginOfMonth** : return the date time at the begin of month of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfMonth)]
[[play](https://go.dev/play/p/bWXVFsmmzwL)]
- **BeginOfYear** : return the date time at the begin of year of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BeginOfYear)]
[[play](https://go.dev/play/p/i326DSwLnV8)]
- **EndOfMinute** : return the date time at the end of minute of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMinute)]
[[play](https://go.dev/play/p/yrL5wGzPj4z)]
- **EndOfHour** : return the date time at the end of hour of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfHour)]
[[play](https://go.dev/play/p/6ce3j_6cVqN)]
- **EndOfDay** : return the date time at the end of day of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfDay)]
[[play](https://go.dev/play/p/eMBOvmq5Ih1)]
- **EndOfWeek** : return the date time at the end of week of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfWeek)]
[[play](https://go.dev/play/p/i08qKXD9flf)]
- **EndOfMonth** : return the date time at the end of month of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfMonth)]
[[play](https://go.dev/play/p/_GWh10B3Nqi)]
- **EndOfYear** : return the date time at the end of year of specific date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#EndOfYear)]
[[play](https://go.dev/play/p/G01cKlMCvNm)]
- **GetNowDate** : return format yyyy-mm-dd of current date.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDate)]
[[play](https://go.dev/play/p/PvfkPpcpBBf)]
- **GetNowTime** : return format hh-mm-ss of current time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowTime)]
[[play](https://go.dev/play/p/l7BNxCkTmJS)]
- **GetNowDateTime** : return format yyyy-mm-dd hh-mm-ss of current datetime.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNowDateTime)]
[[play](https://go.dev/play/p/pI4AqngD0al)]
- **GetTodayStartTime** : return the start time of today, format: yyyy-mm-dd 00:00:00.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayStartTime)]
[[play](https://go.dev/play/p/84siyYF7t99)]
- **GetTodayEndTime** : return the end time of today, format: yyyy-mm-dd 23:59:59.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetTodayEndTime)]
[[play](https://go.dev/play/p/jjrLnfoqgn3)]
- **GetZeroHourTimestamp** : return timestamp of zero hour (timestamp of 00:00).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetZeroHourTimestamp)]
[[play](https://go.dev/play/p/QmL2oIaGE3q)]
- **GetNightTimestamp** : return timestamp of zero hour (timestamp of 23:59).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GetNightTimestamp)]
[[play](https://go.dev/play/p/UolysR3MYP1)]
- **FormatTimeToStr** : convert time to string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatTimeToStr)]
[[play](https://go.dev/play/p/_Ia7M8H_OvE)]
- **FormatStrToTime** : convert string to time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#FormatStrToTime)]
[[play](https://go.dev/play/p/1h9FwdU8ql4)]
- **NewUnix** : return unix timestamp of specific time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnix)]
[[play](https://go.dev/play/p/psoSuh_kLRt)]
- **NewUnixNow** : return unix timestamp of current time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewUnixNow)]
[[play](https://go.dev/play/p/U4PPx-9D0oz)]
- **NewFormat** : return unix timestamp of specific time string, t should be "yyyy-mm-dd hh:mm:ss".
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewFormat)]
[[play](https://go.dev/play/p/VkW08ZOaXPZ)]
- **NewISO8601** : return unix timestamp of specific iso8601 time string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NewISO8601)]
[[play](https://go.dev/play/p/mkhOHQkdeA2)]
- **ToUnix** : return unix timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToUnix)]
[[play](https://go.dev/play/p/_LUiwAdocjy)]
- **ToFormat** : return the time string 'yyyy-mm-dd hh:mm:ss' of unix time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormat)]
[[play](https://go.dev/play/p/VkW08ZOaXPZ)]
- **ToFormatForTpl** : return the time string which format is specific tpl.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToFormatForTpl)]
[[play](https://go.dev/play/p/nyXxXcQJ8L5)]
- **ToIso8601** : return iso8601 time string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#ToIso8601)]
[[play](https://go.dev/play/p/mkhOHQkdeA2)]
- **IsLeapYear** : check if param `year` is leap year or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsLeapYear)]
[[play](https://go.dev/play/p/xS1eS2ejGew)]
- **BetweenSeconds** : returns the number of seconds between two times.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#BetweenSeconds)]
[[play](https://go.dev/play/p/n3YDRyfyXJu)]
- **DayOfYear** : returns which day of the year the parameter date `t` is.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DayOfYear)]
[[play](https://go.dev/play/p/0hjqhTwFNlH)]
- **IsWeekend** : checks if passed time is weekend or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#IsWeekend)]
[[play](https://go.dev/play/p/cupRM5aZOIY)]
- **NowDateOrTime** : returns current datetime with specific format and timezone.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#NowDateOrTime)]
[[play](https://go.dev/play/p/EZ-begEjtT0)]
- **Timestamp** : returns current second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#Timestamp)]
- **TimestampMilli** : returns current mill second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMilli)]
[[play](https://go.dev/play/p/4gvEusOTu1T)]
- **TimestampMicro** : returns current micro second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampMicro)]
[[play](https://go.dev/play/p/2maANglKHQE)]
- **TimestampNano** : returns current nano second timestamp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TimestampNano)]
[[play](https://go.dev/play/p/A9Oq_COrcCF)]
- **TrackFuncTime** : tracks function execution time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#TrackFuncTime)]
[[play](https://go.dev/play/p/QBSEdfXHPTp)]
- **DaysBetween** : returns the number of days between two times.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#DaysBetween)]
[[play](https://go.dev/play/p/qD6qGb3TbOy)]
- **GenerateDatetimesBetween** : returns a slice of strings between two times.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datetime.md#GenerateDatetimesBetween)]
[[play](https://go.dev/play/p/6kHBpAxD9ZC)]

8. Datastructure package contains some common data structure. eg. list, linklist, stack, queue, set, tree, graph.        index

```go
import list "github.com/duke-git/lancet/v2/datastructure/list"
import copyonwritelist "github.com/duke-git/lancet/v2/datastructure/copyonwritelist"
import link "github.com/duke-git/lancet/v2/datastructure/link"
import stack "github.com/duke-git/lancet/v2/datastructure/stack"
import queue "github.com/duke-git/lancet/v2/datastructure/queue"
import set "github.com/duke-git/lancet/v2/datastructure/set"
import tree "github.com/duke-git/lancet/v2/datastructure/tree"
import heap "github.com/duke-git/lancet/v2/datastructure/heap"
import hashmap "github.com/duke-git/lancet/v2/datastructure/hashmap"
import optional "github.com/duke-git/lancet/v2/datastructure/optional"
```

#### Structure list:

- **List** : a linear table, implemented with slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/list.md)]
- **CopyOnWriteList** : a thread-safe list implementation that uses go slicing as its base.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/copyonwritelist.md)]
- **Link** : link list structure, contains singly link and doubly link.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/link.md)]
- **Stack** : stack structure(fifo), contains array stack and link stack.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/stack.md)]
- **Queue** : queue structure(filo), contains array queue, circular queue, link queue and priority queue.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/queue.md)]
- **Set** : a data container, like slice, but element of set is not duplicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/set.md)]
- **Tree** : binary search tree structure.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/tree.md)]
- **Heap** : a binary max heap.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/heap.md)]
- **Hashmap** : hash map structure.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/hashmap.md)]
- **Optional** : Optional container.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/datastructure/optional.md)]

9. Fileutil package implements some basic functions for file operations.        index

```go
import "github.com/duke-git/lancet/v2/fileutil"
```

#### Function list:

- **ClearFile** : write empty string to target file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ClearFile)]
[[play](https://go.dev/play/p/NRZ0ZT-G94H)]
- **CreateFile** : create file in path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateFile)]
[[play](https://go.dev/play/p/lDt8PEsTNKI)]
- **CreateDir** : create directory in absolute path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CreateDir)]
[[play](https://go.dev/play/p/qUuCe1OGQnM)]
- **CopyFile** : copy src file to dest file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyFile)]
[[play](https://go.dev/play/p/Jg9AMJMLrJi)]
- **CopyDir** : copy src directory to dest directory.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CopyDir)]
[[play](https://go.dev/play/p/YAyFTA_UuPb)]
- **FileMode** : return file's mode and permission.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileMode)]
[[play](https://go.dev/play/p/2l2hI42fA3p)]
- **MiMeType** : return file mime type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MiMeType)]
[[play](https://go.dev/play/p/bd5sevSUZNu)]
- **IsExist** : checks if a file or directory exists.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsExist)]
[[play](https://go.dev/play/p/nKKXt8ZQbmh)]
- **IsLink** : checks if a file is symbol link or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsLink)]
[[play](https://go.dev/play/p/TL-b-Kzvf44)]
- **IsDir** : checks if the path is directory or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsDir)]
[[play](https://go.dev/play/p/WkVwEKqtOWk)]
- **ListFileNames** : return all file names in the path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ListFileNames)]
[[play](https://go.dev/play/p/Tjd7Y07rejl)]
- **RemoveFile** : remove file, param should be file path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#RemoveFile)]
[[play](https://go.dev/play/p/P2y0XW8a1SH)]
- **ReadFileToString** : return string of file content.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileToString)]
[[play](https://go.dev/play/p/cmfwp_5SQTp)]
- **ReadFileByLine** : read file line by line, return string slice of file content.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFileByLine)]
[[play](https://go.dev/play/p/svJP_7ZrBrD)]
- **Zip** : create a zip file of fpath, fpath could be a file or a directory.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Zip)]
[[play](https://go.dev/play/p/j-3sWBp8ik_P)]
- **ZipAppendEntry** : append a single file or directory by fpath to an existing zip file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ZipAppendEntry)]
- **UnZip** : unzip the zip file and save it to dest path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#UnZip)]
[[play](https://go.dev/play/p/g0w34kS7B8m)]
- **CurrentPath** : return current absolute path.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#CurrentPath)]
[[play](https://go.dev/play/p/s74a9iBGcSw)]
- **IsZipFile** : checks if file is zip file or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#IsZipFile)]
[[play](https://go.dev/play/p/9M0g2j_uF_e)]
- **FileSize** : return file size in bytes.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#FileSize)]
[[play](https://go.dev/play/p/H9Z05uD-Jjc)]
- **MTime** : return file modified time(unix timestamp).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#MTime)]
[[play](https://go.dev/play/p/s_Tl7lZoAaY)]
- **Sha** : return file sha value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#Sha)]
[[play](https://go.dev/play/p/VfEEcO2MJYf)]
- **ReadCsvFile** : read file content into slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadCsvFile)]
[[play](https://go.dev/play/p/OExTkhGEd3_u)]
- **WriteCsvFile** : write content to target csv file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteCsvFile)]
- **WriteMapsToCsv** : write slice of map to csv file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteMapsToCsv)]
[[play](https://go.dev/play/p/umAIomZFV1c)]
- **WriteBytesToFile** : write bytes to target file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteBytesToFile)]
[[play](https://go.dev/play/p/s7QlDxMj3P8)]
- **WriteStringToFile** : write string to target file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#WriteStringToFile)]
[[play](https://go.dev/play/p/GhLS6d8lH_g)]
- **ReadFile** : read file or url.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ReadFile)]
- **ChunkRead** : reads a block from the file at the specified offset and returns all lines within the block.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ChunkRead)]
[[play](https://go.dev/play/p/r0hPmKWhsgf)]
- **ParallelChunkRead** : reads the file in parallel and send each chunk of lines to the specified channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/fileutil.md#ParallelChunkRead)]
[[play](https://go.dev/play/p/teMXnCsdSEw)]

10. Formatter contains some functions for data formatting.        index

```go
import "github.com/duke-git/lancet/v2/formatter"
```

#### Function list:

- **Comma** : add comma to a number value by every 3 numbers from right, ahead by a prefix symbol char.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Comma)]
[[play](https://go.dev/play/p/eRD5k2vzUVX)]
- **Pretty** : pretty print data to JSON string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#Pretty)]
[[play](https://go.dev/play/p/YsciGj3FH2x)]
- **PrettyToWriter** : pretty encode data to writer.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#PrettyToWriter)]
[[play](https://go.dev/play/p/LPLZ3lDi5ma)]
- **DecimalBytes** : returns a human readable byte size under decimal standard (base 1000).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#DecimalBytes)]
[[play](https://go.dev/play/p/FPXs1suwRcs)]
- **BinaryBytes** : returns a human-readable byte size under binary standard (base 1024).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#BinaryBytes)]
[[play](https://go.dev/play/p/G9oHHMCAZxP)]
- **ParseDecimalBytes** : return the human readable bytes size string into the amount it represents(base 1000).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseDecimalBytes)]
[[play](https://go.dev/play/p/Am98ybWjvjj)]
- **ParseBinaryBytes** : return the human readable bytes size string into the amount it represents(base 1024).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/formatter.md#ParseBinaryBytes)]
[[play](https://go.dev/play/p/69v1tTT62x8)]

11. Function package can control the flow of function execution and support part of functional programming.       index

```go
import "github.com/duke-git/lancet/v2/function"
```

#### Function list:

- **After** : return a function that invokes passed function once the returned function is called more than n times.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#After)]
[[play](https://go.dev/play/p/eRD5k2vzUVX)]
- **Before** : return a function that invokes passed function once the returned function is called less than n times
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Before)]
[[play](https://go.dev/play/p/0HqUDIFZ3IL)]
- **CurryFn** : make a curry function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#CurryFn)]
[[play](https://go.dev/play/p/5HopfDwANKX)]
- **Compose** : compose the functions from right to left.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Compose)]
[[play](https://go.dev/play/p/KKfugD4PKYF)]
- **Delay** : call the function after delayed time.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Delay)]
[[play](https://go.dev/play/p/Ivtc2ZE-Tye)]
- **Debounceddeprecated** : creates a debounced function that delays invoking fn until after wait duration have elapsed since the last time the debounced function was invoked.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounced)]
[[play](https://go.dev/play/p/absuEGB_GN7)]
- **Debounce** : creates a debounced version of the provided function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Debounce)]
[[play](https://go.dev/play/p/-dGFrYn_1Zi)]
- **Throttle** : creates a throttled version of the provided function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Throttle)]
[[play](https://go.dev/play/p/HpoMov-tJSN)]
- **Schedule** : invoke function every duration time, util close the returned bool channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Schedule)]
[[play](https://go.dev/play/p/hbON-Xeyn5N)]
- **Pipeline** : takes a list of functions and returns a function whose param will be passed into the functions one by one.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Pipeline)]
[[play](https://go.dev/play/p/mPdUVvj6HD6)]
- **AcceptIf** : returns another function of the same signature as the apply function but also includes a bool value to indicate success or failure.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#AcceptIf)]
[[play](https://go.dev/play/p/XlXHHtzCf7d)]
- **And** : returns a composed predicate that represents the logical AND of a list of predicates.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#And)]
[[play](https://go.dev/play/p/dTBHJMQ0zD2)]
- **Or** : returns a composed predicate that represents the logical OR of a list of predicates.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Or)]
[[play](https://go.dev/play/p/LitCIsDFNDA)]
- **Negate** : returns a predicate that represents the logical negation of this predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Negate)]
[[play](https://go.dev/play/p/jbI8BtgFnVE)]
- **Nor** : returns a composed predicate that represents the logical NOR of a list of predicates.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nor)]
[[play](https://go.dev/play/p/2KdCoBEOq84)]
- **Nand** : returns a composed predicate that represents the logical Nand of a list of predicates.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Nand)]
[[play](https://go.dev/play/p/Rb-FdNGpgSO)]
- **Xnor** : returns a composed predicate that represents the logical XNOR of a list of predicates.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Xnor)]
[[play](https://go.dev/play/p/FJxko8SFbqc)]
- **Watcher** : Watcher is used for record code execution time. can start/stop/reset the watch timer. get the elapsed time of function execution.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/function.md#Watcher)]
[[play](https://go.dev/play/p/l2yrOpCLd1I)]

12. Maputil package includes some functions to manipulate map.       index

```go
import "github.com/duke-git/lancet/v2/maputil"
```

#### Function list:

- **MapTo** : quick map any value to struct or any base type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapTo)]
[[play](https://go.dev/play/p/4K7KBEPgS5M)]
- **ForEach** : executes iteratee function for every key and value pair in map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ForEach)]
[[play](https://go.dev/play/p/OaThj6iNVXK)]
- **Filter** : iterates over map, return a new map contains all key and value pairs pass the predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Filter)]
[[play](https://go.dev/play/p/fSvF3wxuNG7)]
- **FilterByKeys** : iterates over map, return a new map whose keys are all given keys
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByKeys)]
[[play](https://go.dev/play/p/7ov6BJHbVqh)]
- **FilterByValues** : iterates over map, return a new map whose values are all given values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FilterByValues)]
[[play](https://go.dev/play/p/P3-9MdcXegR)]
- **OmitBy** : the opposite of Filter, removes all the map elements for which the predicate function returns true.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitBy)]
[[play](https://go.dev/play/p/YJM4Hj5hNwm)]
- **OmitByKeys** : the opposite of FilterByKeys, extracts all the map elements which keys are not omitted.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByKeys)]
[[play](https://go.dev/play/p/jXGrWDBfSRp)]
- **OmitByValues** : the opposite of FilterByValues. remove all elements whose value are in the give slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OmitByValues)]
[[play](https://go.dev/play/p/XB7Y10uw20_U)]
- **Intersect** : iterates over maps, return a new map of key and value pairs in all given maps.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Intersect)]
[[play](https://go.dev/play/p/Zld0oj3sjcC)]
- **Keys** : returns a slice of the map's keys.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Keys)]
[[play](https://go.dev/play/p/xNB5bTb97Wd)]
- **KeysBy** : creates a slice whose element is the result of function mapper invoked by every map's key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#KeysBy)]
[[play](https://go.dev/play/p/hI371iB8Up8)]
- **Merge** : merge maps, next key will overwrite previous key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Merge)]
[[play](https://go.dev/play/p/H95LENF1uB-)]
- **Minus** : creates a map of whose key in mapA but not in mapB.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Minus)]
[[play](https://go.dev/play/p/3u5U9K7YZ9m)]
- **Values** : returns a slice of the map's values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Values)]
[[play](https://go.dev/play/p/CBKdUc5FTW6)]
- **ValuesBy** : creates a slice whose element is the result of function mapper invoked by every map's value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ValuesBy)]
[[play](https://go.dev/play/p/sg9-oRidh8f)]
- **MapKeys** : transforms a map to other type map by manipulating it's keys.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapKeys)]
[[play](https://go.dev/play/p/8scDxWeBDKd)]
- **MapValues** : transforms a map to other type map by manipulating it's values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapValues)]
[[play](https://go.dev/play/p/g92aY3fc7Iw)]
- **Entries** : transforms a map into array of key/value pairs.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Entries)]
[[play](https://go.dev/play/p/Ltb11LNcElY)]
- **FromEntries** : creates a map based on a slice of key/value pairs.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#FromEntries)]
[[play](https://go.dev/play/p/fTdu4sCNjQO)]
- **Transform** : transform a map to another type map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#Transform)]
[[play](https://go.dev/play/p/P6ovfToM3zj)]
- **IsDisjoint** : check two map are disjoint if they have no keys in common.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#IsDisjoint)]
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
- **HasKey** : checks if map has key or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#HasKey)]
[[play](https://go.dev/play/p/isZZHOsDhFc)]
- **GetOrSet** : returns value of the given key or set the given value value if not present.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrSet)]
[[play](https://go.dev/play/p/IVQwO1OkEJC)]
- **MapToStruct** : converts map to struct.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#MapToStruct)]
[[play](https://go.dev/play/p/7wYyVfX38Dp)]
- **ToSortedSlicesDefault** : converts a map to two slices sorted by key: one for the keys and another for the values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesDefault)]
[[play](https://go.dev/play/p/43gEM2po-qy)]
- **ToSortedSlicesWithComparator** : converts a map to two slices sorted by key and using a custom comparison function: one for the keys and another for the values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ToSortedSlicesWithComparator)]
[[play](https://go.dev/play/p/0nlPo6YLdt3)]
- **NewOrderedMap** : creates a new OrderedMap.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewOrderedMap)]
[[play](https://go.dev/play/p/Y4ZJ_oOc1FU)]
- **OrderedMap_Set** : sets the given key-value pair for ordered map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Set)]
[[play](https://go.dev/play/p/Y4ZJ_oOc1FU)]
- **OrderedMap_Get** : returns the value for the given key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Get)]
[[play](https://go.dev/play/p/Y4ZJ_oOc1FU)]
- **OrderedMap_Delete** : deletes the key-value pair for the given key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Delete)]
[[play](ttps://go.dev/play/p/5bIi4yaZ3K-)]
- **OrderedMap_Clear** : clears the ordered map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Clear)]
[[play](https://go.dev/play/p/8LwoJyEfuFr)]
- **OrderedMap_Front** : returns the first key-value pair.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Front)]
[[play](https://go.dev/play/p/ty57XSimpoe)]
- **OrderedMap_Back** : returns the last key-value pair.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Back)]
[[play](https://go.dev/play/p/rQMjp1yQmpa)]
- **OrderedMap_Range** : calls the given function for each key-value pair.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Range)]
[[play](https://go.dev/play/p/U-KpORhc7LZ)]
- **OrderedMap_Keys** : returns the keys in order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Keys)]
[[play](https://go.dev/play/p/Vv_y9ExKclA)]
- **OrderedMap_Values** : returns the values in order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Values)]
[[play](https://go.dev/play/p/TWj5n1-PUfx)]
- **OrderedMap_Elements** : returns the key-value pairs in order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Elements)]
[[play](https://go.dev/play/p/4BHG4kKz6bB)]
- **OrderedMap_Len** : returns the number of key-value pairs.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Len)]
[[play](https://go.dev/play/p/cLe6z2VX5N-)]
- **OrderedMap_Contains** : returns true if the given key exists.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Contains)]
[[play](https://go.dev/play/p/QuwqqnzwDNX)]
- **OrderedMap_Iter** : returns a channel that yields key-value pairs in order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_Iter)]
[[play](https://go.dev/play/p/tlq2tdvicPt)]
- **OrderedMap_ReverseIter** : returns a channel that yields key-value pairs in reverse order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_ReverseIter)]
[[play](https://go.dev/play/p/8Q0ssg6hZzO)]
- **OrderedMap_SortByKey** : sorts the map by key given less function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_SortByKey)]
[[play](https://go.dev/play/p/N7hjD_alZPq)]
- **OrderedMap_MarshalJSON** : implements the json.Marshaler interface.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_MarshalJSON)]
[[play](https://go.dev/play/p/C-wAwydIAC7)]
- **OrderedMap_UnmarshalJSON** : implements the json.Unmarshaler interface.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#OrderedMap_UnmarshalJSON)]
[[play](https://go.dev/play/p/t_pkwerIRVx)]
- **NewConcurrentMap** : creates a ConcurrentMap with specific shard count.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#NewConcurrentMap)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **ConcurrentMap_Set** : set the value for a key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Set)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **ConcurrentMap_Get** : get the value stored in the map for a key, or nil if no.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Get)]
[[play](https://go.dev/play/p/3PenTPETJT0)]
- **ConcurrentMap_GetOrSet** : returns the existing value for the key if present.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetOrSet)]
[[play](https://go.dev/play/p/aDcDApOK01a)]
- **ConcurrentMap_Delete** : delete the value for a key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Delete)]
[[play](https://go.dev/play/p/uTIJZYhpVMS)]
- **ConcurrentMap_GetAndDelete** :returns the existing value for the key if present and then delete the value for the key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_GetAndDelete)]
[[play](https://go.dev/play/p/ZyxeIXSZUiM)]
- **ConcurrentMap_Has** : checks if map has the value for a key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Has)]
[[play](https://go.dev/play/p/C8L4ul9TVwf)]
- **ConcurrentMap_Range** : calls iterator sequentially for each key and value present in each of the shards in the map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#ConcurrentMap_Range)]
[[play](https://go.dev/play/p/iqcy7P8P0Pr)]
- **SortByKey** : sorts the map by its keys and returns a new map with sorted keys.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#SortByKey)]
[[play](https://go.dev/play/p/PVdmBSnm6P_W)]
- **GetOrDefault** : returns the value of the given key or a default value if the key is not present.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/maputil.md#GetOrDefault)]
[[play](https://go.dev/play/p/99QjSYSBdiM)]

13. Mathutil package implements some functions for math calculation.        index

```go
import "github.com/duke-git/lancet/v2/mathutil"
```

#### Function list:

- **Average** :return average value of numbers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Average)]
[[play](https://go.dev/play/p/Vv7LBwER-pz)]
- **Exponent** : calculate x^n for int64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Exponent)]
[[play](https://go.dev/play/p/uF3HGNPk8wr)]
- **Fibonacci** :calculate fibonacci number before n for int.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Fibonacci)]
[[play](https://go.dev/play/p/IscseUNMuUc)]
- **Factorial** : calculate x! for uint.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Factorial)]
[[play](https://go.dev/play/p/tt6LdOK67Nx)]
- **Max** : return maximum value of numbers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Max)]
[[play](https://go.dev/play/p/cN8DHI0rTkH)]
- **MaxBy** : return the maximum value of a slice using the given comparator function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MaxBy)]
[[play](https://go.dev/play/p/pbe2MT-7DV2)]
- **Min** : return minimum value of numbers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Min)]
[[play](https://go.dev/play/p/21BER_mlGUj)]
- **MinBy** : return the minimum value of a slice using the given comparator function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#MinBy)]
[[play](https://go.dev/play/p/N9qgYg_Ho6f)]
- **Percent** : calculate the percentage of value to total.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Percent)]
[[play](https://go.dev/play/p/s0NdFCtwuyd)]
- **RoundToFloat** : round up to n decimal places for float64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToFloat)]
[[play](https://go.dev/play/p/ghyb528JRJL)]
- **RoundToString** : round up to n decimal places for float64, return string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RoundToString)]
[[play](https://go.dev/play/p/kZwpBRAcllO)]
- **TruncRound** : round off n decimal places for int64.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#TruncRound)]
[[play](https://go.dev/play/p/aumarSHIGzP)]
- **CeilToFloat** : round float up n decimal places.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToFloat)]
[[play](https://go.dev/play/p/8hOeSADZPCo)]
- **CeilToString** : round float up n decimal places, then conver to string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#CeilToString)]
[[play](https://go.dev/play/p/wy5bYEyUKKG)]
- **FloorToFloat** : round float down n decimal places.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToFloat)]
[[play](https://go.dev/play/p/vbCBrQHZEED)]
- **FloorToString** : round float down n decimal places, then conver to string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#FloorToString)]
[[play](https://go.dev/play/p/Qk9KPd2IdDb)]
- **Range** : Creates a slice of numbers from start with specified count, element step is 1.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)]
[[play](https://go.dev/play/p/9ke2opxa8ZP)]
- **RangeWithStep** : Creates a slice of numbers from start to end with specified step.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Range)]
[[play](https://go.dev/play/p/akLWz0EqOSM)]
- **AngleToRadian** : converts angle value to radian value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#AngleToRadian)]
[[play](https://go.dev/play/p/CIvlICqrHql)]
- **RadianToAngle** : converts radian value to angle value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#RadianToAngle)]
[[play](https://go.dev/play/p/dQtmOTUOMgi)]
- **PointDistance** : get two points distance.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#PointDistance)]
[[play](https://go.dev/play/p/RrG4JIaziM8)]
- **IsPrime** : checks if number is prime number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#IsPrime)]
[[play](https://go.dev/play/p/Rdd8UTHZJ7u)]
- **GCD** : return greatest common divisor (GCD) of integers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#GCD)]
[[play](https://go.dev/play/p/CiEceLSoAKB)]
- **LCM** : return Least Common Multiple (LCM) of integers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#LCM)]
[[play](https://go.dev/play/p/EjcZxfY7G_g)]
- **Cos** : return the cosine of the radian argument.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Cos)]
[[play](https://go.dev/play/p/Sm89LoIfvFq)]
- **Sin** : return the sine of the radian argument.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sin)]
[[play](https://go.dev/play/p/TWMQlMywDsP)]
- **Log** : returns the logarithm of base n.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Log)]
[[play](https://go.dev/play/p/_d4bi8oyhat)]
- **Sum** : return sum of passed numbers.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)]
[[play](https://go.dev/play/p/1To2ImAMJA7)]
- **Abs** : returns the absolute value of param number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Sum)]
[[play](https://go.dev/play/p/fsyBh1Os-1d)]
- **Div** : returns the result of x divided by y.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/mathutil.md#Div)]
[[play](https://go.dev/play/p/WLxDdGXXYat)]

14. Netutil package contains functions to get net information and send http request.        index

```go
import "github.com/duke-git/lancet/v2/netutil"
```

#### Function list:

- **ConvertMapToQueryString** : convert map to sorted url query string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ConvertMapToQueryString)]
[[play](https://go.dev/play/p/jnNt_qoSnRi)]
- **EncodeUrl** : encode url(?a=1&b=[2] -> ?a=1&b=%5B2%5D).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#EncodeUrl)]
[[play](https://go.dev/play/p/bsZ6BRC4uKI)]
- **GetInternalIp** : return internal ipv4.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetInternalIp)]
[[play](https://go.dev/play/p/5mbu-gFp7ei)]
- **GetIps** : return all ipv4 of current system.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetIps)]
[[play](https://go.dev/play/p/NUFfcEmukx1)]
- **GetMacAddrs** : return mac address of current system.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetMacAddrs)]
[[play](https://go.dev/play/p/Rq9UUBS_Xp1)]
- **GetPublicIpInfo** : return [public ip information](http://ip-api.com/json/).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetPublicIpInfo)]
[[play](https://go.dev/play/p/YDxIfozsRHR)]
- **GetRequestPublicIp** : return the http request public ip.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#GetRequestPublicIp)]
[[play](https://go.dev/play/p/kxU-YDc_eBo)]
- **IsPublicIP** : verify a ip is public or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPublicIP)]
[[play](https://go.dev/play/p/nmktSQpJZnn)]
- **IsInternalIP** : verify an ip is intranet or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsInternalIP)]
[[play](https://go.dev/play/p/sYGhXbgO4Cb)]
- **HttpRequest** : a composed http request used for HttpClient send request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpRequest)]
[[play](https://go.dev/play/p/jUSgynekH7G)]
- **HttpClient** : a http client tool, used for sending http request
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpClient)]
[[play](https://go.dev/play/p/jUSgynekH7G)]
- **SendRequest** : send http request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#SendRequest)]
[[play](https://go.dev/play/p/jUSgynekH7G)]
- **DecodeResponse** : decode http response into target object.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DecodeResponse)]
[[play](https://go.dev/play/p/jUSgynekH7G)]
- **StructToUrlValues** : convert struct to url values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#StructToUrlValues)]
[[play](https://go.dev/play/p/pFqMkM40w9z)]
- **HttpGetdeprecated** : send http get request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpGet)]
- **HttpDeletedeprecated** : send http delete request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpDelete)]
- **HttpPostdeprecated** : send http post request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPost)]
- **HttpPutdeprecated** : send http put request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPut)]
- **HttpPatchdeprecated** : send http patch request.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#HttpPatch)]
- **ParseHttpResponse** : decode http response into target object.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#ParseHttpResponse)]
- **DownloadFile** : download the file exist in url to a local file.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#DownloadFile)]
- **UploadFile** : upload the file to a server.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#UploadFile)]
- **IsPingConnected** : checks if can ping the specified host or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsPingConnected)]
[[play](https://go.dev/play/p/q8OzTijsA87)]
- **IsTelnetConnected** : checks if can if can telnet the specified host or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/netutil.md#IsTelnetConnected)]
[[play](https://go.dev/play/p/yiLCGtQv_ZG)]

15. Pointer package contains some util functions to operate go pointer.        index

```go
import "github.com/duke-git/lancet/v2/pointer"
```

#### Function list:

- **ExtractPointer** : return the underlying value by the given interface type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#ExtractPointer)]
[[play](https://go.dev/play/p/D7HFjeWU2ZP)]
- **Of** : return a pointer to the value `v`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Of)]
[[play](https://go.dev/play/p/HFd70x4DrMj)]
- **Unwrap** : return the value from the pointer.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#Unwrap)]
[[play](https://go.dev/play/p/cgeu3g7cjWb)]
- **UnwrapOr** : UnwrapOr returns the value from the pointer or fallback if the pointer is nil.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOr)]
[[play](https://go.dev/play/p/mmNaLC38W8C)]
- **UnwarpOrDefault** : UnwarpOrDefault returns the value from the pointer or the default value if the pointer is nil.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/pointer.md#UnwrapOrDefault)]
[[play](https://go.dev/play/p/ZnGIHf8_o4E)]

16. Random package implements some basic functions to generate random int and string.        index

```go
import "github.com/duke-git/lancet/v2/random"
```

#### Function list:

- **RandBytes** : generate random byte slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBytes)]
[[play](https://go.dev/play/p/EkiLESeXf8d)]
- **RandInt** : generate random int number between min and max.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandInt)]
[[play](https://go.dev/play/p/pXyyAAI5YxD)]
- **RandString** : generate random string of specific length.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandString)]
[[play](https://go.dev/play/p/W2xvRUXA7Mi)]
- **RandUpper** : generate a random upper case string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUpper)]
[[play](https://go.dev/play/p/29QfOh0DVuh)]
- **RandLower** : generate a random lower case string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandLower)]
[[play](https://go.dev/play/p/XJtZ471cmtI)]
- **RandNumeral** : generate a random numeral string of specific length.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeral)]
[[play](https://go.dev/play/p/g4JWVpHsJcf)]
- **RandNumeralOrLetter** : generate a random numeral or letter string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandNumeralOrLetter)]
[[play](https://go.dev/play/p/19CEQvpx2jD)]
- **UUIdV4** : generate a random UUID of version 4 according to RFC 4122.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#UUIdV4)]
[[play](https://go.dev/play/p/_Z9SFmr28ft)]
- **RandUniqueIntSlice** : generate a slice of random int that do not repeat.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUniqueIntSlice)]
[[play](https://go.dev/play/p/uBkRSOz73Ec)]
- **RandSymbolChar** : generate a random symbol char of specified length.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSymbolChar)]
[[play](https://go.dev/play/p/Im6ZJxAykOm)]
- **RandFloat** : generate a random float64 number between [min, max) with specific precision.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloat)]
[[play](https://go.dev/play/p/zbD_tuobJtr)]
- **RandFloats** : generate a slice of random float64 numbers that do not repeat.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloats)]
[[play](https://go.dev/play/p/I3yndUQ-rhh)]
- **RandStringSlice** : generate a slice of random string of length strLen based on charset.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandStringSlice)]
[[play](https://go.dev/play/p/2_-PiDv3tGn)]
- **RandBool** : generate a random boolean value (true or false).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBool)]
[[play](https://go.dev/play/p/to6BLc26wBv)]
- **RandBoolSlice** : generate a random boolean slice of specified length.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandBoolSlice)]
[[play](https://go.dev/play/p/o-VSjPjnILI)]
- **RandIntSlice** : generate a slice of random int. Number range in [min, max)
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandIntSlice)]
[[play](https://go.dev/play/p/GATTQ5xTEG8)]
- **RandFromGivenSlice** : generate a random element from given slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFromGivenSlice)]
[[play](https://go.dev/play/p/UrkWueF6yYo)]
- **RandSliceFromGivenSlice** : generate a random slice of length num from given slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSliceFromGivenSlice)]
[[play](https://go.dev/play/p/68UikN9d6VT)]

17. Retry package is for executing a function repeatedly until it was successful or canceled by the context.        index

```go
import "github.com/duke-git/lancet/v2/retry"
```

#### Function list:

- **Context** : set retry context config option.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Context)]
[[play](https://go.dev/play/p/xnAOOXv9GkS)]
- **Retry** : executes the retryFunc repeatedly until it was successful or canceled by the context.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#Retry)]
[[play](https://go.dev/play/p/nk2XRmagfVF)]
- **RetryFunc** : function that retry executes.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryFunc)]
[[play](https://go.dev/play/p/nk2XRmagfVF)]
- **RetryDuration** : set duration of retry
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryDuration)]
[[play](https://go.dev/play/p/nk2XRmagfVF)]
- **RetryTimes** : set times of retry.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryTimes)]
[[play](https://go.dev/play/p/ssfVeU2SwLO)]
- **BackoffStrategy** : An interface that defines a method for calculating backoff intervals.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#BackoffStrategy)]
- **RetryWithCustomBackoff** : set abitary custom backoff strategy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithCustomBackoff)]
[[play](https://go.dev/play/p/jIm_o2vb5Y4)]
- **RetryWithLinearBackoff** : set linear strategy backoff.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithLinearBackoff)]
[[play](https://go.dev/play/p/PDet2ZQZwcB)]
- **RetryWithExponentialWithJitterBackoff** : set exponential strategy backoff.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/retry.md#RetryWithExponentialWithJitterBackoff)]
[[play](https://go.dev/play/p/xp1avQmn16X)]

18. Slice contains some functions to manipulate slice.        index

```go
import "github.com/duke-git/lancet/v2/slice"
```

#### Function list:

- **AppendIfAbsent** : if the item is absent,append it to the slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#AppendIfAbsent)]
[[play](https://go.dev/play/p/GNdv7Jg2Taj)]
- **Contain** : check if the value is in the slice or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Contain)]
[[play](https://go.dev/play/p/_454yEHcNjf)]
- **ContainBy** : returns true if predicate function return true.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainBy)]
[[play](https://go.dev/play/p/49tkHfX4GNc)]
- **ContainSubSlice** : check if the slice contain a given subslice or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ContainSubSlice)]
[[play](https://go.dev/play/p/bcuQ3UT6Sev)]
- **Chunk** : creates a slice of elements split into groups the length of size.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Chunk)]
[[play](https://go.dev/play/p/b4Pou5j2L_C)]
- **Compact** : creates an slice with all falsy values removed. The values false, nil, 0, and "" are falsy.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Compact)]
[[play](https://go.dev/play/p/pO5AnxEr3TK)]
- **Concat** : creates a new slice concatenating slice with any additional slices.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Concat)]
[[play](https://go.dev/play/p/gPt-q7zr5mk)]
- **Count** : returns the number of occurrences of the given item in the slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Count)]
[[play](https://go.dev/play/p/Mj4oiEnQvRJ)]
- **CountBy** : iterates over elements of slice with predicate function, returns the number of all matched elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#CountBy)]
[[play](https://go.dev/play/p/tHOccTMDZCC)]
- **Difference** : creates an slice of whose element in slice but not in compared slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Difference)]
[[play](https://go.dev/play/p/VXvadzLzhDa)]
- **DifferenceBy** : accepts iteratee which is invoked for each element of slice and values to generate the criterion by which they're compared.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceBy)]
[[play](https://go.dev/play/p/DiivgwM5OnC)]
- **DifferenceWith** : accepts comparator which is invoked to compare elements of slice to values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DifferenceWith)]
[[play](https://go.dev/play/p/v2U2deugKuV)]
- **DeleteAt** : delete the element of slice at index.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteAt)]
[[play](https://go.dev/play/p/800B1dPBYyd)]
- **DeleteRange** : delete the element of slice from start index to end index(exclude).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DeleteRange)]
[[play](https://go.dev/play/p/945HwiNrnle)]
- **Drop** : drop n elements from the start of a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Drop)]
[[play](https://go.dev/play/p/jnPO2yQsT8H)]
- **DropRight** : drop n elements from the end of a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRight)]
[[play](https://go.dev/play/p/8bcXvywZezG)]
- **DropWhile** : drop n elements from the start of a slice while predicate function returns true.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropWhile)]
[[play](https://go.dev/play/p/4rt252UV_qs)]
- **DropRightWhile** : drop n elements from the end of a slice while predicate function returns true.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#DropRightWhile)]
[[play](https://go.dev/play/p/6wyK3zMY56e)]
- **Equal** : checks if two slices are equal: the same length and all elements' order and value are equal.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Equal)]
[[play](https://go.dev/play/p/WcRQJ37ifPa)]
- **EqualWith** : checks if two slices are equal with comparator func.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#EqualWith)]
[[play](https://go.dev/play/p/b9iygtgsHI1)]
- **Every** : return true if all of the values in the slice pass the predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Every)]
[[play](https://go.dev/play/p/R8U6Sl-j8cD)]
- **Filter** : iterates over elements of slice, returning an slice of all elements pass the predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Filter)]
[[play](https://go.dev/play/p/SdPna-7qK4T)]
- **FilterMap** : returns a slice which apply both filtering and mapping to the given slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FilterMap)]
[[play](https://go.dev/play/p/J94SZ_9MiIe)]
- **Finddeprecated** : iterates over elements of slice, returning the first one that passes a truth test on predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Find)]
[[play](https://go.dev/play/p/CBKeBoHVLgq)]
- **FindBy** : iterates over elements of slice, returning the first one that passes a truth test on predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindBy)]
[[play](https://go.dev/play/p/n1lysBYl-GB)]
- **FindLastdeprecated** : return the last item that passes a truth test on predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLast)]
[[play](https://go.dev/play/p/FFDPV_j7URd)]
- **FindLastBy** : iterates over elements of slice, returning the last one that passes a truth test on predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FindLastBy)]
[[play](https://go.dev/play/p/8iqomzyCl_s)]
- **Flatten** : flattens slice one level.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Flatten)]
[[play](https://go.dev/play/p/hYa3cBEevtm)]
- **FlattenDeep** : flattens slice recursive to one level.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlattenDeep)]
[[play](https://go.dev/play/p/yjYNHPyCFaF)]
- **FlatMap** : manipulates a slice and transforms and flattens it to a slice of another type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#FlatMap)]
[[play](https://go.dev/play/p/_QARWlWs1N_F)]
- **ForEach** : iterates over elements of slice and invokes function for each element.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEach)]
[[play](https://go.dev/play/p/DrPaa4YsHRF)]
- **ForEachWithBreak** : iterates over elements of slice and invokes function for each element, when iteratee return false, will break the for each loop.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachWithBreak)]
[[play](https://go.dev/play/p/qScs39f3D9W)]
- **ForEachConcurrent** : applies the iteratee function to each item in the slice concurrently.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ForEachConcurrent)]
[[play](https://go.dev/play/p/kT4XW7DKVoV)]
- **GroupBy** : iterate over elements of the slice, each element will be group by criteria, returns two slices.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupBy)]
[[play](https://go.dev/play/p/QVkPxzPR0iA)]
- **GroupWith** : return a map composed of keys generated from the results of running each element of slice thru iteratee.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#GroupWith)]
[[play](https://go.dev/play/p/ApCvMNTLO8a)]
- **IntSlicedeprecated** : convert param to int slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IntSlice)]
[[play](https://go.dev/play/p/FdQXF0Vvqs-)]
- **InterfaceSlicedeprecated** : convert param to interface slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InterfaceSlice)]
[[play](https://go.dev/play/p/FdQXF0Vvqs-)]
- **Intersection** : creates a slice of unique elements that included by all slices.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Intersection)]
[[play](https://go.dev/play/p/anJXfB5wq_t)]
- **InsertAt** : insert the value or other slice into slice at index.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#InsertAt)]
[[play](https://go.dev/play/p/hMLNxPEGJVE)]
- **IndexOf** : returns the index at which the first occurrence of an item is found in a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IndexOf)]
[[play](https://go.dev/play/p/MRN1f0FpABb)]
- **LastIndexOf** : returns the index at which the last occurrence of the item is found in a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LastIndexOf)]
[[play](https://go.dev/play/p/DokM4cf1IKH)]
- **Map** : creates an slice of values by running each element of slice thru iteratee function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Map)]
[[play](https://go.dev/play/p/biaTefqPquw)]
- **MapConcurrent** : applies the iteratee function to each item in the slice by concrrent.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#MapConcurrent)]
[[play](https://go.dev/play/p/H1ehfPkPen0)]
- **Merge** : merge all given slices into one slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Merge)]
[[play](https://go.dev/play/p/lbjFp784r9N)]
- **Reverse** : return slice of element order is reversed to the given slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reverse)]
[[play](https://go.dev/play/p/8uI8f1lwNrQ)]
- **Reducedeprecated** : creates an slice of values by running each element of slice thru iteratee function.(Deprecated: use ReduceBy)
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Reduce)]
[[play](https://go.dev/play/p/_RfXJJWIsIm)]
- **ReduceBy** : produces a value from slice by accumulating the result of each element as passed through the reducer function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceBy)]
[[play](https://go.dev/play/p/YKDpLi7gtee)]
- **ReduceRight** : ReduceRight is like ReduceBy, but it iterates over elements of slice from right to left.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceRight)]
[[play](https://go.dev/play/p/qT9dZC03A1K)]
- **ReduceConcurrent** : reduces the slice to a single value by applying the reducer function to each item in the slice concurrently.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReduceConcurrent)]
[[play](https://go.dev/play/p/Tjwe6OtaG07)]
- **Replace** : returns a copy of the slice with the first n non-overlapping instances of old replaced by new.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Replace)]
[[play](https://go.dev/play/p/P5mZp7IhOFo)]
- **ReplaceAll** : returns a copy of the slice with all non-overlapping instances of old replaced by new.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ReplaceAll)]
[[play](https://go.dev/play/p/CzqXMsuYUrx)]
- **Repeat** : creates a slice with length n whose elements are passed item.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Repeat)]
[[play](https://go.dev/play/p/1CbOmtgILUU)]
- **Shuffle** : shuffle the slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Shuffle)]
[[play](https://go.dev/play/p/YHvhnWGU3Ge)]
- **IsAscending** : Checks if a slice is ascending order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsAscending)]
[[play](https://go.dev/play/p/9CtsFjet4SH)]
- **IsDescending** : Checks if a slice is descending order.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsDescending)]
[[play](https://go.dev/play/p/U_LljFXma14)]
- **IsSorted** : Checks if a slice is sorted (ascending or descending).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSorted)]
[[play](https://go.dev/play/p/nCE8wPLwSA-)]
- **IsSortedByKey** : Checks if a slice is sorted by iteratee function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#IsSortedByKey)]
[[play](https://go.dev/play/p/tUoGB7DOHI4)]
- **Sort** : sorts a slice of any ordered type(number or string).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Sort)]
[[play](https://go.dev/play/p/V9AVjzf_4Fk)]
- **SortBy** : sorts the slice in ascending order as determined by the less function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortBy)]
[[play](https://go.dev/play/p/DAhLQSZEumm)]
- **SortByFielddeprecated** : return sorted slice by specific field.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SortByField)]
[[play](https://go.dev/play/p/fU1prOBP9p1)]
- **Some** : return true if any of the values in the list pass the predicate function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Some)]
[[play](https://go.dev/play/p/4pO9Xf9NDGS)]
- **StringSlicedeprecated** : convert param to slice of string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#StringSlice)]
[[play](https://go.dev/play/p/W0TZDWCPFcI)]
- **SymmetricDifference** : the symmetric difference of two slice, also known as the disjunctive union.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#h42nJX5xMln)]
[[play](https://go.dev/play/p/1CbOmtgILUU)]
- **ToSlice** : returns a slices of a variable parameter transformation.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlice)]
[[play](https://go.dev/play/p/YzbzVq5kscN)]
- **ToSlicePointer** : returns a pointer to the slices of a variable parameter transformation.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#ToSlicePointer)]
[[play](https://go.dev/play/p/gx4tr6_VXSF)]
- **Unique** : remove duplicate elements in slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Unique)]
[[play](https://go.dev/play/p/AXw0R3ZTE6a)]
- **UniqueBy** : remove duplicate elements from the input slice based on the values returned by the iteratee function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueBy)]
[[play](https://go.dev/play/p/GY7JE4yikrl)]
- **UniqueByComparator** : remove duplicate elements from the input slice using the provided comparator function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByComparator)]
[[play](https://go.dev/play/p/rwSacr-ZHsR)]
- **UniqueByField** : remove duplicate elements in struct slice by struct field.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByField)]
[[play](https://go.dev/play/p/6cifcZSPIGu)]
- **UniqueByConcurrent** : remove duplicate elements from the slice by concurrent.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UniqueByConcurrent)]
[[play](https://go.dev/play/p/wXZ7LcYRMGL)]
- **Union** : creates a slice of unique elements, in order, from all given slices.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Union)]
[[play](https://go.dev/play/p/hfXV1iRIZOf)]
- **UnionBy** : accepts iteratee which is invoked for each element of each slice, then union slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UnionBy)]
[[play](https://go.dev/play/p/HGKHfxKQsFi)]
- **UpdateAt** : update the slice element at index.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#UpdateAt)]
[[play](https://go.dev/play/p/f3mh2KloWVm)]
- **Without** : creates a slice excluding all given items.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Without)]
[[play](https://go.dev/play/p/bwhEXEypThg)]
- **KeyBy** : converts a slice to a map based on a callback function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#KeyBy)]
[[play](https://go.dev/play/p/uXod2LWD1Kg)]
- **Join** : join the slice item with specify separator.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Join)]
[[play](https://go.dev/play/p/huKzqwNDD7V)]
- **Partition** : partition all slice elements with the evaluation of the given predicate functions.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Partition)]
[[play](https://go.dev/play/p/lkQ3Ri2NQhV)]
- **Random** : get a random item of slice, return its index, when slice is empty, return -1.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Random)]
[[play](https://go.dev/play/p/UzpGQptWppw)]
- **SetToDefaultIf** : set elements to their default value if they match the given predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#SetToDefaultIf)]
[[play](https://go.dev/play/p/9AXGlPRC0-A)]
- **Break** : breaks a list into two parts at the point where the predicate for the first time is true.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Break)]
- **RightPadding** : adds padding to the right end of a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#RightPadding)]
[[play](https://go.dev/play/p/0_2rlLEMBXL)]
- **LeftPadding** : adds padding to the left begin of a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#LeftPadding)]
[[play](https://go.dev/play/p/jlQVoelLl2k)]
- **Frequency** : counts the frequency of each element in the slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Frequency)]
[[play](https://go.dev/play/p/CW3UVNdUZOq)]

19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited.        index

```go
import "github.com/duke-git/lancet/v2/stream"
```

#### Function list:

- **Of** : creates a stream whose elements are the specified values.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Of)]
[[play](https://go.dev/play/p/jI6_iZZuVFE)]
- **FromSlice** : creates a stream from slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromSlice)]
[[play](https://go.dev/play/p/wywTO0XZtI4)]
- **FromChannel** : creates a stream from channel.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromChannel)]
[[play](https://go.dev/play/p/9TZYugGMhXZ)]
- **FromRange** : creates a number stream from start to end. both start and end are included. [start, end]
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FromRange)]
[[play](https://go.dev/play/p/9Ex1-zcg-B-)]
- **Generate** : creates a stream where each element is generated by the provided generator function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Generate)]
[[play](https://go.dev/play/p/rkOWL1yA3j9)]
- **Concat** : creates a lazily concatenated stream whose elements are all the elements of the first stream followed by all the elements of the second stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Concat)]
[[play](https://go.dev/play/p/HM4OlYk_OUC)]
- **Distinct** : creates returns a stream that removes the duplicated items.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Distinct)]
[[play](https://go.dev/play/p/eGkOSrm64cB)]
- **Filter** : returns a stream consisting of the elements of this stream that match the given predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Filter)]
[[play](https://go.dev/play/p/MFlSANo-buc)]
- **FilterConcurrent** : Applies the provided filter function `predicate` to each element of the input slice concurrently.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FilterConcurrent)]
[[play](https://go.dev/play/p/t_pkwerIRVx)]
- **Map** : returns a stream consisting of the elements of this stream that apply the given function to elements of stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Map)]
[[play](https://go.dev/play/p/OtNQUImdYko)]
- **Peek** : returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Peek)]
[[play](https://go.dev/play/p/u1VNzHs6cb2)]
- **Skip** : returns a stream consisting of the remaining elements of this stream after discarding the first n elements of the stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Skip)]
[[play](https://go.dev/play/p/fNdHbqjahum)]
- **Limit** : returns a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Limit)]
[[play](https://go.dev/play/p/qsO4aniDcGf)]
- **Reverse** : returns a stream whose elements are reverse order of given stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reverse)]
[[play](https://go.dev/play/p/A8_zkJnLHm4)]
- **Range** : returns a stream whose elements are in the range from start(included) to end(excluded) original stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Range)]
[[play](https://go.dev/play/p/indZY5V2f4j)]
- **Sorted** : returns a stream consisting of the elements of this stream, sorted according to the provided less function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Sorted)]
[[play](https://go.dev/play/p/XXtng5uonFj)]
- **ForEach** : performs an action for each element of this stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ForEach)]
[[play](https://go.dev/play/p/Dsm0fPqcidk)]
- **Reduce** : performs a reduction on the elements of this stream, using an associative accumulation function, and returns an Optional describing the reduced value, if any.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Reduce)]
[[play](https://go.dev/play/p/6uzZjq_DJLU)]
- **FindFirst** : returns the first element of this stream and true, or zero value and false if the stream is empty.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindFirst)]
[[play](https://go.dev/play/p/9xEf0-6C1e3)]
- **FindLast** : returns the last element of this stream and true, or zero value and false if the stream is empty.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#FindLast)]
[[play](https://go.dev/play/p/WZD2rDAW-2h)]
- **Max** : returns the maximum element of this stream according to the provided less function. less function: a > b
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Max)]
[[play](https://go.dev/play/p/fm-1KOPtGzn)]
- **Min** : returns the minimum element of this stream according to the provided less function. less function: a < b
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Min)]
[[play](https://go.dev/play/p/vZfIDgGNRe_0)]
- **AllMatch** : returns whether all elements of this stream match the provided predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AllMatch)]
[[play](https://go.dev/play/p/V5TBpVRs-Cx)]
- **AnyMatch** : returns whether any elements of this stream match the provided predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#AnyMatch)]
[[play](https://go.dev/play/p/PTCnWn4OxSn)]
- **NoneMatch** : returns whether no elements of this stream match the provided predicate.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#NoneMatch)]
[[play](https://go.dev/play/p/iWS64pL1oo3)]
- **Count** : returns the count of elements in the stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#Count)]
[[play](https://go.dev/play/p/r3koY6y_Xo-)]
- **ToSlice** : returns the elements in the stream.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/stream.md#ToSlice)]
[[play](https://go.dev/play/p/jI6_iZZuVFE)]

20. Structs package provides several high level functions to manipulate struct, tag, and field.        index

```go
import "github.com/duke-git/lancet/v2/structs"
```

#### Function list:

- **New** : creates a `Struct` instance.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#New)]
- **ToMap** : converts a valid struct to a map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#ToMap)]
- **Fields** : get all fields of a given struct, that the fields are abstract struct field.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Fields)]
- **IsStruct** : check if the struct is valid.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsStruct)]
- **Tag** : get a `Tag` of the `Field`, `Tag` is a abstract struct field tag.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Tag)]
- **Name** : get the field name.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Name)]
- **Value** : get the `Field` underlying value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Value)]
- **Kind** : get the field's kind.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#Kind)]
- **IsEmbedded** : check if the field is an embedded field.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsEmbedded)]
- **IsExported** : check if the field is exported.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsExported)]
- **IsZero** : check if the field is zero value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsZero)]
- **IsSlice** : check if the field is a slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsSlice)]
- **IsTargetType** : check if the field is target type.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/struct.md#IsTargetType)]

21. Strutil package contains some functions to manipulate string.        index

```go
import "github.com/duke-git/lancet/v2/strutil"
```

#### Function list:

- **After** : returns the substring after the first occurrence of a specific string in the source string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#After)]
[[play](https://go.dev/play/p/RbCOQqCDA7m)]
- **AfterLast** : returns the substring after the last occurrence of a specific string in the source string. [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#AfterLast)]
[[play](https://go.dev/play/p/1TegARrb8Yn)]
- **Before** : returns the substring before the first occurrence of a specific string in the source string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Before)]
[[play](https://go.dev/play/p/JAWTZDS4F5w)]
- **BeforeLast** : returns the substring before the last occurrence of a specific string in the source string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BeforeLast)]
[[play](https://go.dev/play/p/pJfXXAoG_Te)]
- **CamelCase** : coverts source string to its camelCase string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#CamelCase)]
[[play](https://go.dev/play/p/9eXP3tn2tUy)]
- **Capitalize** : converts the first character of source string to upper case and the remaining to lower case.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Capitalize)]
[[play](https://go.dev/play/p/2OAjgbmAqHZ)]
- **ContainsAll** : return true if target string contains all the substrings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAll)]
[[play](https://go.dev/play/p/KECtK2Os4zq)]
- **ContainsAny** : return true if target string contains any one of the substrings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ContainsAny)]
[[play](https://go.dev/play/p/dZGSSMB3LXE)]
- **IsString** : checks if the parameter value data type is string or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsString)]
[[play](https://go.dev/play/p/IOgq7oF9ERm)]
- **KebabCase** : coverts string to kebab-case string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#KebabCase)]
[[play](https://go.dev/play/p/dcZM9Oahw-Y)]
- **UpperKebabCase** : coverts string to upper KEBAB-CASE string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperKebabCase)]
[[play](https://go.dev/play/p/zDyKNneyQXk)]
- **LowerFirst** : converts the first character of string to lower case.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#LowerFirst)]
[[play](https://go.dev/play/p/CbzAyZmtJwL)]
- **UpperFirst** : converts the first character of string to upper case.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperFirst)]
[[play](https://go.dev/play/p/sBbBxRbs8MM)]
- **Pad** : pads string on the left and right side if it's shorter than size.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Pad)]
[[play](https://go.dev/play/p/NzImQq-VF8q)]
- **PadEnd** : pads string with given characters on the right side if it's shorter than limit size. Padding characters are truncated if they exceed size.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadEnd)]
[[play](https://go.dev/play/p/9xP8rN0vz--)]
- **PadStart** : pads string with given characters on the left side if it's shorter than limit size. Padding characters are truncated if they exceed size.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#PadStart)]
[[play](https://go.dev/play/p/xpTfzArDfvT)]
- **Reverse** : returns string whose char order is reversed to the given string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Reverse)]
[[play](https://go.dev/play/p/adfwalJiecD)]
- **SnakeCase** : coverts string to snake_case string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SnakeCase)]
[[play](https://go.dev/play/p/tgzQG11qBuN)]
- **UpperSnakeCase** : coverts string to upper SNAKE_CASE string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#UpperSnakeCase)]
[[play](https://go.dev/play/p/4COPHpnLx38)]
- **SplitEx** : split a given string which can control the result slice contains empty string or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitEx)]
[[play](https://go.dev/play/p/Us-ySSbWh-3)]
- **Substring** : returns a substring of the specific length starting at the specific offset position.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Substring)]
[[play](https://go.dev/play/p/q3sM6ehnPDp)]
- **Wrap** : wrap a string with given string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Wrap)]
[[play](https://go.dev/play/p/KoZOlZDDt9y)]
- **Unwrap** : unwrap a given string from anther string. will change source string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Unwrap)]
[[play](https://go.dev/play/p/Ec2q4BzCpG-)]
- **SplitWords** : splits a string into words, word only contains alphabetic characters.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitWords)]
[[play](https://go.dev/play/p/KLiX4WiysMM)]
- **WordCount** : return the number of meaningful word of a string, word only contains alphabetic characters.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#WordCount)]
[[play](https://go.dev/play/p/bj7_odx3vRf)]
- **RemoveNonPrintable** : remove non-printable characters from a string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveNonPrintable)]
[[play](https://go.dev/play/p/og47F5x_jTZ)]
- **StringToBytes** : converts a string to byte slice without a memory allocation.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#StringToBytes)]
[[play](https://go.dev/play/p/7OyFBrf9AxA)]
- **BytesToString** : converts a byte slice to string without a memory allocation.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#BytesToString)]
[[play](https://go.dev/play/p/6c68HRvJecH)]
- **IsBlank** : checks if a string is whitespace or empty.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsBlank)]
[[play](https://go.dev/play/p/6zXRH_c0Qd3)]
- **IsNotBlank** : checks if a string is not whitespace or not empty.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IsNotBlank)]
[[play](https://go.dev/play/p/e_oJW0RAquA)]
- **HasPrefixAny** : checks if a string starts with any of an array of specified strings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasPrefixAny)]
[[play](https://go.dev/play/p/8UUTl2C5slo)]
- **HasSuffixAny** : checks if a string ends with any of an array of specified strings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HasSuffixAny)]
[[play](https://go.dev/play/p/sKWpCQdOVkx)]
- **IndexOffset** : returns the index of the first instance of substr in string after offsetting the string by `idxFrom`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#IndexOffset)]
[[play](https://go.dev/play/p/qZo4lV2fomB)]
- **ReplaceWithMap** : returns a copy of `str`, which is replaced by a map in unordered way, case-sensitively.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#ReplaceWithMap)]
[[play](https://go.dev/play/p/h3t7CNj2Vvu)]
- **Trim** : strips whitespace (or other characters) from the beginning and end of a string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Trim)]
[[play](https://go.dev/play/p/Y0ilP0NRV3j)]
- **SplitAndTrim** : splits string `str` by a string `delimiter` to a slice, and calls Trim to every element of slice.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SplitAndTrim)]
[[play](https://go.dev/play/p/ZNL6o4SkYQ7)]
- **HideString** : Hide some chars in source string with param `replaceChar`.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HideString)]
[[play](https://go.dev/play/p/pzbaIVCTreZ)]
- **RemoveWhiteSpace** : remove whitespace characters from a string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RemoveWhiteSpace)]
[[play](https://go.dev/play/p/HzLC9vsTwkf)]
- **SubInBetween** : return substring between the start and end position(excluded) of source string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#SubInBetween)]
[[play](https://go.dev/play/p/EDbaRvjeNsv)]
- **HammingDistance** : calculates the Hamming distance between two strings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#HammingDistance)]
[[play](https://go.dev/play/p/glNdQEA9HUi)]
- **Concat** : concatenates strings.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Concat)]
[[play](https://go.dev/play/p/gD52SZHr4Kp)]
- **Ellipsis** : truncates a string to a specified length and appends an ellipsis.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Ellipsis)]
[[play](https://go.dev/play/p/i1vbdQiQVRR)]
- **Shuffle** : shuffle the order of characters of given string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Shuffle)]
[[play](https://go.dev/play/p/iStFwBwyGY7)]
- **Rotate** : rotates the string by the specified number of characters.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#Rotate)]
[[play](https://go.dev/play/p/Kf03iOeT5bd)]
- **TemplateReplace** : replaces the placeholders in the template string with the corresponding values in the data map.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#TemplateReplace)]
[[play](https://go.dev/play/p/cXSuFvyZqv9)]
- **RegexMatchAllGroups** : matches all subgroups in a string using a regular expression and returns the result.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/strutil.md#RegexMatchAllGroups)]
[[play](https://go.dev/play/p/JZiu0RXpgN-)]

22. System package contain some functions about os, runtime, shell command.        index

```go
import "github.com/duke-git/lancet/v2/system"
```

#### Function list:

- **IsWindows** : check if current os is windows.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsWindows)]
[[play](https://go.dev/play/p/XzJULbzmf9m)]
- **IsLinux** : check if current os is linux.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsLinux)]
[[play](https://go.dev/play/p/zIflQgZNuxD)]
- **IsMac** : check if current os is macos.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#IsMac)]
[[play](https://go.dev/play/p/Mg4Hjtyq7Zc)]
- **GetOsEnv** : get the value of the environment variable named by the key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsEnv)]
[[play](https://go.dev/play/p/D88OYVCyjO-)]
- **SetOsEnv** : set the value of the environment variable named by the key.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#SetOsEnv)]
[[play](https://go.dev/play/p/D88OYVCyjO-)]
- **RemoveOsEnv** : remove a single environment variable.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#RemoveOsEnv)]
[[play](https://go.dev/play/p/fqyq4b3xUFQ)]
- **CompareOsEnv** : get env named by the key and compare it with passed env.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#CompareOsEnv)]
[[play](https://go.dev/play/p/BciHrKYOHbp)]
- **ExecCommand** : execute command, return the stdout and stderr string of command, and error if error occurs.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#ExecCommand)]
[[play](https://go.dev/play/p/n-2fLyZef-4)]
- **GetOsBits** : return current os bits (32 or 64).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetOsBits)]
[[play](https://go.dev/play/p/ml-_XH3gJbW)]
- **StartProcess** : start a new process with the specified name and arguments.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StartProcess)]
[[play](https://go.dev/play/p/5GVol6ryS_X)]
- **StopProcess** : stop a process by pid.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#StopProcess)]
[[play](https://go.dev/play/p/jJZhRYGGcmD)]
- **KillProcess** : kill a new process with the specified name and arguments.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#KillProcess)]
[[play](https://go.dev/play/p/XKmvV-ExBWa)]
- **GetProcessInfo** : retrieves detailed process information by pid.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/system.md#GetProcessInfo)]
[[play](https://go.dev/play/p/NQDVywEYYx7)]

23. Tuple package implements tuple data type and some operations on it.        index

```go
import "github.com/duke-git/lancet/v2/tuple"
```

#### Function list:

- **Tuple2** : represents a 2 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2)]
[[play](https://go.dev/play/p/3sHVqBQpLYN)]
- **Tuple2_Unbox** : returns values in Tuple2.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple2_Unbox)]
[[play](https://go.dev/play/p/0fD1qfCVwjm)]
- **Zip2** : create a slice of Tuple2, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip2)]
[[play](https://go.dev/play/p/4ncWJJ77Xio)]
- **Unzip2** : create a group of slice from a slice of Tuple2.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip2)]
[[play](https://go.dev/play/p/KBecr60feXb)]
- **Tuple3** : represents a 3 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3)]
[[play](https://go.dev/play/p/FtH2sdCLlCf)]
- **Tuple3_Unbox** : returns values in Tuple3.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple3_Unbox)]
[[play](https://go.dev/play/p/YojLy-id1BS)]
- **Zip3** : create a slice of Tuple3, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip3)]
[[play](https://go.dev/play/p/97NgmsTILfu)]
- **Unzip3** : create a group of slice from a slice of Tuple3.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip3)]
[[play](https://go.dev/play/p/bba4cpAa7KO)]
- **Tuple4** : represents a 4 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4)]
[[play](https://go.dev/play/p/D2EqDz096tk)]
- **Tuple4_Unbox** : returns values in Tuple4.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple4_Unbox)]
[[play](https://go.dev/play/p/ACj9YuACGgW)]
- **Zip4** : create a slice of Tuple4, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip4)]
[[play](https://go.dev/play/p/PEmTYVK5hL4)]
- **Unzip4** : create a group of slice from a slice of Tuple4.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip4)]
[[play](https://go.dev/play/p/rb8z4gyYSRN)]
- **Tuple5** : represents a 5 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5)]
[[play](https://go.dev/play/p/2WndmVxPg-r)]
- **Tuple5_Unbox** : returns values in Tuple4.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple5_Unbox)]
[[play](https://go.dev/play/p/GyIyZHjCvoS)]
- **Zip5** : create a slice of Tuple5, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip5)]
[[play](https://go.dev/play/p/fCAAJLMfBIP)]
- **Unzip5** : create a group of slice from a slice of Tuple5.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip5)]
[[play](https://go.dev/play/p/gyl6vKfhqPb)]
- **Tuple6** : represents a 6 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6)]
[[play](https://go.dev/play/p/VjqcCwEJZbs)]
- **Tuple6_Unbox** : returns values in Tuple6.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple6_Unbox)]
[[play](https://go.dev/play/p/FjIHV7lpxmW)]
- **Zip6** : create a slice of Tuple6, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip6)]
[[play](https://go.dev/play/p/oWPrnUYuFHo)]
- **Unzip6** : create a group of slice from a slice of Tuple6.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip6)]
[[play](https://go.dev/play/p/l41XFqCyh5E)]
- **Tuple7** : represents a 7 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7)]
[[play](https://go.dev/play/p/dzAgv_Ezub9)]
- **Tuple7_Unbox** : returns values in Tuple7.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple7_Unbox)]
[[play](https://go.dev/play/p/R9I8qeDk0zs)]
- **Zip7** : create a slice of Tuple7, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip7)]
[[play](https://go.dev/play/p/WUJuo897Egf)]
- **Unzip7** : create a group of slice from a slice of Tuple7.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip7)]
[[play](https://go.dev/play/p/hws_P1Fr2j3)]
- **Tuple8** : represents a 8 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8)]
[[play](https://go.dev/play/p/YA9S0rz3dRz)]
- **Tuple8_Unbox** : returns values in Tuple8.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple8_Unbox)]
[[play](https://go.dev/play/p/PRxLBBb4SMl)]
- **Zip8** : create a slice of Tuple8, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip8)]
[[play](https://go.dev/play/p/8V9jWkuJfaQ)]
- **Unzip8** : create a group of slice from a slice of Tuple8.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip8)]
[[play](https://go.dev/play/p/1SndOwGsZB4)]
- **Tuple9** : represents a 9 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9)]
[[play](https://go.dev/play/p/yS2NGGtZpQr)]
- **Tuple9_Unbox** : returns values in Tuple9.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple9_Unbox)]
[[play](https://go.dev/play/p/oFJFGTAuOa8)]
- **Zip9** : create a slice of Tuple9, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip9)]
[[play](https://go.dev/play/p/cgsL15QYnfz)]
- **Unzip9** : create a group of slice from a slice of Tuple9.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip9)]
[[play](https://go.dev/play/p/91-BU_KURSA)]
- **Tuple10** : represents a 10 elements tuple.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10)]
[[play](https://go.dev/play/p/799qqZg0hUv)]
- **Tuple10_Unbox** : returns values in Tuple10.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Tuple10_Unbox)]
[[play](https://go.dev/play/p/qfyx3x_X0Cu)]
- **Zip10** : create a slice of Tuple10, whose elements are correspond to the given slice elements.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Zip10)]
[[play](https://go.dev/play/p/YSR-2cXnrY4)]
- **Unzip10** : create a group of slice from a slice of Tuple10.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/tuple.md#Unzip10)]
[[play](https://go.dev/play/p/-taQB6Wfre_z)]

24. Validator package contains some functions for data validation.        index

```go
import "github.com/duke-git/lancet/v2/validator"
```

#### Function list:

- **ContainChinese** : check if the string contain mandarin chinese.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainChinese)]
[[play](https://go.dev/play/p/7DpU0uElYeM)]
- **ContainLetter** : check if the string contain at least one letter.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLetter)]
[[play](https://go.dev/play/p/lqFD04Yyewp)]
- **ContainLower** : check if the string contain at least one lower case letter a-z.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainLower)]
[[play](https://go.dev/play/p/Srqi1ItvnAA)]
- **ContainUpper** : check if the string contain at least one upper case letter A-Z.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#ContainUpper)]
[[play](https://go.dev/play/p/CmWeBEk27-z)]
- **IsAlpha** : checks if the string contains only letters (a-zA-Z).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAlpha)]
[[play](https://go.dev/play/p/7Q5sGOz2izQ)]
- **IsAllUpper** : check if the string is all upper case letters A-Z.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllUpper)]
[[play](https://go.dev/play/p/ZHctgeK1n4Z)]
- **IsAllLower** : check if the string is all lower case letters a-z.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAllLower)]
[[play](https://go.dev/play/p/GjqCnOfV6cM)]
- **IsBase64** : check if the string is base64 string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64)]
[[play](https://go.dev/play/p/sWHEySAt6hl)]
- **IsChineseMobile** : check if the string is chinese mobile number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseMobile)]
[[play](https://go.dev/play/p/GPYUlGTOqe3)]
- **IsChineseIdNum** : check if the string is chinese id card.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChineseIdNum)]
[[play](https://go.dev/play/p/d8EWhl2UGDF)]
- **IsChinesePhone** : check if the string is chinese phone number.(xxx-xxxxxxxx or xxxx-xxxxxxx.)
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinesePhone)]
[[play](https://go.dev/play/p/RUD_-7YZJ3I)]
- **IsCreditCard** : check if the string is credit card.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsCreditCard)]
[[play](https://go.dev/play/p/sNwwL6B0-v4)]
- **IsDns** : check if the string is dns.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsDns)]
[[play](https://go.dev/play/p/jlYApVLLGTZ)]
- **IsEmail** : check if the string is a email address.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmail)]
[[play](https://go.dev/play/p/Os9VaFlT33G)]
- **IsEmptyString** : check if the string is empty.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsEmptyString)]
[[play](https://go.dev/play/p/dpzgUjFnBCX)]
- **IsFloat** : check if the value is float(float32, float34) or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloat)]
[[play](https://go.dev/play/p/vsyG-sxr99_Z)]
- **IsFloatStr** : check if the string can convert to a float.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsFloatStr)]
[[play](https://go.dev/play/p/LOYwS_Oyl7U)]
- **IsNumber** : check if the value is number(integer, float) or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumber)]
[[play](https://go.dev/play/p/mdJHOAvtsvF)]
- **IsNumberStr** : check if the string can convert to a number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsNumberStr)]
[[play](https://go.dev/play/p/LzaKocSV79u)]
- **IsJSON** : check if the string is valid JSON.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJSON)]
[[play](https://go.dev/play/p/8Kip1Itjiil)]
- **IsRegexMatch** : check if the string match the regexp.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsRegexMatch)]
[[play](https://go.dev/play/p/z_XeZo_litG)]
- **IsInt** : check if the string can convert to a number.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsInt)]
[[play](https://go.dev/play/p/eFoIHbgzl-z)]
- **IsIntStr** : check if the string can convert to a integer.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIntStr)]
[[play](https://go.dev/play/p/jQRtFv-a0Rk)]
- **IsIp** : check if the string is ip.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIp)]
[[play](https://go.dev/play/p/FgcplDvmxoD)]
- **IsIpV4** : check if the string is ipv4.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV4)]
[[play](https://go.dev/play/p/zBGT99EjaIu)]
- **IsIpV6** : check if the string is ipv6.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsIpV6)]
[[play](https://go.dev/play/p/AHA0r0AzIdC)]
- **IsStrongPassword** : check if the string is strong password.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsStrongPassword)]
[[play](https://go.dev/play/p/QHdVcSQ3uDg)]
- **IsUrl** : check if the string is url.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUrl)]
[[play](https://go.dev/play/p/pbJGa7F98Ka)]
- **IsWeakPassword** : check if the string is weak password.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsWeakPassword)]
[[play](https://go.dev/play/p/wqakscZH5gH)]
- **IsZeroValue** : check if value is a zero value.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsZeroValue)]
[[play](https://go.dev/play/p/UMrwaDCi_t4)]
- **IsGBK** : check if data encoding is gbk.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsGBK)]
[[play](https://go.dev/play/p/E2nt3unlmzP)]
- **IsASCII** : checks if string is all ASCII char.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsASCII)]
[[play](https://go.dev/play/p/hfQNPLX0jNa)]
- **IsPrintable** : checks if string is all printable chars.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsPrintable)]
[[play](https://go.dev/play/p/Pe1FE2gdtTP)]
- **IsBin** : check if a give string is a valid binary value or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBin)]
[[play](https://go.dev/play/p/ogPeg2XJH4P)]
- **IsHex** : check if a give string is a valid hexadecimal value or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsHex)]
[[play](https://go.dev/play/p/M2qpHbEwmm7)]
- **IsBase64URL** : check if a give string is a valid URL-safe Base64 encoded string.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsBase64URL)]
[[play](https://go.dev/play/p/vhl4mr8GZ6S)]
- **IsJWT** : check if a give string is a valid JSON Web Token (JWT).
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsJWT)]
[[play](https://go.dev/play/p/R6Op7heJbKI)]
- **IsVisa** : check if a give string is a valid visa card number or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsVisa)]
[[play](https://go.dev/play/p/SdS2keOyJsl)]
- **IsMasterCard** : check if a give string is a valid master card number or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsMasterCard)]
[[play](https://go.dev/play/p/CwWBFRrG27b)]
- **IsAmericanExpress** : check if a give string is a valid american expression card number or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsAmericanExpress)]
[[play](https://go.dev/play/p/HIDFpcOdpkd)]
- **IsUnionPay** : check if a give string is a valid union pay number or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsUnionPay)]
[[play](https://go.dev/play/p/CUHPEwEITDf)]
- **IsChinaUnionPay** : check if a give string is a valid china union pay number or not.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/validator.md#IsChinaUnionPay)]
[[play](https://go.dev/play/p/yafpdxLiymu)]

25. Xerror package implements helpers for errors.        index

```go
import "github.com/duke-git/lancet/v2/xerror"
```

#### Function list:

- **New** : creates a new XError pointer instance with message.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#New)]
[[play](https://go.dev/play/p/w4oWZts7q7f)]
- **Wrap** : creates a new XError pointer instance based on error object, and add message.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Wrap)]
[[play](https://go.dev/play/p/5385qT2dCi4)]
- **Unwrap** : returns unwrapped XError from err by errors.As. If no XError, returns nil.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#Unwrap)]
[[play](https://go.dev/play/p/LKMLep723tu)]
- **XError_Wrap** : creates a new XError and copy message and id to new one.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Wrap)]
[[play](https://go.dev/play/p/RpjJ5u5sc97)]
- **XError_Unwrap** : Compatible with github.com/pkg/errors.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Unwrap)]
[[play](https://go.dev/play/p/VUXJ8BST4c6)]
- **XError_With** : adds key and value related to the XError object.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_With)]
[[play](https://go.dev/play/p/ow8UISXX_Dp)]
- **XError_Id** : sets XError object id to check equality in XError.Is.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Id)]
[[play](https://go.dev/play/p/X6HBlsy58U9)]
- **XError_Is** : checks if target error is XError and Error.id of two errors are matched.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Is)]
[[play](https://go.dev/play/p/X6HBlsy58U9)]
- **XError_Values** : returns map of key and value that is set by XError.With function.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Values)]
[[play](https://go.dev/play/p/ow8UISXX_Dp)]
- **XError_StackTrace** : returns stack trace which is compatible with pkg/errors.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_StackTrace)]
[[play](https://go.dev/play/p/6FAvSQpa7pc)]
- **XError_Info** : returns information of xerror, which can be printed.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Info)]
[[play](https://go.dev/play/p/1ZX0ME1F-Jb)]
- **XError_Error** : implements standard error interface.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#XError_Error)]
[[play](https://go.dev/play/p/w4oWZts7q7f)]
- **TryUnwrap** : check if err is nil then it returns a valid value. If err is not nil, TryUnwrap panics with err.
[[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/xerror.md#TryUnwrap)]
[[play](https://go.dev/play/p/acyZVkNZEeW)]

## How to Contribute

#### [Contribution Guide](./CONTRIBUTION.md)

## Contributors
Thank you to all the people who contributed to lancet!



## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=duke-git/lancet&type=Date)](https://star-history.com/#duke-git/lancet&Date)