Documentation ¶
Index ¶
- func NewDefaultAdvisor(soarBin, configFile string) sqladvisor.Advisor
- func NewDefaultAdvisorWithDefault() sqladvisor.Advisor
- func NewRepository(db middleware.Pool) sqladvisor.Repository
- func NewRepositoryWithGlobal() sqladvisor.Repository
- func NewService(soarBin, configFile string) sqladvisor.Service
- func NewServiceWithDefault() sqladvisor.Service
- type DefaultAdvisor
- type Repository
- type Service
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 ¶
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 ¶
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 ¶
GetFingerprint returns the fingerprint of the sql text