当前位置: 首页>>代码示例>>Golang>>正文


Golang Conf.Float方法代码示例

本文整理汇总了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)
}
开发者ID:justinblah,项目名称:fae,代码行数:14,代码来源:config.go

示例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))
	}
}
开发者ID:jlyt898,项目名称:dpipe,代码行数:44,代码来源:alarm_worker.go


注:本文中的github.com/funkygao/jsconf.Conf.Float方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。