You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to set the date / Timestamp type range in the yaml config file, is there some sample?
The target table column type is DATE or TimeStamp, I would like to generate the random value but between "2022-01-01" and "2022-12-31" or "2022-01-01:00-00-00" and "2022-12-31:00-00-00".
The text was updated successfully, but these errors were encountered:
I am facing the same issue. I couldn't figure out how to specify a range for the TIMESTAMP type. As a workaround, I am currently using the following patch.
diff --git a/pkg/generator/data/timestamp.go b/pkg/generator/data/timestamp.go
index e809fdf..1ec8603 100644
--- a/pkg/generator/data/timestamp.go+++ b/pkg/generator/data/timestamp.go@@ -48,6 +48,12 @@ func NewTimestampGenerator(cfg Config) (Generator, error) {
ret.min = min.Unix()
case int64:
ret.min = min
+ case string:+ t, err := time.Parse(time.RFC3339, min)+ if err != nil {+ return nil, fmt.Errorf("minimum '%s' invalid string for timestamp generator", min)+ }+ ret.min = t.Unix()
default:
return nil, fmt.Errorf("minimum '%s' of type '%T' invalid for timestamp generator", min, min)
}
@@ -57,6 +63,12 @@ func NewTimestampGenerator(cfg Config) (Generator, error) {
ret.max = max.Unix()
case int64:
ret.max = max
+ case string:+ t, err := time.Parse(time.RFC3339, max)+ if err != nil {+ return nil, fmt.Errorf("maximum '%s' invalid string for timestamp generator", max)+ }+ ret.max = t.Unix()
default:
return nil, fmt.Errorf("maximum '%s' of type '%T' invalid for timestamp generator", max, max)
}
How to set the date / Timestamp type range in the yaml config file, is there some sample?
The target table column type is DATE or TimeStamp, I would like to generate the random value but between "2022-01-01" and "2022-12-31" or "2022-01-01:00-00-00" and "2022-12-31:00-00-00".
The text was updated successfully, but these errors were encountered: