sqladvisor

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultAdvisor

func NewDefaultAdvisor(soarBin, configFile string) sqladvisor.Advisor

NewDefaultAdvisor returns a new sqladvisor.Advisor

func NewDefaultAdvisorWithDefault

func NewDefaultAdvisorWithDefault() sqladvisor.Advisor

NewDefaultAdvisorWithDefault returns a new sqladvisor.Advisor with default value

func NewRepository

func NewRepository(db middleware.Pool) sqladvisor.Repository

NewRepository returns a new sqladvisor.Repository

func NewRepositoryWithGlobal

func NewRepositoryWithGlobal() sqladvisor.Repository

NewRepositoryWithGlobal returns a new sqladvisor.Repository with global mysql pool

func NewService

func NewService(soarBin, configFile string) sqladvisor.Service

NewService returns a new *Service

func NewServiceWithDefault

func NewServiceWithDefault() sqladvisor.Service

NewServiceWithDefault returns a new *Service with default value

Types

type DefaultAdvisor

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

func (*DefaultAdvisor) Advise

func (da *DefaultAdvisor) Advise(dbID int, sqlText string) (string, string, error)

Advise parses the sql text and returns the tuning advice, note that only the first sql statement in the sql text will be advised

func (*DefaultAdvisor) GetFingerprint

func (da *DefaultAdvisor) GetFingerprint(sqlText string) string

GetFingerprint returns the fingerprint of the sql text

func (*DefaultAdvisor) GetParser

func (da *DefaultAdvisor) GetParser() *parser.Parser

GetParser returns the parser

func (*DefaultAdvisor) GetSQLID

func (da *DefaultAdvisor) GetSQLID(sqlText string) string

GetSQLID returns the identity of the sql text

type Repository

type Repository struct {
	Database middleware.Pool
}

Repository of sqladvisor

func (*Repository) Execute

func (r *Repository) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*Repository) Save

func (r *Repository) Save(dbID int, sqlText, advice, message string) error

Save saves sql tuning advice into the middleware

func (*Repository) Transaction

func (r *Repository) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

type Service

type Service struct {
	sqladvisor.Repository
	Advisor sqladvisor.Advisor
	Advice  string `json:"advice"`
	Message string `json:"message"`
}

func (*Service) Advise

func (s *Service) Advise(dbID int, sqlText string) (string, error)

Advise parses the sql text and returns the tuning advice, note that only the first sql statement in the sql text will be advised

func (*Service) GetFingerprint

func (s *Service) GetFingerprint(sqlText string) string

GetFingerprint returns the fingerprint of the sql text

func (*Service) GetSQLID

func (s *Service) GetSQLID(sqlText string) string

GetSQLID returns the identity of the sql text

Jump to

Keyboard shortcuts

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