package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Functions

Apply executes all mutators on stmts.
ApplyString executes all mutators on input.
GenEncDatumRowsBytes converts rows of bytes to rows of EncDatum value encoded bytes.
GenEncDatumRowsInt converts rows of ints to rows of EncDatum DInts.
GenEncDatumRowsString converts rows of strings to rows of EncDatum Strings.
IntEncDatum returns an EncDatum representation of DInt(i).
IsAllowedForArray returns true iff the passed in type can be a valid ArrayContents().
IsLegalColumnType returns true if the given type can be given to a column in a user-created table.
MakeIntRows constructs a numRows x numCols table where rows[i][j] = i + j.
MakeRandIntRows constructs a numRows x numCols table where the values are random.
MakeRandIntRowsInRange constructs a numRows * numCols table where the values are random integers in the range [0, maxNum).
MakeRepeatedIntRows constructs a numRows x numCols table where blocks of n consecutive rows have the same value.
MakeSchemaName creates a CreateSchema definition.
NullChance returns `n` representing a 1 out of `n` probability of generating nulls, depending on whether `nullOk` is true.
NullEncDatum returns and EncDatum representation of tree.DNull.
PopulateTableWithRandData populates the provided table by executing exactly `numInserts` statements.
RandArray generates a random DArray where the contents have nullChance of being null.
RandArrayContentsType returns a random type that's guaranteed to be valid to use as the contents of an array.
RandArrayType generates a random array type.
RandArrayWithCommonDataChance generates a random DArray where the contents have a 1 in `nullChance` chance of being null, plus it favors generation of non-random data if favorCommonData is true.
RandCollationLocale returns a random element of collationLocales.
RandColumnType returns a random type that is a legal column type (e.g.
RandColumnTypes returns a slice of numCols random types.
RandCreateCompositeType creates a random composite type statement.
RandCreateEnumType creates a random CREATE TYPE <type_name> AS ENUM statement.
RandCreateTable creates a random CreateTable definition.
RandCreateTables creates random table definitions.
RandCreateTableWithColumnIndexNumberGenerator creates a random CreateTable definition using the passed function to generate column index numbers for column names.
RandDatum generates a random Datum of the given type.
RandDatumEncoding returns a random DatumEncoding value.
RandDatumSimple generates a random Datum of the given type.
RandDatumWithNullChance generates a random Datum of the given type.
RandEncDatum generates a random EncDatum (of a random type).
RandEncDatumRowOfTypes generates a slice of random EncDatum values for the corresponding type in types.
RandEncDatumRows generates EncDatumRows where all rows follow the same random []ColumnType structure.
RandEncDatumRowsOfTypes generates EncDatumRows, each row with values of the corresponding type in types.
RandSortingEncDatumSlice generates a slice of random EncDatum values of the same random type which is key-encodable.
RandSortingEncDatumSlices generates EncDatum slices, each slice with values of the same random type which is key-encodable.
RandSortingType returns a column type which can be key-encoded.
RandSortingTypes returns a slice of numCols random ColumnType values which are key-encodable.
RandTupleFromSlice returns a random tuple which has field chosen randomly from the input slice of types.
RandType returns a random type value.
RandTypeFromSlice returns a random type from the input slice of types.
TestingMakePrimaryIndexKey creates a key prefix that corresponds to a table row (in the primary index); it is intended for tests.
TestingMakePrimaryIndexKeyForTenant is the same as TestingMakePrimaryIndexKey, but allows specification of the codec to use when encoding keys.
TestingMakeSecondaryIndexKey creates a key prefix that corresponds to a secondary index; it is intended for tests.

# Constants

# Variables

ColumnFamilyMutator modifies a CREATE TABLE statement without any FAMILY definitions to have random FAMILY definitions.
ForeignKeyMutator adds ALTER TABLE ADD FOREIGN KEY statements.
IndexStoringMutator modifies the STORING clause of CREATE INDEX and indexes in CREATE TABLE.
PartialIndexMutator adds random partial index predicate expressions to indexes.
PostgresCreateTableMutator modifies CREATE TABLE statements to remove any features not supported by Postgres that would change results (like descending primary keys).
PostgresMutator modifies strings such that they execute identically in both Postgres and Cockroach (however this mutator does not remove features not supported by Postgres; use PostgresCreateTableMutator for those).
SeedTypes includes the following types that form the basis of randomly generated types: - All scalar types, except UNKNOWN, ANY, TRIGGER, REGNAMESPACE, and FLOAT4 - ARRAY of ANY and TUPLE of ANY, where the ANY will be replaced with one of the legal array element types in RandType - OIDVECTOR and INT2VECTOR types.
StatisticsMutator adds ALTER TABLE INJECT STATISTICS statements.

# Interfaces

Mutator defines a method that can mutate or add SQL statements.
StringMutator defines a mutator that works on strings.

# Type aliases

MultiStatementMutation defines a func that can return a list of new and/or mutated statements.
StatementMutator defines a func that can change a statement.
StatementStringMutator defines a func that mutates a string.