Example #1
0
// get new key ID for flow definition
func NextFlowDefKey(d *db.Database, flowName string) (string, error) {
	newVersionNum := 1.0

	// get flow def last version
	lastVersionStr, err := d.GetValue("_flow:" + flowName + ":_lastversion")

	if lastVersionStr != "" {
		// convert version string to num
		lastVersionNum, err := strconv.ParseFloat(lastVersionStr, 64)
		if err != nil {
			return "", err
		}
		// add 1 to last version
		newVersionNum = lastVersionNum + 1
	}

	return "_flow:" + flowName + ":_version:" + base.FloatToString(newVersionNum), err

}
Example #2
0
func writeLastVersion(d *db.Database, flowName string, version string) error {
	_, err := d.PutValue("_flow:"+flowName+":_lastversion", version)
	return err
}