如下
我现在要定义一个函数,根据入参返回不同的配置,一个比较简单的复现
type MysqlConfig struct{}
type MongoConfig struct{}
func newCfg(source string) Config{
}
我现在是把 Config 定义成 type Config map[string]interface{}; 刚开始用 go ,请问有没有比较优雅的实现方式
我现在要定义一个函数,根据入参返回不同的配置,一个比较简单的复现
type MysqlConfig struct{}
type MongoConfig struct{}
func newCfg(source string) Config{
}
我现在是把 Config 定义成 type Config map[string]interface{}; 刚开始用 go ,请问有没有比较优雅的实现方式