示例#1
0
//回填
func getFillValue(fillKey string, r *common.DataRow, k string) interface{} {
	if len(fillKey) > 0 {
		key := cache.FormatKey(fillKey, r.GetKey(fillKey), k)
		//	log.Infoln("key is ", key)
		if tv, ok := cache.Get(key); ok {
			return tv
		}
	}
	return nil
}
示例#2
0
//从内部存贮创建一个新行
func createRow(dp *common.DataParam, r *common.DataRow) []interface{} {
	var row []interface{}
	for _, k := range dp.OutputKey {
		if v, ok := r.GetValue(k); ok {
			row = append(row, v)
		} else { //回填数据,从缓存中按回填key取值,key值在dp中指定
			//log.Infoln("key is ", dp.FillKey)
			v = getFillValue(dp.FillKey, r, k)
			row = append(row, v)
		}
	}
	return row
}