26 lines
547 B
Go
26 lines
547 B
Go
package webserver
|
|
|
|
import (
|
|
"git.vinchent.xyz/vinchent/go-web/framework"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type GoWebGin struct {
|
|
container framework.Container
|
|
Engine *gin.Engine
|
|
}
|
|
|
|
func NewGoWebGin(params ...interface{}) (interface{}, error) {
|
|
paramsLen := len(params)
|
|
container := params[0].(framework.Container)
|
|
|
|
ginOpts := make([]gin.OptionFunc, paramsLen-1)
|
|
for _, param := range params[1:] {
|
|
ginOpts = append(ginOpts, param.(gin.OptionFunc))
|
|
}
|
|
return &GoWebGin{
|
|
container: container,
|
|
Engine: gin.New(ginOpts...),
|
|
}, nil
|
|
}
|