代码拉取完成,页面将自动刷新
package gorose
import (
"sync"
)
// BuilderDriver ...
type BuilderDriver struct {
builders map[string]IBuilder
b *sync.Map
}
var builderDriverOnce sync.Once
var builderDriver *BuilderDriver
// NewBuilderDriver ...
func NewBuilderDriver() *BuilderDriver {
builderDriverOnce.Do(func() {
//builderDriver = &BuilderDriver{builders:make(map[string]IBuilder)}
builderDriver = &BuilderDriver{b: &sync.Map{}}
})
return builderDriver
}
// Register ...
func (b *BuilderDriver) Register(driver string, val IBuilder) {
//withLockContext(func() {
// b.builders[driver] = val
//})
b.b.Store(driver, val)
}
// Getter ...
func (b *BuilderDriver) Getter(driver string) IBuilder {
//return b.builders[driver]
if v, ok := (b.b.Load(driver)); ok {
return v.(IBuilder)
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。