mirror of
https://github.com/bitmagnet-io/bitmagnet.git
synced 2026-08-03 18:03:39 -04:00
26 lines
389 B
Go
26 lines
389 B
Go
package httpserver
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
type Option interface {
|
|
Key() string
|
|
Apply(engine *gin.Engine)
|
|
}
|
|
|
|
func NewOption(key string, fn func(engine *gin.Engine)) Option {
|
|
return option{key, fn}
|
|
}
|
|
|
|
type option struct {
|
|
key string
|
|
fn func(engine *gin.Engine)
|
|
}
|
|
|
|
func (o option) Key() string {
|
|
return o.key
|
|
}
|
|
|
|
func (o option) Apply(engine *gin.Engine) {
|
|
o.fn(engine)
|
|
}
|