Skip to content

Commit

Permalink
schema: string type lengths between 100 and 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Johansson committed Jun 13, 2019
1 parent 1986781 commit d06af61
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const (
TYPE_VARCHAR = SimpleType("varchar")
TYPE_VARINT = SimpleType("varint")

MaxTupleParts = 20
MaxUDTParts = 20
MaxStringLength = 1000
MinStringLength = 100
MaxTupleParts = 20
MaxUDTParts = 20
)

// TODO: Add support for time when gocql bug is fixed.
Expand Down Expand Up @@ -110,9 +112,11 @@ func (st SimpleType) GenValue(p *PartitionRange) []interface{} {
var val interface{}
switch st {
case TYPE_ASCII, TYPE_TEXT, TYPE_VARCHAR:
val = randStringWithTime(p.Rand, nonEmptyRandIntRange(p.Rand, p.Max, p.Max, 10), randTime(p.Rand))
ln := p.Rand.Intn(MaxStringLength) + MinStringLength
val = randStringWithTime(p.Rand, ln, randTime(p.Rand))
case TYPE_BLOB:
val = hex.EncodeToString([]byte(randStringWithTime(p.Rand, nonEmptyRandIntRange(p.Rand, p.Max, p.Max, 10), randTime(p.Rand))))
ln := p.Rand.Intn(MaxStringLength) + MinStringLength
val = hex.EncodeToString([]byte(randStringWithTime(p.Rand, ln, randTime(p.Rand))))
case TYPE_BIGINT:
val = p.Rand.Int63()
case TYPE_BOOLEAN:
Expand Down

0 comments on commit d06af61

Please sign in to comment.