influxdb/stress/v2/statement/statement.go

33 lines
768 B
Go
Raw Normal View History

2016-04-21 18:03:43 +00:00
package statement
import (
2016-04-25 18:13:10 +00:00
"log"
2016-04-21 18:03:43 +00:00
"strconv"
"github.com/influxdata/influxdb/stress/v2/stress_client"
2016-04-21 18:03:43 +00:00
)
// Statement is the common interface to shape the testing environment and prepare database requests
// The parser turns the 'statements' in the config file into Statements
type Statement interface {
Run(s *stressClient.StressTest)
Report(s *stressClient.StressTest) string
2016-04-21 18:03:43 +00:00
SetID(s string)
}
func parseInt(s string) int {
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
2016-04-25 18:13:10 +00:00
log.Fatalf("Error parsing integer:\n String: %v\n Error: %v\n", s, err)
2016-04-21 18:03:43 +00:00
}
return int(i)
}
func parseFloat(s string) int {
i, err := strconv.ParseFloat(s, 64)
if err != nil {
2016-04-25 18:13:10 +00:00
log.Fatalf("Error parsing integer:\n String: %v\n Error: %v\n", s, err)
2016-04-21 18:03:43 +00:00
}
return int(i)
}