4 Star 5 Fork 4

Plato/Service-Box-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
value.go 966 Bytes
一键复制 编辑 原始数据 按行查看 历史
CloudGuan 提交于 2022-03-09 18:25 . bug: fix default value add IsNil()
package config
import (
"gitee.com/dennis-kk/service-box-go/util/config/reader"
"time"
)
type defaultValue struct{}
func (v *defaultValue) Get(key string) reader.Value {
return &defaultValue{}
}
func newValue() reader.Value {
return new(defaultValue)
}
func (v *defaultValue) IsNil() bool {
return true
}
func (v *defaultValue) Bool(def bool) bool {
return false
}
func (v *defaultValue) Int(def int) int {
return 0
}
func (v *defaultValue) String(def string) string {
return ""
}
func (v *defaultValue) Float64(def float64) float64 {
return 0.0
}
func (v *defaultValue) Duration(def time.Duration) time.Duration {
return time.Duration(0)
}
func (v *defaultValue) StringSlice(def []string) []string {
return nil
}
func (v *defaultValue) StringMap(def map[string]string) map[string]string {
return map[string]string{}
}
func (v *defaultValue) Scan(val interface{}) error {
return nil
}
func (v *defaultValue) Bytes() []byte {
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dennis-kk/service-box-go.git
git@gitee.com:dennis-kk/service-box-go.git
dennis-kk
service-box-go
Service-Box-go
v0.4.28

搜索帮助