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.
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.
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.
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.
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.
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.
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.
Index ¶
- Constants
- type Database
- func (d *Database) BeginTxn(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (d *Database) Close() error
- func (d *Database) CommitTxn(txn *sql.Tx) error
- func (d *Database) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *Database) FilterDatabaseIncompatibleTable(sourceSchema string, exporters []string) (*structure.TableObjects, error)
- func (d *Database) FilterDatabaseSequence(sourceSchema string, includeSequenceS, excludeSequenceS []string) (*structure.SequenceObjects, error)
- func (d *Database) FilterDatabaseTable(sourceSchema string, includeTableS, excludeTableS []string) (*structure.TableObjects, error)
- func (d *Database) GeDatabaseInstance() ([]map[string]string, error)
- func (d *Database) GeneralQuery(query string, args ...any) ([]string, []map[string]string, error)
- func (d *Database) GetDatabaseCharset() (string, error)
- func (d *Database) GetDatabaseClusteredTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseCollation() (string, error)
- func (d *Database) GetDatabaseCompositeTypeTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseConsistentPos(ctx context.Context, tx *sql.Tx) (string, error)
- func (d *Database) GetDatabaseExternalTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseGlobalName() (string, error)
- func (d *Database) GetDatabaseMaterializedView(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseNormalView(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseParameters() (string, string, string, string, error)
- func (d *Database) GetDatabasePartitionTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabasePlatformName() (string, string, string, error)
- func (d *Database) GetDatabaseRole() (string, error)
- func (d *Database) GetDatabaseSchema() ([]string, error)
- func (d *Database) GetDatabaseSchemaCodeObject(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaCollation(schemaName string) (string, error)
- func (d *Database) GetDatabaseSchemaColumnDataDefaultCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaColumnTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaConstraintTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaIndexTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaMaterializedViewObject(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaNameALL() ([]string, error)
- func (d *Database) GetDatabaseSchemaNameSingle(schemaNameS string) (string, error)
- func (d *Database) GetDatabaseSchemaObjectTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaPartitionTableCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaPartitionTableType(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaPartitionTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaSubPartitionTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaSynonymObject(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableAvgRowLengthOverLimitMB(schemaName []string, limitMB int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableAvgRowLengthTOP(schemaName []string, top int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableColumnCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableColumnNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableIndexCountsOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableIndexLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableIndexNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableIndexOverview(schemaNameS []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableRowsTOP(schemaName []string, top int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableSequenceNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableSpecialDatatype(schemaName []string, specialDatatype string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTableViewNameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaTemporaryTableTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSchemaViewTypeCounts(schemaName []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSequenceName(schemaName string, seqName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseSequences(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseServerMemorySize() (string, error)
- func (d *Database) GetDatabaseServerNumCPU() (string, error)
- func (d *Database) GetDatabaseSessionMaxActiveCount() ([]map[string]string, error)
- func (d *Database) GetDatabaseSize() (string, error)
- func (d *Database) GetDatabaseSoftVersion() (string, error)
- func (d *Database) GetDatabaseTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseTableCharset(schemaName, tableName string) (string, error)
- func (d *Database) GetDatabaseTableCheckKey(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableChunkTask(taskName, schemaName, tableName string, chunkSize uint64, callTimeout uint64, ...) error
- func (d *Database) GetDatabaseTableCollation(schemaName, tableName string) (string, error)
- func (d *Database) GetDatabaseTableColumnComment(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableColumnInfo(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableColumnNameSqlDimensions(sqlStr string) ([]string, map[string]string, map[string]string, error)
- func (d *Database) GetDatabaseTableColumnNameTableDimensions(schemaName, tableName string) ([]string, error)
- func (d *Database) GetDatabaseTableColumnProperties(schemaNameS, tableNameS string, columnNameS []string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableComment(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableCompareCrc(querySQL string, callTimeout int, dbCharsetS, dbCharsetT, separator string, ...) ([]string, uint32, map[string]int64, error)
- func (d *Database) GetDatabaseTableCompareRow(query string, args ...any) ([]string, []map[string]string, error)
- func (d *Database) GetDatabaseTableConstraintIndexColumn(schemaNameS, tableNameS string) (map[string]string, error)
- func (d *Database) GetDatabaseTableCsvData(querySQL string, queryArgs []interface{}, callTimeout int, ...) error
- func (d *Database) GetDatabaseTableForeignKey(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableHighestSelectivityIndex(schemaNameS, tableNameS string, compareCondField string, ...) (*structure.Selectivity, error)
- func (d *Database) GetDatabaseTableNonStmtData(taskFlow, querySQL string, queryArgs []interface{}, batchSize, callTimeout int, ...) error
- func (d *Database) GetDatabaseTableNormalIndex(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableOriginStruct(schemaName, tableName, tableType string) (string, error)
- func (d *Database) GetDatabaseTablePartitionExpress(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTablePrimaryKey(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableRandomValues(schemaNameS, tableNameS string, columns []string, conditions string, ...) ([][]string, error)
- func (d *Database) GetDatabaseTableRows(schemaName, tableName string) (uint64, error)
- func (d *Database) GetDatabaseTableSize(schemaName, tableName string) (float64, error)
- func (d *Database) GetDatabaseTableStatisticsBucket(schemaNameS, tableNameS string, consColumns map[string]string) (map[string][]structure.Bucket, map[string]string, error)
- func (d *Database) GetDatabaseTableStatisticsHistogram(schemaNameS, tableNameS string, consColumns map[string]string) (map[string]structure.Histogram, error)
- func (d *Database) GetDatabaseTableStmtData(querySQL string, queryArgs []interface{}, batchSize, callTimeout int, ...) error
- func (d *Database) GetDatabaseTableType(schemaName string) (map[string]string, error)
- func (d *Database) GetDatabaseTableUniqueIndex(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTableUniqueKey(schemaName string, tableName string) ([]map[string]string, error)
- func (d *Database) GetDatabaseTemporaryTable(schemaName string) ([]string, error)
- func (d *Database) GetDatabaseUsernameLengthOverLimit(schemaName []string, limit int) ([]map[string]string, error)
- func (d *Database) GetDatabaseVersion() (string, error)
- func (d *Database) PingDatabaseConnection() error
- func (d *Database) PrepareContext(ctx context.Context, sqlStr string) (*sql.Stmt, error)
- func (d *Database) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *Database) Transaction(ctx context.Context, opts *sql.TxOptions, ...) error
Constants ¶
const ( MYSQLDatabaseMaxIdleConn = 1024 MYSQLDatabaseMaxConn = 4096 MYSQLDatabaseConnMaxLifeTime = 300 * time.Second MYSQLDatabaseConnMaxIdleTime = 200 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Ctx context.Context DBConn *sql.DB CallTimeout int64 // unit: seconds, sql execute timeout }
func NewDatabase ¶
func NewDatabase(ctx context.Context, datasource *datasource.Datasource, callTimeout int64) (*Database, error)