config

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptTemplateForGenerateSchema = "" /* 130-byte string literal not displayed */
	PromptTemplateForInsertData     = "Also generate the 100 SQL commands insert randomized data into the %v. Give me only SQL Commands No text."
)
View Source
const (
	MySQL     = "mysql"
	Postgres  = "postgres"
	SQLServer = "sqlserver"
	MongoDB   = "mongodb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection added in v0.4.3

type Connection struct {
	DbType           string `json:"db_type,omitempty" yaml:"dbType,omitempty"`
	ConnectionString string `json:"connection_string,omitempty" yaml:"connection,omitempty"`
	DbName           string `json:"db_name,omitempty" yaml:"dbName,omitempty"`
}

func (Connection) NewClient added in v0.4.3

func (s Connection) NewClient() (*gorm.DB, error)

type DataGeneration added in v0.4.3

type DataGeneration struct {
	Connection Connection `json:"connection,omitempty" yaml:"connection,omitempty"`
	TableName  string     `json:"table_name,omitempty" yaml:"tableName,omitempty"`
	MinRows    int        `json:"min_rows,omitempty" yaml:"minRows,omitempty"`
	MaxRows    int        `json:"max_rows,omitempty" yaml:"maxRows,omitempty"`
}

func (DataGeneration) GenerateData added in v0.4.3

func (g DataGeneration) GenerateData() error

type Field added in v0.4.3

type Field struct {
	Name string
	Type TypeInterface
}

type Randomize

type Randomize struct {
	Variable           string `yaml:"variable"`
	RangeFrom          int    `yaml:"rangeFrom,omitempty"`
	RangeTo            int    `yaml:"rangeTo,omitempty"`
	RandomString       bool   `yaml:"randomString,omitempty"`
	RandomAlphanumeric bool   `yaml:"randomAlphanumeric,omitempty"`
	// contains filtered or unexported fields
}

type Scenario

type Scenario struct {
	Connection                            // Applies to NoSQL Databases Only
	Scenarios       []SimpleConfiguration `json:"scenarios" yaml:"scenarios"`
	Collection      string                `json:"collection" yaml:"collection"`            // Applies to NoSQL Databases Only
	QueryType       string                `json:"query_type" yaml:"queryType"`             // Applies to MongoDB Only
	SortQuery       string                `json:"sort_query" yaml:"sortQuery"`             // Applies to MongoDB Only
	SkipNumber      int                   `json:"skip_number" yaml:"skipNumber"`           // Applies to MongoDB Only
	LimitNumber     int                   `json:"limit_number" yaml:"limitNumber"`         // Applies to MongoDB Only
	ProjectionQuery string                `json:"projection_query" yaml:"projectionQuery"` // Applies to MongoDB Only
	Docs            []interface{}         `json:"docs" yaml:"docs"`                        // Applies to NoSQL Databases Only
}

func ParseScenario

func ParseScenario(config []byte) *Scenario

func (*Scenario) Start

func (s *Scenario) Start()

type SchemaGeneration added in v0.4.3

type SchemaGeneration struct {
	// Name of the generation
	Connection Connection             `json:"connection,omitempty" yaml:"connection,omitempty"`
	Schema     StaticSchemaGeneration `json:"schema,omitempty" yaml:"schema,omitempty"`
	DryRun     bool                   `json:"dry_run,omitempty" yaml:"dryRun,omitempty"`
	Tables     TableGeneration        `json:"tables,omitempty" yaml:"tables,omitempty"`
	Rows       DataGeneration         `json:"rows,omitempty" yaml:"rows,omitempty"`
}

func (SchemaGeneration) GenerateSchema added in v0.4.3

func (g SchemaGeneration) GenerateSchema() error

type SchemaGenerationWithLLM added in v0.4.4

type SchemaGenerationWithLLM struct {
	Connection       Connection `yaml:"connection,omitempty"`
	Provider         string     `yaml:"provider,omitempty"`
	Model            string     `yaml:"model,omitempty"`
	SchemaType       string     `yaml:"schema_type,omitempty"`
	InsertIterations int        `yaml:"insert_iterations,omitempty"`
	DryRun           bool       `yaml:"dry_run,omitempty"`
	PersistSchema    string     `yaml:"persist_schema,omitempty"`
}

func (*SchemaGenerationWithLLM) GenerateSchema added in v0.4.4

func (s *SchemaGenerationWithLLM) GenerateSchema(apiToken string) error

type SchemaName added in v0.4.3

type SchemaName struct {
	Name string
}

func (*SchemaName) Create added in v0.4.3

func (s *SchemaName) Create() string

func (*SchemaName) String added in v0.4.3

func (s *SchemaName) String() string

type SimpleConfiguration

type SimpleConfiguration struct {
	Connection
	Collection      string        `json:"collection" yaml:"collection"`
	Query           string        `json:"query" yaml:"query"`
	ParallelRuns    int           `json:"parallel_runs" yaml:"parallelRuns,omitempty"`
	RunFor          string        `json:"run_for" yaml:"runFor,omitempty"`
	CoolOffTime     int           `json:"coolOffTime" yaml:"coolOffTime,omitempty"`
	Randomize       Randomize     `json:"randomize" yaml:"randomize,omitempty"`
	QueryType       string        `json:"query_type" yaml:"queryType"`             // Applies to MongoDB Only
	SortQuery       string        `json:"sort_query" yaml:"sortQuery"`             // Applies to MongoDB Only
	SkipNumber      int           `json:"skip_number" yaml:"skipNumber"`           // Applies to MongoDB Only
	LimitNumber     int           `json:"limit_number" yaml:"limitNumber"`         // Applies to MongoDB Only
	ProjectionQuery string        `json:"projection_query" yaml:"projectionQuery"` // Applies to MongoDB Only
	Docs            []interface{} `json:"docs" yaml:"docs"`                        // Applies to NoSQL Databases Only

}

func ParseConfiguration

func ParseConfiguration(config []byte) *SimpleConfiguration

func (*SimpleConfiguration) Start

func (s *SimpleConfiguration) Start() error

type StaticSchemaGeneration added in v0.4.3

type StaticSchemaGeneration struct {
	NumberOfSchema int    `json:"number_of_schema,omitempty" yaml:"numberOfSchema,omitempty"`
	GenerateTables bool   `json:"generate_tables,omitempty" yaml:"generateTables,omitempty"`
	Language       string `json:"language,omitempty" yaml:"language,omitempty"`
	SchemaName     string `json:"schema_name,omitempty" yaml:"schemaName,omitempty"`
	DryRun         bool   `json:"dry_run,omitempty" yaml:"dryRun,omitempty"`
}

type TableGeneration added in v0.4.3

type TableGeneration struct {
	Connection     Connection `json:"connection,omitempty" yaml:"connection,omitempty"`
	NumberOfTables int        `json:"number_of_tables,omitempty" yaml:"numberOfTables,omitempty"`
	MinColumns     int        `json:"min_columns,omitempty" yaml:"minColumns,omitempty"`
	MaxColumns     int        `json:"max_columns,omitempty" yaml:"maxColumns,omitempty"`
	PopulateTable  bool       `json:"populate_table,omitempty" yaml:"populateTable,omitempty"`
}

func (TableGeneration) GenerateTables added in v0.4.3

func (g TableGeneration) GenerateTables() error

type TypeInterface added in v0.4.3

type TypeInterface interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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