profiler

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PROFILE_RECORD_ID = `profile_record_id`
View Source
const TABLE_COLUMN_NAME_ID = `table_column_name_id`
View Source
const TABLE_COLUMN_PROFILE_PREFIX = `table_column_profiles_`
View Source
const TABLE_CUSTOM_COLUMN_NAMES = `table_custom_column_names`
View Source
const TABLE_CUSTOM_COLUMN_NAME_ID = `table_column_name_id`
View Source
const TABLE_CUSTOM_COLUMN_PROFILE_PREFIX = `table_custom_column_profiles_`

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnProfileData

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

type CustomColumnDefition

type CustomColumnDefition struct {
	ColumnName       string `json:"ColumnName"`
	ColumnDefinition string `json:"ColumnDefinition"`
}

type ProfileDefinition

type ProfileDefinition struct {
	FullProfileTables   []string          `json:"FullProfileTables"`
	CustomProfileTables []TableDefinition `json:"CustomProfileTables"`
}

type ProfileRecord

type ProfileRecord struct {
	ID          int       `db:"id" table:"profile_records" primaryKey:"true"`
	ProfileDate time.Time `db:"profile_date"`
}

type ProfileStore

type ProfileStore struct {
	UsePascalCase bool
	// contains filtered or unexported fields
}

ProfileStore is used to store all the profile data that the profiler generates. This is a db wrapper essentially

func NewProfileStore

func NewProfileStore(dbConn db.DBConn) *ProfileStore

func (*ProfileStore) NewProfile

func (p *ProfileStore) NewProfile() (int, error)

Creates a new profile entry and returns the profile id

func (*ProfileStore) RecordTableProfile

func (p *ProfileStore) RecordTableProfile(tableNameID int, rowCount int, tableSize int64, profileID int) (int, error)

func (*ProfileStore) RegisterTable

func (p *ProfileStore) RegisterTable(tableName string) (int, error)

func (*ProfileStore) RegisterTableColumn

func (p *ProfileStore) RegisterTableColumn(tableNameID int, columnTypeID int, columnName string) (int, error)

func (*ProfileStore) RegisterTableColumnType

func (p *ProfileStore) RegisterTableColumnType(columnDataType string) (int, error)

func (*ProfileStore) RegisterTableCustomColumn

func (p *ProfileStore) RegisterTableCustomColumn(tableNameID int, columnTypeID int, columnName string, columnDefinition string) (int, error)

func (*ProfileStore) ScaffoldProfileStore

func (p *ProfileStore) ScaffoldProfileStore() error

Ensures the core profile db data stores are built

func (*ProfileStore) StoreColumnProfileData

func (p *ProfileStore) StoreColumnProfileData(columnNamesID int, columnType string, profileID int, profileResults []ColumnProfileData) error

TODO - make this function not horrible

func (*ProfileStore) StoreCustomColumnProfileData

func (p *ProfileStore) StoreCustomColumnProfileData(columnNamesID int, columnType *sql.ColumnType, profileID int, profileValue interface{}) error

Stores the custom column profile data, scaffolds the custom profile table for the value type if needed

type Profiler

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

func NewProfiler

func NewProfiler(targetDBConn db.DBConn, profileDBConn db.DBConn) *Profiler

NewProfiler returns a new profiler with default options for the specified databases targetDBConn is the database to be profiled profileDBConn is the database to store the profile data

func NewProfilerWithOptions

func NewProfilerWithOptions(targetDBConn db.DBConn, profileDBConn db.DBConn, options ProfilerOptions) *Profiler

NewProfilerWithOptions returns a new profiler with the specified options

func (*Profiler) ProfileTablesByName

func (p *Profiler) ProfileTablesByName(tableNames []string) error

Run profiles on all provided tables and store

func (*Profiler) RunProfile

func (p *Profiler) RunProfile(profile ProfileDefinition) error

Run profiles on all provided tables and store

type ProfilerOptions

type ProfilerOptions struct {
	UsePascalCase bool
}

type TableColumnName

type TableColumnName struct {
	ID                int    `db:"id" table:"table_column_names" primaryKey:"true"`
	TableNameID       int    `db:"table_name_id"`
	TableColumnName   string `db:"table_column_name"`
	TableColumnTypeID int    `db:"table_column_type_id"`
}

type TableColumnType

type TableColumnType struct {
	ID              int    `db:"id" table:"table_column_types" primaryKey:"true"`
	TableColumnType string `db:"table_column_type"`
}

type TableCustomColumnName

type TableCustomColumnName struct {
	ID                     int    `db:"id" table:"table_custom_column_names" primaryKey:"true"`
	TableNameID            int    `db:"table_name_id"`
	TableColumnName        string `db:"table_column_name"`
	TableColumnTypeID      int    `db:"table_column_type_id"`
	CustomColumnDefinition string `db:"table_custom_column_definition"`
}

type TableDefinition

type TableDefinition struct {
	TableName     string                 `json:"TableName"`
	Columns       []string               `json:"Columns"`
	CustomColumns []CustomColumnDefition `json:"CustomColumns"`
}

type TableName

type TableName struct {
	ID        int    `db:"id" table:"table_names" primaryKey:"true"`
	TableName string `db:"table_name"`
}

type TableProfile

type TableProfile struct {
	ID              int   `db:"id" table:"table_profiles" primaryKey:"true"`
	TableNameID     int   `db:"table_name_id"`
	TableRowCount   int   `db:"table_row_count"`
	TableSize       int64 `db:"table_size"`
	ProfileRecordID int   `db:"profile_record_id"`
}

Jump to

Keyboard shortcuts

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