goby

package
v0.0.0-...-7232a66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigEnv  = "GOBY_CONFIG"
	ConfigFile = "config.yaml"
)
View Source
const (
	HTTP_STATUS = "HTTP_STATUS"
)

Variables

View Source
var (
	GOBY_CONFIG              conf.Server
	GOBY_VIPER               *viper.Viper
	GOBY_LOG                 *zap.Logger
	GOBY_DB                  *gorm.DB
	GOBY_REDIS               *redis.Client
	GOBY_BlackCache          local_cache.Cache
	GOBY_Concurrency_Control = &singleflight.Group{}
)
View Source
var (
	Discard = New(log.New(ioutil.Discard, "", log.LstdFlags), config{})
	Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), config{
		SlowThreshold: 200 * time.Millisecond,
		LogLevel:      logger.Warn,
		Colorful:      true,
	})
	Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
)

Functions

func Error

func Error(err error, msg ...string)

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

func New

func New(writer logger.Writer, config config) logger.Interface

func Throw

func Throw(err string, code int, context *gin.Context)

Types

type Goby

type Goby struct {
	*gin.Engine                  //我们把 engine放到 主类里
	RouteGroup  *gin.RouterGroup //这里就是保存 group对象
}

func MakeGin

func MakeGin(middlewares ...gin.HandlerFunc) *Goby

func (*Goby) Config

func (ain *Goby) Config(cfgs ...interface{}) *Goby

func (*Goby) Handle

func (ain *Goby) Handle(method, path string, handler gin.HandlerFunc) *Goby

func (*Goby) RouterMount

func (ain *Goby) RouterMount(groupName string, middlebrows ...gin.HandlerFunc) func(opts ...func(*gin.RouterGroup)) *Goby

func (*Goby) Run

func (ain *Goby) Run()

type RouteGroupOption

type RouteGroupOption struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL