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:
50
docs/en/guide/getting_started.md
Normal file
50
docs/en/guide/getting_started.md
Normal 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.
|
||||
18
docs/en/guide/introduction.md
Normal file
18
docs/en/guide/introduction.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# What is lancet?
|
||||
|
||||
<b>Lancet is a powerful, efficient, and reusable util function library of go. Inspired by the java apache common package and lodash.js. </b>
|
||||
|
||||
|
||||
## Why lancet?
|
||||
|
||||
Lancet makes Go dev easier by taking the hassle out of working with concurrency, net, math, slice, string, etc.
|
||||
Lancet's utility methods are great for:
|
||||
|
||||
- Iterating slice and array.
|
||||
- Manipulating strings.
|
||||
- Work with net and http.
|
||||
- Other tools, eg. random, crypto, stream, retry, etc.
|
||||
Reference in New Issue
Block a user