cmd

package
v0.0.0-...-06b4540 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func SessionStats_printExampleCounter

func SessionStats_printExampleCounter[K comparable](examples []CounterWithExample[K])

Types

type CounterWithExample

type CounterWithExample[K comparable] struct {
	ID      K      `yaml:"id"`
	Count   int    `yaml:"count"`
	Example string `yaml:"example"`
}

type OneOrSliceString

type OneOrSliceString []string

func (*OneOrSliceString) Strings

func (s *OneOrSliceString) Strings() []string

func (*OneOrSliceString) UnmarshalYAML

func (s *OneOrSliceString) UnmarshalYAML(value *yaml.Node) error

type PgIssueRules

type PgIssueRules struct {
	Name            string           `yaml:"name"`
	Count           int              `yaml:"count"`
	Tag             OneOrSliceString `yaml:"tag,omitempty"`
	IssueLink       string           `yaml:"issue_link,omitempty"`
	IssueRegexp     OneOrSliceString `yaml:"issue_regexp,omitempty"`
	QueryRegexp     OneOrSliceString `yaml:"query_regexp,omitempty"`
	Example         string           `yaml:"example,omitempty"`
	Comment         string           `yaml:"comment,omitempty"`
	Skip            bool             `yaml:"skip,omitempty"` // skip the issue on check query step
	PrintIssueToLog bool             `yaml:"print_issue_to_log,omitempty"`
	// contains filtered or unexported fields
}

func (*PgIssueRules) Init

func (r *PgIssueRules) Init() error

func (*PgIssueRules) IsMatched

func (r *PgIssueRules) IsMatched(query string, issue internal.YdbIssue) bool

type QueryStats

type QueryStats struct {
	MatchToRules    map[string]*CounterWithExample[string] // [rule name] query example
	UnknownProblems map[string]*CounterWithExample[string]
	// contains filtered or unexported fields
}

func (*QueryStats) CountASOK

func (s *QueryStats) CountASOK(query string)

func (*QueryStats) CountAsKnown

func (s *QueryStats) CountAsKnown(ruleName string, query string)

func (*QueryStats) CountAsUnknown

func (s *QueryStats) CountAsUnknown(reason string, query string)

func (*QueryStats) GetOkCount

func (s *QueryStats) GetOkCount() int

func (*QueryStats) GetOkPercent

func (s *QueryStats) GetOkPercent() float64

func (*QueryStats) GetTopKnown

func (s *QueryStats) GetTopKnown(count int) []CounterWithExample[string]

func (*QueryStats) GetTopUnknown

func (s *QueryStats) GetTopUnknown(count int) []CounterWithExample[string]

func (*QueryStats) GetTotalCount

func (s *QueryStats) GetTotalCount() int

func (*QueryStats) PrintStats

func (s *QueryStats) PrintStats()

func (*QueryStats) SaveToFile

func (s *QueryStats) SaveToFile(path string) error

type ReplacePair

type ReplacePair struct {
	From string
	To   string
}

type Rules

type Rules struct {
	TotalStat struct {
		TotalCount int     `yaml:"total_checked_queries,omitempty"`
		TotalOk    int     `yaml:"total_ok,omitempty"`
		OkPercent  float64 `yaml:"ok_percent,omitempty"`
	} `yaml:"stat"`

	Issues []PgIssueRules
}

func (*Rules) LoadFromFile

func (r *Rules) LoadFromFile(path string) error

func (*Rules) MatchToKnownIssues

func (r *Rules) MatchToKnownIssues(queryText string, ydbIssues []internal.YdbIssue) ([]PgIssueRules, []internal.YdbIssue)

func (*Rules) UpdateFromStats

func (r *Rules) UpdateFromStats(stats *QueryStats, sortByCount bool)

func (*Rules) WriteToFile

func (r *Rules) WriteToFile(path string) error

Jump to

Keyboard shortcuts

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