structure

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright © 2020 Marvin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractColumnMatchHistogram added in v0.0.7

func ExtractColumnMatchHistogram(matchIndexes []string, histogramMap map[string]Histogram) map[string]Histogram

func FindColumnMatchConstraintIndexNames added in v0.0.7

func FindColumnMatchConstraintIndexNames(consColumns map[string]string, compareField string, ignoreFields []string) []string

Types

type Bound

type Bound struct {
	ColumnName        string `json:"columnName"`
	Collation         string `json:"collation"`
	Datatype          string `json:"datatype"`
	DatetimePrecision string `json:"datetimePrecision"`
	Lower             string `json:"lower"`
	Upper             string `json:"upper"`

	HasLower bool `json:"hasLower"`
	HasUpper bool `json:"hasUpper"`
}

Bound represents a bound for a column

func (*Bound) String

func (bd *Bound) String() string

type Bucket added in v0.0.7

type Bucket struct {
	Count      int64
	LowerBound string
	UpperBound string
}

Bucket store the index statistics bucket

func StringSliceCreateBuckets added in v0.0.7

func StringSliceCreateBuckets(newColumnsBs []string, numRows int64) []Bucket

StringSliceCreateBuckets creates buckets from a sorted slice of strings. Each bucket's lower bound is the value of one element, and the upper bound is the next element's value. The last bucket will have the same upper bound as the previous bucket if there are no more elements.

type Column

type Column struct {
	NewColumns map[string]NewColumn            `json:"newColumn"`
	OldColumns map[string]map[string]OldColumn `json:"oldColumn"`
}

type ConstraintCheck

type ConstraintCheck struct {
	ConstraintExpression string
}

type ConstraintForeign

type ConstraintForeign struct {
	ConstraintColumn      string
	ReferencedTableSchema string
	ReferencedTableName   string
	ReferencedColumnName  string
	DeleteRule            string
	UpdateRule            string
}

type ConstraintPrimary

type ConstraintPrimary struct {
	ConstraintColumn string
}

type ConstraintUnique

type ConstraintUnique struct {
	ConstraintColumn string
}

type Histogram added in v0.0.7

type Histogram struct {
	DistinctCount int64
	NullCount     int64
}

Histogram store the index statistics histogram

type Index

type Index struct {
	IndexType        string
	Uniqueness       string
	IndexColumn      string
	DomainIndexOwner string
	DomainIndexName  string
	DomainParameters string
}

type NewColumn

type NewColumn struct {
	Datatype    string // custom column datatype
	NULLABLE    string
	DataDefault string
	Charset     string
	Collation   string
	Comment     string
}

func (NewColumn) String

func (n NewColumn) String() string

type OldColumn

type OldColumn struct {
	Datatype          string // complete origin data types, eg: number(20)
	DatatypeName      string
	DataLength        string
	DataPrecision     string
	DatetimePrecision string // only mysql compatible database
	DataScale         string
	NULLABLE          string
	DataDefault       string
	Charset           string
	Collation         string
	Comment           string
}

type Partition

type Partition struct {
	PartitionKey     string
	PartitionType    string
	SubPartitionKey  string
	SubPartitionType string
}

type Range

type Range struct {
	DBType        string         `json:"dbType"`
	DBCharsetFrom string         `json:"dbCharsetFrom"` // charset convert, from the charset (used to the data compare)
	DBCharsetDest string         `json:"dbCharsetDest"` // charset convert, dest the charset (used to the data compare)
	Bounds        []*Bound       `json:"bounds"`
	BoundOffset   map[string]int `json:"boundOffset"`
}

Range represents chunk range

func NewChunkRange added in v0.0.7

func NewChunkRange(dbType, dbCharsetFrom, dbCharsetDest string) *Range

NewChunkRange return a Range.

func (*Range) Copy added in v0.0.7

func (rg *Range) Copy() *Range

func (*Range) String

func (rg *Range) String() string

String returns the string of Range, used for log.

func (*Range) ToString added in v0.0.7

func (rg *Range) ToString() (string, []interface{})

func (*Range) Update

func (rg *Range) Update(columnName, collation, datatype string, datetimePrecision string, lower, upper string, updateLower, updateUpper bool) error

type Rule added in v0.0.7

type Rule struct {
	IndexColumnRule       map[string]string
	ColumnDatatypeRule    map[string]string
	ColumnCollationRule   map[string]string
	DatetimePrecisionRule map[string]string
}

Rule store the highest selectivity bucket upstream and downstream mapping rule, key is the database table column name

type Selectivity added in v0.0.9

type Selectivity struct {
	IndexName         string
	IndexColumn       []string
	ColumnDatatype    []string
	ColumnCollation   []string
	DatetimePrecision []string
	Buckets           []Bucket
}

Selectivity store the highest selectivity constraint or index bucket

func FindMatchDistinctCountBucket added in v0.0.7

func FindMatchDistinctCountBucket(sortHists SortHistograms, bucketMap map[string][]Bucket, consColumns map[string]string) (*Selectivity, error)

func (*Selectivity) String added in v0.0.9

func (h *Selectivity) String() string

func (*Selectivity) TransSelectivity added in v0.0.9

func (h *Selectivity) TransSelectivity(dbTypeS, dbCharsetS string, caseFieldRuleS string, enableCollationSetting bool) error

func (*Selectivity) TransSelectivityRule added in v0.0.9

func (h *Selectivity) TransSelectivityRule(taskFlow, dbTypeT, dbCharsetS string, columnDatatypeT []string, columnRouteRule map[string]string) (*Rule, error)

type SequenceObjects added in v0.0.9

type SequenceObjects struct {
	SequenceNames []string
}

type SortHistogram added in v0.0.7

type SortHistogram struct {
	Key      string // IndexName
	Value    Histogram
	OrderKey string // IndexColumn
}

type SortHistograms added in v0.0.7

type SortHistograms []SortHistogram

func SortDistinctCountHistogram added in v0.0.7

func SortDistinctCountHistogram(histogramMap map[string]Histogram, consColumns map[string]string) SortHistograms

func (SortHistograms) Len added in v0.0.7

func (s SortHistograms) Len() int

func (SortHistograms) Less added in v0.0.7

func (s SortHistograms) Less(i, j int) bool

func (SortHistograms) Swap added in v0.0.7

func (s SortHistograms) Swap(i, j int)

type Table

type Table struct {
	SchemaName         string
	TableName          string
	TableComment       string
	TableCharset       string
	TableCollation     string
	NewColumns         map[string]NewColumn            // columnNameNew -> NewColumn
	OldColumns         map[string]map[string]OldColumn // originColumnName -> columnNameNew -> OldColumn
	Indexes            map[string]Index                // indexName -> Index
	PrimaryConstraints map[string]ConstraintPrimary    // constraintName -> ConstraintPrimary
	UniqueConstraints  map[string]ConstraintUnique     // constraintName -> ConstraintUnique
	ForeignConstraints map[string]ConstraintForeign    // constraintName -> ConstraintForeign
	CheckConstraints   map[string]ConstraintCheck      // constraintName -> ConstraintCheck
	Partitions         []Partition
}

func (*Table) String

func (t *Table) String(jsonType string) string

func (*Table) StringColumn

func (t *Table) StringColumn() string

type TableObjects added in v0.0.6

type TableObjects struct {
	PartitionTables   []string
	TemporaryTables   []string
	ClusteredTables   []string
	MaterializedViews []string
	ExternalTables    []string
	NormalViews       []string
	CompositeTables   []string
	TaskTables        []string // the database support migrate task table list
}

Jump to

Keyboard shortcuts

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