package rest import "git.nobla.cn/golang/rest/types" type Options struct { urlPrefix string moduleName string disableDomain bool router types.HttpRouter writer types.HttpWriter formatter *Formatter dirname string //文件目录 } type Option func(o *Options) func WithUriPrefix(s string) Option { return func(o *Options) { o.urlPrefix = s } } func WithModuleName(s string) Option { return func(o *Options) { o.moduleName = s } } // WithoutDomain 禁用域 func WithoutDomain() Option { return func(o *Options) { o.disableDomain = true } } func WithHttpRouter(s types.HttpRouter) Option { return func(o *Options) { o.router = s } } func WithHttpWriter(s types.HttpWriter) Option { return func(o *Options) { o.writer = s } } func WithFormatter(s *Formatter) Option { return func(o *Options) { o.formatter = s } }