go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/mysqlctl/tmutils Index | Files

package tmutils

import "gopkg.in/src-d/go-vitess.v1/vt/mysqlctl/tmutils"

Package tmutils contains helper methods to deal with the tabletmanagerdata proto3 structures.


Package Files

permissions.go schema.go


const (
    // TableBaseTable indicates the table type is a base table.
    TableBaseTable = "BASE TABLE"
    // TableView indicates the table type is a view.
    TableView = "VIEW"

func DbPermissionPrimaryKey Uses

func DbPermissionPrimaryKey(dp *tabletmanagerdatapb.DbPermission) string

DbPermissionPrimaryKey returns the sorting key for a DbPermission

func DbPermissionString Uses

func DbPermissionString(dp *tabletmanagerdatapb.DbPermission) string

DbPermissionString pretty-prints a DbPermission

func DiffPermissions Uses

func DiffPermissions(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions, er concurrency.ErrorRecorder)

DiffPermissions records the errors between two permission sets

func DiffPermissionsToArray Uses

func DiffPermissionsToArray(leftName string, left *tabletmanagerdatapb.Permissions, rightName string, right *tabletmanagerdatapb.Permissions) (result []string)

DiffPermissionsToArray difs two sets of permissions, and returns the difference

func DiffSchema Uses

func DiffSchema(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition, er concurrency.ErrorRecorder)

DiffSchema generates a report on what's different between two SchemaDefinitions including views.

func DiffSchemaToArray Uses

func DiffSchemaToArray(leftName string, left *tabletmanagerdatapb.SchemaDefinition, rightName string, right *tabletmanagerdatapb.SchemaDefinition) (result []string)

DiffSchemaToArray diffs two schemas and return the schema diffs if there is any.

func FilterTables Uses

func FilterTables(sd *tabletmanagerdatapb.SchemaDefinition, tables, excludeTables []string, includeViews bool) (*tabletmanagerdatapb.SchemaDefinition, error)

FilterTables returns a copy which includes only whitelisted tables (tables), no blacklisted tables (excludeTables) and optionally views (includeViews).

func GenerateSchemaVersion Uses

func GenerateSchemaVersion(sd *tabletmanagerdatapb.SchemaDefinition)

GenerateSchemaVersion return a unique schema version string based on its TableDefinitions.

func NewDbPermission Uses

func NewDbPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.DbPermission

NewDbPermission is a helper method to create a tabletmanagerdatapb.DbPermission

func NewUserPermission Uses

func NewUserPermission(fields []*querypb.Field, values []sqltypes.Value) *tabletmanagerdatapb.UserPermission

NewUserPermission is a helper method to create a tabletmanagerdatapb.UserPermission

func PermissionsString Uses

func PermissionsString(permissions *tabletmanagerdatapb.Permissions) string

PermissionsString pretty-prints Permissions

func SchemaDefinitionGetTable Uses

func SchemaDefinitionGetTable(sd *tabletmanagerdatapb.SchemaDefinition, table string) (td *tabletmanagerdatapb.TableDefinition, ok bool)

SchemaDefinitionGetTable returns TableDefinition for a given table name.

func SchemaDefinitionToSQLStrings Uses

func SchemaDefinitionToSQLStrings(sd *tabletmanagerdatapb.SchemaDefinition) []string

SchemaDefinitionToSQLStrings converts a SchemaDefinition to an array of SQL strings. The array contains all the SQL statements needed for creating the database, tables, and views - in that order. All SQL statements will have {{.DatabaseName}} in place of the actual db name.

func TableDefinitionGetColumn Uses

func TableDefinitionGetColumn(td *tabletmanagerdatapb.TableDefinition, name string) (index int, ok bool)

TableDefinitionGetColumn returns the index of a column inside a TableDefinition.

func UserPermissionPrimaryKey Uses

func UserPermissionPrimaryKey(up *tabletmanagerdatapb.UserPermission) string

UserPermissionPrimaryKey returns the sorting key for a UserPermission

func UserPermissionString Uses

func UserPermissionString(up *tabletmanagerdatapb.UserPermission) string

UserPermissionString pretty-prints a UserPermission

type SchemaChange Uses

type SchemaChange struct {
    SQL              string
    Force            bool
    AllowReplication bool
    BeforeSchema     *tabletmanagerdatapb.SchemaDefinition
    AfterSchema      *tabletmanagerdatapb.SchemaDefinition

SchemaChange contains all necessary information to apply a schema change. It should not be sent over the wire, it's just a set of parameters.

func (*SchemaChange) Equal Uses

func (s *SchemaChange) Equal(s2 *SchemaChange) bool

Equal compares two SchemaChange objects.

type TableDefinitions Uses

type TableDefinitions []*tabletmanagerdatapb.TableDefinition

TableDefinitions is a list of TableDefinition, for sorting

func (TableDefinitions) Len Uses

func (tds TableDefinitions) Len() int

Len returns TableDefinitions length.

func (TableDefinitions) Swap Uses

func (tds TableDefinitions) Swap(i, j int)

Swap used for sorting TableDefinitions.

Package tmutils imports 12 packages (graph) and is imported by 16 packages. Updated 2019-06-13. Refresh now. Tools for package owners.