infoschema

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package infoschema is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	*DbColumn
	Index *DbIndex
}

Column defines column in table

type DbColumn

type DbColumn struct {
	Name            string      `db:"COLUMN_NAME"`
	DataType        string      `db:"DATA_TYPE"`
	ColumnType      string      `db:"COLUMN_TYPE"`
	Extra           string      `db:"EXTRA"`
	Comment         string      `db:"COLUMN_COMMENT"`
	ColumnDefault   interface{} `db:"COLUMN_DEFAULT"`
	IsNullAble      string      `db:"IS_NULLABLE"`
	OrdinalPosition int         `db:"ORDINAL_POSITION"`
}

DbColumn defines column info of columns

type DbIndex

type DbIndex struct {
	IndexName  string `db:"INDEX_NAME"`
	NonUnique  int    `db:"NON_UNIQUE"`
	SeqInIndex int    `db:"SEQ_IN_INDEX"`
}

DbIndex defines index of columns in information_schema.statistic

type IInformationSchema

type IInformationSchema interface {
	GetAllTables(database string) ([]string, error)
	FindColumns(db, table string) (*Table, error)
	FindIndex(db, table, column string) ([]*DbIndex, error)
}

IInformationSchema defines an interface for schema. Just for mock.

func NewInformationSchemaModel

func NewInformationSchemaModel(conn sqlx.SqlConn) IInformationSchema

NewInformationSchemaModel creates an instance for InformationSchemaModel

type InformationSchemaModel

type InformationSchemaModel struct {
	// contains filtered or unexported fields
}

InformationSchemaModel defines information schema model

func (*InformationSchemaModel) FindColumns

func (m *InformationSchemaModel) FindColumns(db, table string) (*Table, error)

FindColumns return columns in specified database and table

func (*InformationSchemaModel) FindIndex

func (m *InformationSchemaModel) FindIndex(db, table, column string) ([]*DbIndex, error)

FindIndex finds index with given db, table and column.

func (*InformationSchemaModel) GetAllTables

func (m *InformationSchemaModel) GetAllTables(database string) ([]string, error)

GetAllTables selects all tables from TABLE_SCHEMA

type MockIInformationSchema

type MockIInformationSchema struct {
	// contains filtered or unexported fields
}

MockIInformationSchema is a mock of IInformationSchema interface.

func NewMockIInformationSchema

func NewMockIInformationSchema(ctrl *gomock.Controller) *MockIInformationSchema

NewMockIInformationSchema creates a new mock instance.

func (*MockIInformationSchema) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIInformationSchema) FindColumns

func (m *MockIInformationSchema) FindColumns(db, table string) (*Table, error)

FindColumns mocks base method.

func (*MockIInformationSchema) FindIndex

func (m *MockIInformationSchema) FindIndex(db, table, column string) ([]*DbIndex, error)

FindIndex mocks base method.

func (*MockIInformationSchema) GetAllTables

func (m *MockIInformationSchema) GetAllTables(database string) ([]string, error)

GetAllTables mocks base method.

type MockIInformationSchemaMockRecorder

type MockIInformationSchemaMockRecorder struct {
	// contains filtered or unexported fields
}

MockIInformationSchemaMockRecorder is the mock recorder for MockIInformationSchema.

func (*MockIInformationSchemaMockRecorder) FindColumns

func (mr *MockIInformationSchemaMockRecorder) FindColumns(db, table interface{}) *gomock.Call

FindColumns indicates an expected call of FindColumns.

func (*MockIInformationSchemaMockRecorder) FindIndex

func (mr *MockIInformationSchemaMockRecorder) FindIndex(db, table, column interface{}) *gomock.Call

FindIndex indicates an expected call of FindIndex.

func (*MockIInformationSchemaMockRecorder) GetAllTables

func (mr *MockIInformationSchemaMockRecorder) GetAllTables(database interface{}) *gomock.Call

GetAllTables indicates an expected call of GetAllTables.

type Table

type Table struct {
	Db      string
	Table   string
	Columns []*Column
}

Table defines table data

Jump to

Keyboard shortcuts

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