framework1/framework/contract/config.go

42 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package contract
import "time"
const (
// ConfigKey is config key in container
ConfigKey = "hade:config"
)
type Config interface {
// IsExist 检查一个属性是否存在
IsExist(key string) bool
// Get 获取一个属性值
Get(key string) interface{}
// GetBool 获取一个bool属性
GetBool(key string) bool
// GetInt 获取一个int属性
GetInt(key string) int
// GetFloat64 获取一个float64属性
GetFloat64(key string) float64
// GetTime 获取一个time属性
GetTime(key string) time.Time
// GetString 获取一个string属性
GetString(key string) string
// GetIntSlice 获取一个int数组属性
GetIntSlice(key string) []int
// GetStringSlice 获取一个string数组
GetStringSlice(key string) []string
// GetStringMap 获取一个string为keyinterface为val的map
GetStringMap(key string) map[string]interface{}
// GetStringMapString 获取一个string为keystring为val的map
GetStringMapString(key string) map[string]string
// GetStringMapStringSlice 获取一个string为key数组string为val的map
GetStringMapStringSlice(key string) map[string][]string
// Load 加载配置到某个对象
Load(key string, val interface{}) error
GetAppName() string
}