1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 15:12:26 +08:00

doc: add new site for doc

This commit is contained in:
dudaodong
2023-08-24 17:47:03 +08:00
parent e66ab154bc
commit 095cfc0aab
89 changed files with 3927 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
---
outline: deep
---
# 安装
1. <b>使用 go1.18 及以上版本的用户,建议安装 v2.x.x。 因为 v2.x.x 应用 go1.18 的泛型重写了大部分函数。</b>
```go
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
```
2. <b>使用 go1.18 以下版本的用户,必须安装 v1.x.x。目前最新的 v1 版本是 v1.4.1。</b>
```go
go get github.com/duke-git/lancet // below go1.18, install latest version of v1.x.x
```
## 用法
lancet 是以包的结构组织代码的,使用时需要导入相应的包名。例如:如果使用字符串相关函数,需要导入 strutil 包:
```go
import "github.com/duke-git/lancet/v2/strutil"
```
## 示例
此处以字符串工具函数 Reverse逆序字符串为例需要导入 strutil 包:
```go
package main
import (
"fmt"
"github.com/duke-git/lancet/v2/strutil"
)
func main() {
s := "hello"
rs := strutil.Reverse(s)
fmt.Println(rs) //olleh
}
```
## More
其他特性请参考[API](https://lancet.go.dev/api/overview.html).

View File

@@ -0,0 +1,18 @@
---
outline: deep
---
# lancet是什么?
<b>lancet柳叶刀是一个强大、全面、高效、可复用的go语言工具函数库。lancet受到了java apache common包和lodash.js的启发。 </b>
## 为什么选择lancet?
Lancet 消除了处理并发、网络、数学、切片、字符串等的麻烦,使 Go 开发变得更容易。
Lancet 的实用方法非常适合:
- 迭代切片和数组。
- 操作字符串。
- 处理网络和http请求。
- 其他工具,例如。 随机、加密、流、重试等。