1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-12 00:32:27 +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,50 @@
---
outline: deep
---
# Installation
1. <b>For users who use go1.18 and above, it is recommended to install lancet v2.x.x. Cause in v2.x.x all functions was rewriten with generics of go1.18.</b>
```go
go get github.com/duke-git/lancet/v2 // will install latest version of v2.x.x
```
2. <b>For users who use version below go1.18, you should install v1.x.x. The latest of v1.x.x is v1.4.1. </b>
```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, just 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
}
```
## More
Check out the [APIs]([API](https://lancet.go.dev/api/overview.html)) for details.