Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasSpecialAttributes ¶
HasSpecialAttributes checks if a table has any special attributes.
Types ¶
type DBInfoAsInfoSchema ¶
DBInfoAsInfoSchema is used mainly in test.
func (DBInfoAsInfoSchema) AllSchemas ¶
func (d DBInfoAsInfoSchema) AllSchemas() []*model.DBInfo
AllSchemas implement infoschema.SchemaAndTable interface.
func (DBInfoAsInfoSchema) SchemaTableInfos ¶
func (d DBInfoAsInfoSchema) SchemaTableInfos(ctx stdctx.Context, schema pmodel.CIStr) ([]*model.TableInfo, error)
SchemaTableInfos implement infoschema.SchemaAndTable interface.
type MetaOnlyInfoSchema ¶
type MetaOnlyInfoSchema interface { SchemaMetaVersion() int64 SchemaByName(schema pmodel.CIStr) (*model.DBInfo, bool) SchemaExists(schema pmodel.CIStr) bool TableInfoByName(schema, table pmodel.CIStr) (*model.TableInfo, error) TableInfoByID(id int64) (*model.TableInfo, bool) FindTableInfoByPartitionID(partitionID int64) (*model.TableInfo, *model.DBInfo, *model.PartitionDefinition) TableExists(schema, table pmodel.CIStr) bool SchemaByID(id int64) (*model.DBInfo, bool) SchemaAndTable AllSchemaNames() []pmodel.CIStr SchemaSimpleTableInfos(ctx stdctx.Context, schema pmodel.CIStr) ([]*model.TableNameInfo, error) ListTablesWithSpecialAttribute(filter SpecialAttributeFilter) []TableInfoResult Misc }
MetaOnlyInfoSchema is a workaround. Due to circular dependency cannot return the complete interface. But MetaOnlyInfoSchema is widely used for scenes that require meta only, so we give a convenience for that.
type Misc ¶
type Misc interface { PolicyByName(name pmodel.CIStr) (*model.PolicyInfo, bool) ResourceGroupByName(name pmodel.CIStr) (*model.ResourceGroupInfo, bool) // PlacementBundleByPhysicalTableID is used to get a rule bundle. PlacementBundleByPhysicalTableID(id int64) (*placement.Bundle, bool) // AllPlacementBundles is used to get all placement bundles AllPlacementBundles() []*placement.Bundle // AllPlacementPolicies returns all placement policies AllPlacementPolicies() []*model.PolicyInfo // ClonePlacementPolicies returns a copy of all placement policies. ClonePlacementPolicies() map[string]*model.PolicyInfo // AllResourceGroups returns all resource groups AllResourceGroups() []*model.ResourceGroupInfo // CloneResourceGroups returns a copy of all resource groups. CloneResourceGroups() map[string]*model.ResourceGroupInfo // HasTemporaryTable returns whether information schema has temporary table HasTemporaryTable() bool // GetTableReferredForeignKeys gets the table's ReferredFKInfo by lowercase schema and table name. GetTableReferredForeignKeys(schema, table string) []*model.ReferredFKInfo }
Misc contains the methods that are not closely related to InfoSchema.
type SchemaAndTable ¶
type SchemaAndTable interface { AllSchemas() []*model.DBInfo SchemaTableInfos(ctx stdctx.Context, schema pmodel.CIStr) ([]*model.TableInfo, error) }
SchemaAndTable is define for iterating all the schemas and tables in the infoschema.
type SpecialAttributeFilter ¶
SpecialAttributeFilter is used to filter tables with special attributes.
var AllPlacementPolicyAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { if t.PlacementPolicyRef != nil { return true } if t.Partition != nil { for _, def := range t.Partition.Definitions { if def.PlacementPolicyRef != nil { return true } } } return false }
AllPlacementPolicyAttribute is the Placement Policy attribute filter used by ListTablesWithSpecialAttribute. Different from PlacementPolicyAttribute, Partition.Enable flag will be ignored.
var AllSpecialAttribute SpecialAttributeFilter = HasSpecialAttributes
AllSpecialAttribute marks a model.TableInfo with any special attributes.
var ForeignKeysAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { return len(t.ForeignKeys) > 0 }
ForeignKeysAttribute is the ForeignKeys attribute filter used by ListTablesWithSpecialAttribute.
var PartitionAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { return t.GetPartitionInfo() != nil }
PartitionAttribute is the Partition attribute filter used by ListTablesWithSpecialAttribute.
var PlacementPolicyAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { if t.PlacementPolicyRef != nil { return true } if parInfo := t.GetPartitionInfo(); parInfo != nil { for _, def := range parInfo.Definitions { if def.PlacementPolicyRef != nil { return true } } } return false }
PlacementPolicyAttribute is the Placement Policy attribute filter used by ListTablesWithSpecialAttribute.
var TTLAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { return t.State == model.StatePublic && t.TTLInfo != nil }
TTLAttribute is the TTL attribute filter used by ListTablesWithSpecialAttribute.
var TableLockAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { return t.Lock != nil }
TableLockAttribute is the Table Lock attribute filter used by ListTablesWithSpecialAttribute.
var TiFlashAttribute SpecialAttributeFilter = func(t *model.TableInfo) bool { return t.TiFlashReplica != nil }
TiFlashAttribute is the TiFlashReplica attribute filter used by ListTablesWithSpecialAttribute.