本文整理匯總了Golang中github.com/funkygao/jsconf.Conf.Float方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conf.Float方法的具體用法?Golang Conf.Float怎麽用?Golang Conf.Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/funkygao/jsconf.Conf
的用法示例。
在下文中一共展示了Conf.Float方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: loadConfig
func (this *configRpc) loadConfig(section *conf.Conf) {
this.listenAddr = section.String("listen_addr", "")
if this.listenAddr == "" {
panic("Empty listen_addr")
}
this.clientSlowThreshold = section.Float("client_slow_threshold", 5)
this.callSlowThreshold = section.Float("call_slow_threshold", 5)
this.clientTimeout = time.Duration(section.Int("client_timeout", 0)) * time.Second
this.framed = section.Bool("framed", false)
this.protocol = section.String("protocol", "binary")
log.Debug("rpc: %+v", *this)
}
示例2: init
func (this *alarmWorkerConfig) init(config *conf.Conf) {
this.camelName = config.String("camel_name", "")
if this.camelName == "" {
panic("empty 'camel_name'")
}
this.title = config.String("title", "")
if this.title == "" {
this.title = this.camelName
}
this.colors = config.StringList("colors", nil)
this.printFormat = config.String("printf", "")
this.instantFormat = config.String("iprintf", "")
if this.printFormat == "" && this.instantFormat == "" {
panic(fmt.Sprintf("%s empty 'printf' and 'iprintf'", this.title))
}
this.severity = config.Int("severity", 1)
this.windowSize = time.Duration(config.Int("window_size", 0)) * time.Second
this.showSummary = config.Bool("show_summary", false)
this.beepThreshold = config.Int("beep_threshold", 0)
this.abnormalBase = config.Int("abnormal_base", 10)
this.abnormalSeverityFactor = config.Int("abnormal_severity_factor", 2)
this.abnormalPercent = config.Float("abnormal_percent", 1.5)
this.dbName = config.String("dbname", "")
this.tableName = this.dbName // table name is db name
this.createTable = config.String("create_table", "")
this.insertStmt = config.String("insert_stmt", "")
this.statsStmt = config.String("stats_stmt", "")
this.fields = make([]alarmWorkerConfigField, 0, 5)
for i := 0; i < len(config.List("fields", nil)); i++ {
section, err := config.Section(fmt.Sprintf("fields[%d]", i))
if err != nil {
panic(err)
}
field := alarmWorkerConfigField{}
field.init(section)
this.fields = append(this.fields, field)
}
if len(this.fields) == 0 {
panic(fmt.Sprintf("%s empty 'fields'", this.title))
}
}