AUXO¶
auxo 是一个 Go 语言的开发框架,专注于一站式大中型互联网应用开发。
WARNING: This package is a work in progress. It's API may still break in backwards-incompatible ways without warnings. Please use dependency management tools such as dep to lock version.
Components¶
- CLI - Easily build a friendly CLI program with sub commands support
- Config - Manage configuration for various formats and sources
- Log - Flexible log4j style log component
- Cache - Simple and elegant cache management
- Web - Web server with a variety of advanced features
- RPC - Lightweight and high performace
- Service Discovery - Automatic registration and name resolution with service discovery
- Load Balancing - Smart client side load balancing of services built on discovery
- Database
- GSD - A lightweight, fluent SQL data access and ORM library
- MongoDB - A powerful wrapper for mgo
- Utility - Some useful utility packages...
Goals¶
为简化应用开发和保持整体风格的一致性,auxo 会尽量少的依赖第三方工具包,这并不是说 auxo 排斥第三方包而喜欢自己造轮子。auxo 的设计会尽量考虑到对社区优秀组件的兼容性,尤其是一些已经成为事实标准的组件与工具,如:opentracing、prometheus 等。以下这些是 auxo 的设计目标。
- 整体风格的一致性
- 简洁而优雅的 API
- 易于使用与维护
- 性能至上
Getting started¶
Installation¶
- Using
go get
> go get -u github.com/cuigh/auxo
- Using
dep
> cd <PATH/TO/PROJECT>
> dep ensure -add github.com/cuigh/auxo
Build a CLI application¶
Create app.go
package main
import (
"github.com/cuigh/auxo/app"
"github.com/cuigh/auxo/app/flag"
)
func main() {
app.Name = "test"
app.Version = "0.1"
app.Desc = "a test cli app for auxo"
app.Action = func(ctx *app.Context) {
app.RunFunc(runner, nil)
}
app.Flags.Register(flag.All)
app.Start()
}
func runner() error {
println("Hello, world!")
return nil
}
Run app
> go run app.go
You will see output like this:
___ __ __ ___ ___ ______
/ \ | | | | \ \ / / / __ \
/ ^ \ | | | | \ V / | | | |
/ /_\ \ | | | | > < | | | |
/ _____ \ | '--' | / . \ | '--' |
/__/ \__\ \______/ /__/ \__\ \______/ VERSION 0.6.3
Hello, world!
Build a web site¶
s := web.Default(":8080")
s.Get("/", func(c web.Context) error {
return c.Text("Hello, world.")
})
log.Fatal(s.Serve())
Build a RPC service¶
TODO