https://github.com/woyotoo/gotools
helpful go tools (go utils)
https://github.com/woyotoo/gotools
go go-utils golang
Last synced: 3 months ago
JSON representation
helpful go tools (go utils)
- Host: GitHub
- URL: https://github.com/woyotoo/gotools
- Owner: woyotoo
- License: mit
- Created: 2022-04-03T10:37:58.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-18T16:02:41.000Z (about 3 years ago)
- Last Synced: 2026-01-11T23:49:50.051Z (5 months ago)
- Topics: go, go-utils, golang
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# My Go Tools (Golang实用工具)
## 安装 install
使用 go get 下载包
```sh
$ go get -u github.com/wangyongtao/gotools
```
代码示例 (详见 [examples](./examples/helloworld/)):
```go
// main.go
package main
import (
"fmt"
"github.com/wangyongtao/gotools/util" // <---- 引入工具库
)
// 演示加密字符串、校验加密结果
func main() {
fmt.Println("hello, world!")
// 加密:encrypt
// 用户密码,需要加密存储
pwd := "admin"
hash, _ := util.PasswordHash(pwd)
fmt.Println("==> 密码加密:")
fmt.Println("--> 输入的密码:", pwd)
fmt.Println("--> 生成的hash:", hash)
// hash: $2a$10$tL00vjlVzidXygcmmW7naObKkI2CgoH9lcaT/DYAFWVAbVO/PVMiu
// 校验 verify
// 登录账户时,将用户输入的密码加密后,与数据中查询的加密密码对比,校验通过则说明用户密码输入正确
fmt.Println("==> 对比加密结果:")
match := util.PasswordVerify(pwd, hash)
fmt.Println("--> 验证结果:", match)
}
```
## 推荐 recommend
| url | remark |
| ------------------------------------ | ------------------ |
| github.com/gin-gonic/gin | web framework |
| github.com/labstack/echo | web framework |
| github.com/julienschmidt/httprouter | httprouter |
| github.com/bwmarrin/snowflake | unique id generator |
| github.com/jmoiron/sqlx | database |
| github.com/go-gorm/gorm | database ORM |
| github.com/go-sql-driver/mysql | database mysql |
| github.com/lib/pq | database PostgreSQL |
| github.com/mattn/go-sqlite3 | database sqlite3 |
## 参考 Reference
https://go.dev/doc/
https://github.com/syyongx/php2go
·END·