Whats the go-sail?
Go-Sail is a lightweight progressive web framework implemented using Go language. It is not the product of reinventing the wheel, but stands on the shoulders of giants and integrates existing excellent components to help users build stable and reliable services in the simplest way.
As its name suggests, you can regard it as the beginning of your own journey in the golang ecosystem. Go-Sail will help you start lightly and set sail.
How to use
go version >= 1.20
Install
go get -u github.com/keepchen/go-sail/v3
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/keepchen/go-sail/v3/sail"
"github.com/keepchen/go-sail/v3/sail/config"
)
var (
conf = &config.Config{}
registerRoutes = func(ginEngine *gin.Engine) {
ginEngine.GET("/hello", func(c *gin.Context){
c.String(http.StatusOK, "%s", "hello, world!")
})
}
)
func main() {
sail.WakeupHttp("go-sail", conf).Hook(registerRoutes, nil, nil).Launch()
}
Console screenshot after launched like this:
Documentation
Features
- [x] HTTP Responder
- Uniform Response Fields
- Managing HTTP status codes
- Management business code
- [x] Components
- Database
- Jwt
- Kafka
- Logger
- Nacos
- Etcd
- Nats
- Redis
- [x] Service Registration and Discovery
- Nacos
- Etcd
- [x] Toolkit
- Encryption and Decryption
- File
- IP
- String
- Random number
- Date and Time
- ...
- [x] Log collection and export
- Local files
- Exporter
- Redis
- Kafka
- Nats
- [x] Scheduled Tasks
- Cancellable
- Disposable
- Periodic
- Linux Crontab style
- Race Detection
- [x] Telemetry and Observability
- Call chain tracing
- Prometheus
- Pprof
- Log Exporter
- Performance monitor
- Prometheus
- Pprof
- [x] API error codes
- Dynamic injection
- Internationalization
- [x] Distributed lock based on Redis
- Blocking
- None-Blocking
- [x] API Documentation
- Redocly
- Swagger
Big Thanks
Thank you to everyone who provided valuable suggestions and comments during the experience and use, as well as provided other kinds of help!
- Configuration modular optimization proposal @fujilin
- Responder syntax sugar enhancement optimization proposal @lichuanzhang
- Logo beautification @ShuaiRen34
Other
- PR is welcome: pull request
- Issue is welcome: issue
- Thank you for your star if you like this project :)
Top comments (1)
Good job my friend