1 Star 1 Fork 0

1701/gpa

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
provider.go 727 Bytes
一键复制 编辑 原始数据 按行查看 历史
1701 提交于 2021-08-18 08:48 . 保留字
package sqlgenerator
import (
"fmt"
"gitee.com/knowgo/gpa/engine/constants"
)
var (
generators = map[constants.DIALECT]SQLGenerator{}
reserveds = map[constants.DIALECT]Reserved{}
)
func register(dialect constants.DIALECT, gen SQLGenerator, reserved Reserved) {
generators[dialect] = gen
reserveds[dialect] = reserved
}
func GetGenerator(dialect constants.DIALECT) (SQLGenerator, error) {
gen := generators[dialect]
if gen == nil {
return nil, fmt.Errorf("unsupported dialect type: %v", dialect)
}
return gen, nil
}
func GetReserved(dialect constants.DIALECT) (Reserved, error) {
fn := reserveds[dialect]
if fn == nil {
return nil, fmt.Errorf("unsupported dialect type: %v", dialect)
}
return fn, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/knowgo/gpa.git
git@gitee.com:knowgo/gpa.git
knowgo
gpa
gpa
v0.2.14

搜索帮助