Documentation
¶
Index ¶
- func GenerateQuery(rft map[TableName][]Record, schema Schema) []string
- func GenerateRecordsForTables(vfc map[ColumnFullName][]Value, schema Schema, n int) map[TableName][]Record
- func GenerateValuesForColumns(cg ColumnGraph, n int) map[ColumnFullName][]Value
- type AdjacencyMatrix
- type Column
- type ColumnData
- type ColumnFullName
- type ColumnGraph
- func (cg ColumnGraph) ChildrenNodeIndexes(i int) ([]int, error)
- func (cg ColumnGraph) HasChildrenNodes(i int) (bool, error)
- func (cg ColumnGraph) HasParentNodes(i int) (bool, error)
- func (cg ColumnGraph) IsParentNodesAreAllDone(i int) (bool, error)
- func (cg ColumnGraph) ParentNodeIndexes(i int) ([]int, error)
- type ColumnName
- type ColumnNode
- type ColumnType
- type ColumnTypeBase
- type ColumnTypeParam
- type Constraint
- type Record
- type Schema
- type Table
- type TableName
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateValuesForColumns ¶
func GenerateValuesForColumns(cg ColumnGraph, n int) map[ColumnFullName][]Value
TODO: better to be defined as a method of map[ColumnFullName][]Value? TODO: shuffle values. currently, values with constraints are just simple sum of strings in the order.
Types ¶
type AdjacencyMatrix ¶
type AdjacencyMatrix [][]int
type Column ¶
type Column struct {
Name ColumnName
FullName ColumnFullName
Type ColumnType
AutoIncrement bool
Unsigned bool
Constraints []Constraint
}
func NewColumn ¶
func NewColumn(fullName ColumnFullName, ct ColumnType) Column
func (Column) GenerateData ¶
func (Column) GenerateRandomData ¶
func (c Column) GenerateRandomData() ColumnData
func (Column) HasConstraint ¶
func (*Column) SetAutoIncrement ¶
func (c *Column) SetAutoIncrement()
func (*Column) SetConstraint ¶
func (c *Column) SetConstraint(constraint Constraint)
func (*Column) SetUnsigned ¶
type ColumnFullName ¶
type ColumnFullName string
func NewColumnFullName ¶
func NewColumnFullName(tn TableName, cn ColumnName) ColumnFullName
type ColumnGraph ¶
type ColumnGraph struct {
AdjacencyMatrix AdjacencyMatrix
ColumnNodes []ColumnNode
}
Graph structure of columns expressed by adjacency matrix and nodes
func GenerateColumnGraph ¶
func GenerateColumnGraph(schema Schema) ColumnGraph
func (ColumnGraph) ChildrenNodeIndexes ¶
func (cg ColumnGraph) ChildrenNodeIndexes(i int) ([]int, error)
func (ColumnGraph) HasChildrenNodes ¶
func (cg ColumnGraph) HasChildrenNodes(i int) (bool, error)
func (ColumnGraph) HasParentNodes ¶
func (cg ColumnGraph) HasParentNodes(i int) (bool, error)
TODO: adopt error handling such as Stacktrace
func (ColumnGraph) IsParentNodesAreAllDone ¶
func (cg ColumnGraph) IsParentNodesAreAllDone(i int) (bool, error)
func (ColumnGraph) ParentNodeIndexes ¶
func (cg ColumnGraph) ParentNodeIndexes(i int) ([]int, error)
type ColumnName ¶
type ColumnName string
type ColumnNode ¶
type ColumnNode struct {
// contains filtered or unexported fields
}
func (*ColumnNode) Done ¶
func (cn *ColumnNode) Done()
func (ColumnNode) GetColumn ¶
func (cn ColumnNode) GetColumn() Column
func (ColumnNode) IsDone ¶
func (cn ColumnNode) IsDone() bool
type ColumnType ¶
type ColumnType struct {
Base ColumnTypeBase
Param ColumnTypeParam
}
type ColumnTypeBase ¶
type ColumnTypeBase string
const ( Varchar ColumnTypeBase = "varchar" Varbinary ColumnTypeBase = "varbinary" Mediumblob ColumnTypeBase = "mediumblob" Text ColumnTypeBase = "text" Tinyint ColumnTypeBase = "tinyint" Smallint ColumnTypeBase = "smallint" Mediumint ColumnTypeBase = "mediumint" Int ColumnTypeBase = "int" Bigint ColumnTypeBase = "bigint" Timestamp ColumnTypeBase = "timestamp" Datetime ColumnTypeBase = "datetime" Json ColumnTypeBase = "json" )
func StrToColumnTypeBase ¶
func StrToColumnTypeBase(str string) (ColumnTypeBase, error)
type ColumnTypeParam ¶
type ColumnTypeParam int
type Constraint ¶
type Constraint struct {
TableName
ColumnName
}
func NewConstraint ¶
func NewConstraint(tn TableName, cn ColumnName) Constraint
type Table ¶
func (*Table) AddColumns ¶
Click to show internal directories.
Click to hide internal directories.