datagen

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataGen

type DataGen struct {
	// contains filtered or unexported fields
}

DataGen can generate a bunch of data of type Record

func NewDataGen

func NewDataGen(spec *Spec) *DataGen

func (*DataGen) FixedValue

func (dg *DataGen) FixedValue() string

func (*DataGen) Key

func (dg *DataGen) Key(n int) string

func (*DataGen) LargeGrp

func (dg *DataGen) LargeGrp(n int) string

func (*DataGen) NumRecords

func (dg *DataGen) NumRecords() int

func (*DataGen) RandomPayload

func (dg *DataGen) RandomPayload() string

func (*DataGen) Record

func (dg *DataGen) Record(n int) *Record

func (*DataGen) SmallGrp

func (dg *DataGen) SmallGrp(n int) string

func (*DataGen) Uniq

func (dg *DataGen) Uniq(n int) string

type Record

type Record struct {
	Pk         string
	Uniq       string
	SmallGrp   string
	LargeGrp   string
	FixedValue string
	SeqNum     int64
	TimeStamp  int64
	Payload    string
}

Record represents a single record with a fixed, well-defined set of fields

type Spec

type Spec struct {
	SpecType       string
	Version        int
	RecordSize     int
	KeyGenSpec     *keygen.LeveledKeyGenSpec
	UniqTrSpec     *strtr.Spec
	SmallGrpTrSpec *strtr.Spec
	LargeGrpTrSpec *strtr.Spec
	FixedValue     string
}

Spec is the specification for generating a DataGen for the following schema:

pk        varchar,
uniq      varchar,
small_grp varchar,
large_grp varchar,
same      varchar,
seq_num   int    ,
ts        timestamp,
payload   varchar,

func LoadSpecFromFile

func LoadSpecFromFile(fileName string) (*Spec, error)

func NewSpec

func NewSpec(recordCount int, recordSize int) *Spec

func (*Spec) IsValid

func (spec *Spec) IsValid() bool

func (*Spec) Json

func (spec *Spec) Json() []byte

func (*Spec) SaveToFile

func (spec *Spec) SaveToFile(fileName string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL