cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package cmd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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.

Types

type BatchReport

type BatchReport struct {
	FileName     string        `json:"file_name"`
	TotalQueries int           `json:"total_queries"`
	SuccessCount int           `json:"success_count"`
	FailureCount int           `json:"failure_count"`
	Results      []BatchResult `json:"results"`
	GeneratedAt  time.Time     `json:"generated_at"`
}

BatchReport stores all batch analysis results

type BatchResult

type BatchResult struct {
	QueryNumber   int       `json:"query_number"`
	Query         string    `json:"query"`
	ExecutionPlan string    `json:"execution_plan"`
	CostAnalysis  *CostInfo `json:"cost_analysis,omitempty"`
	Error         string    `json:"error,omitempty"`
	GeneratedAt   time.Time `json:"generated_at"`
}

BatchResult stores the analysis result for a single query

type ComparisonResult

type ComparisonResult struct {
	Query1         string    `json:"query1"`
	Query2         string    `json:"query2"`
	Plan1          string    `json:"plan1"`
	Plan2          string    `json:"plan2"`
	Cost1          *CostInfo `json:"cost_analysis1"`
	Cost2          *CostInfo `json:"cost_analysis2"`
	Winner         string    `json:"winner"`
	CostDiff       float64   `json:"cost_difference"`
	CostDiffPct    float64   `json:"cost_difference_percentage"`
	Recommendation string    `json:"recommendation"`
}

type Config

type Config struct {
	Defaults struct {
		Format    string  `yaml:"format"`
		Threshold float64 `yaml:"threshold"`
		Remote    bool    `yaml:"remote"`
	} `yaml:"defaults"`
	Database struct {
		Host     string `yaml:"host"`
		User     string `yaml:"user"`
		Database string `yaml:"database"`
		Password string `yaml:"password"`
	} `yaml:"database"`
}

type CostInfo

type CostInfo struct {
	TotalCost      float64
	ExpensiveOps   []ExpensiveOperation
	ExceedsLimit   bool
	ThresholdValue float64
}

type ExpensiveOperation

type ExpensiveOperation struct {
	Operation string
	Cost      float64
	Line      string
}

type IndexRecommendation

type IndexRecommendation struct {
	TableName       string
	Columns         []string
	IndexType       string
	Reason          string
	OperationType   string
	OperationCost   float64
	CreateStatement string
	Priority        int
}

IndexRecommendation represents a single index recommendation

type IndexRecommendationInfo

type IndexRecommendationInfo struct {
	Recommendations []IndexRecommendation
	TotalFound      int
	HighPriority    int
	ThresholdUsed   float64
}

IndexRecommendationInfo aggregates all recommendations

type OperationContext

type OperationContext struct {
	Line          string
	OperationType string
	TableName     string
	FilterColumns []string
	JoinColumns   []string
	SortColumns   []string
	Cost          float64
	RowsEstimate  int64
}

OperationContext holds parsed information about a single EXPLAIN line

type PlanOutput

type PlanOutput struct {
	Title         string    `json:"title"`
	Query         string    `json:"query"`
	ExecutionPlan string    `json:"execution_plan"`
	GeneratedAt   time.Time `json:"generated_at"`
	CostAnalysis  *CostInfo `json:"cost_analysis,omitempty"`
}

type TemplateData

type TemplateData struct {
	Title string
	Plan  string
	Query string
}

type UploadResponse

type UploadResponse struct {
	ID        string `json:"id"`
	DeleteKey string `json:"deleteKey"`
}

Jump to

Keyboard shortcuts

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