10 Star 43 Fork 10

gohouse/gorose

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
builder_driver.go 539 Bytes
一键复制 编辑 原始数据 按行查看 历史
fizzday 提交于 2019-06-21 17:09 . execut bind
package gorose
import (
"sync"
)
type BuilderDriver struct {
builders map[string]IBuilder
}
var builderDriverOnce sync.Once
var builderDriver *BuilderDriver
func NewBuilderDriver() *BuilderDriver {
builderDriverOnce.Do(func() {
builderDriver = &BuilderDriver{make(map[string]IBuilder)}
})
return builderDriver
}
func (b *BuilderDriver) Register(driver string, val IBuilder) {
withLockContext(func() {
b.builders[driver] = val
})
}
func (b *BuilderDriver) Getter(driver string) (ib IBuilder) {
return b.builders[driver]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/gohouse/gorose.git
git@gitee.com:gohouse/gorose.git
gohouse
gorose
gorose
master

搜索帮助