Documentation
¶
Overview ¶
Copyright 2025 Google LLC
// // 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 ¶
- Variables
- func GetDatabaseSourceFramework(projectRoot string, language string, ...) string
- type AppCodeAssessor
- type DefaultPerformanceSchemaProvider
- type FileAnalysisInput
- type FileAnalysisResponse
- type FileDependencyInfo
- type FrameworkPair
- type InfoSchemaCollector
- func BuildInfoSchemaCollector(tables map[string]utils.TableAssessmentInfo, ...) (InfoSchemaCollector, error)
- func GetDefaultInfoSchemaCollector(conv *internal.Conv, sourceProfile profiles.SourceProfile) (InfoSchemaCollector, error)
- func GetInfoSchemaCollector(conv *internal.Conv, sourceProfile profiles.SourceProfile, ...) (InfoSchemaCollector, error)
- func (c InfoSchemaCollector) IsEmpty() bool
- func (c InfoSchemaCollector) ListColumnDefinitions() (map[string]utils.SrcColumnDetails, map[string]utils.SpColumnDetails)
- func (c InfoSchemaCollector) ListFunctions() map[string]utils.FunctionAssessment
- func (c InfoSchemaCollector) ListIndexes() (map[string]utils.SrcIndexDetails, map[string]utils.SpIndexDetails)
- func (c InfoSchemaCollector) ListSpannerSequences() map[string]ddl.Sequence
- func (c InfoSchemaCollector) ListStoredProcedures() map[string]utils.StoredProcedureAssessment
- func (c InfoSchemaCollector) ListTables() (map[string]utils.SrcTableDetails, map[string]utils.SpTableDetails)
- func (c InfoSchemaCollector) ListTriggers() map[string]utils.TriggerAssessment
- func (c InfoSchemaCollector) ListViews() map[string]utils.ViewAssessment
- type LLMQuestionOutput
- type MigrationCodeSummarizer
- func (m *MigrationCodeSummarizer) AnalyzeFile(ctx context.Context, projectPath, filepath, methodChanges, content string, ...) *FileAnalysisResponse
- func (m *MigrationCodeSummarizer) AnalyzeFileTask(analyzeFileInput *FileAnalysisInput, mutex *sync.Mutex) task.TaskResult[*FileAnalysisResponse]
- func (m *MigrationCodeSummarizer) AnalyzeProject(ctx context.Context) (*utils.CodeAssessment, []utils.QueryTranslationResult, error)
- func (m *MigrationCodeSummarizer) InvokeCodeConversion(ctx context.Context, ...) (string, error)
- type PerformanceSchemaCollector
- type PerformanceSchemaProvider
- type SampleCollector
Constants ¶
This section is empty.
Variables ¶
var SupportedFrameworkCombinations = map[FrameworkPair]bool{ {Source: "jdbc", Target: "jdbc"}: true, {Source: "hibernate", Target: "hibernate"}: true, {Source: "go-sql-driver/mysql", Target: "go-sql-spanner"}: true, {Source: "vertx-mysql-client", Target: "vertx-jdbc-client"}: true, }
var SupportedProgrammingLanguages = map[string]bool{ "go": true, "java": true, }
Functions ¶
func GetDatabaseSourceFramework ¶
func GetDatabaseSourceFramework(projectRoot string, language string, projectDependencyAnalyzer dependencyAnalyzer.DependencyAnalyzer) string
Generic function to get the dominant database framework using a FrameworkDetector.
Types ¶
type AppCodeAssessor ¶
type AppCodeAssessor interface {
AnalyzeProject(ctx context.Context) (*utils.CodeAssessment, []utils.QueryTranslationResult, error)
}
AppCodeAssessor defines the interface for any component that can analyze application code.
type DefaultPerformanceSchemaProvider ¶
type DefaultPerformanceSchemaProvider struct{}
SQLDBConnector provides default SQL database connection functionality
type FileAnalysisInput ¶
type FileAnalysisInput struct {
Context context.Context
ProjectPath string
FilePath string
MethodChanges string
FileContent string
FileIndex int
}
FileAnalysisInput represents the input for analyzing a single file.
type FileAnalysisResponse ¶
type FileAnalysisResponse struct {
CodeAssessment *utils.CodeAssessment
MethodSignatures []any
AnalyzedProjectPath string
AnalyzedFilePath string
QueryResults []utils.QueryTranslationResult
}
FileAnalysisResponse represents the response after analyzing a single file.
type FileDependencyInfo ¶
FileDependencyInfo stores dependency analysis data for a single file.
type FrameworkPair ¶
type InfoSchemaCollector ¶
type InfoSchemaCollector struct {
// contains filtered or unexported fields
}
func BuildInfoSchemaCollector ¶
func BuildInfoSchemaCollector(tables map[string]utils.TableAssessmentInfo, indexes []utils.IndexAssessmentInfo, triggers []utils.TriggerAssessmentInfo, storedProcedures []utils.StoredProcedureAssessmentInfo, functions []utils.FunctionAssessmentInfo, views []utils.ViewAssessmentInfo, conv *internal.Conv) (InfoSchemaCollector, error)
func GetDefaultInfoSchemaCollector ¶
func GetDefaultInfoSchemaCollector(conv *internal.Conv, sourceProfile profiles.SourceProfile) (InfoSchemaCollector, error)
func GetInfoSchemaCollector ¶
func GetInfoSchemaCollector(conv *internal.Conv, sourceProfile profiles.SourceProfile, dbConnector collectorCommon.DBConnector, configProvider collectorCommon.ConnectionConfigProvider, infoSchemaProvider func(*sql.DB, profiles.SourceProfile) (common.InfoSchema, error)) (InfoSchemaCollector, error)
func (InfoSchemaCollector) IsEmpty ¶
func (c InfoSchemaCollector) IsEmpty() bool
func (InfoSchemaCollector) ListColumnDefinitions ¶
func (c InfoSchemaCollector) ListColumnDefinitions() (map[string]utils.SrcColumnDetails, map[string]utils.SpColumnDetails)
func (InfoSchemaCollector) ListFunctions ¶
func (c InfoSchemaCollector) ListFunctions() map[string]utils.FunctionAssessment
func (InfoSchemaCollector) ListIndexes ¶
func (c InfoSchemaCollector) ListIndexes() (map[string]utils.SrcIndexDetails, map[string]utils.SpIndexDetails)
func (InfoSchemaCollector) ListSpannerSequences ¶
func (c InfoSchemaCollector) ListSpannerSequences() map[string]ddl.Sequence
func (InfoSchemaCollector) ListStoredProcedures ¶
func (c InfoSchemaCollector) ListStoredProcedures() map[string]utils.StoredProcedureAssessment
func (InfoSchemaCollector) ListTables ¶
func (c InfoSchemaCollector) ListTables() (map[string]utils.SrcTableDetails, map[string]utils.SpTableDetails)
func (InfoSchemaCollector) ListTriggers ¶
func (c InfoSchemaCollector) ListTriggers() map[string]utils.TriggerAssessment
func (InfoSchemaCollector) ListViews ¶
func (c InfoSchemaCollector) ListViews() map[string]utils.ViewAssessment
type LLMQuestionOutput ¶
type LLMQuestionOutput struct {
Questions []string `json:"questions"`
}
LLMQuestionOutput represents the expected JSON output for asking clarifying questions.
type MigrationCodeSummarizer ¶
type MigrationCodeSummarizer struct {
// contains filtered or unexported fields
}
MigrationCodeSummarizer holds the LLM models and configurations for code migration assessment.
func NewMigrationCodeSummarizer ¶
func NewMigrationCodeSummarizer( ctx context.Context, googleGenerativeAIAPIKey *string, projectID, location, sourceSchema, targetSchema, projectPath, language, sourceFramework, targetFramework string, ) (*MigrationCodeSummarizer, error)
NewMigrationCodeSummarizer initializes a new MigrationCodeSummarizer. ToDo:Add Unit Tests
func (*MigrationCodeSummarizer) AnalyzeFile ¶
func (m *MigrationCodeSummarizer) AnalyzeFile(ctx context.Context, projectPath, filepath, methodChanges, content string, fileIndex int) *FileAnalysisResponse
AnalyzeFile analyzes a single file to identify potential migration issues.
func (*MigrationCodeSummarizer) AnalyzeFileTask ¶
func (m *MigrationCodeSummarizer) AnalyzeFileTask(analyzeFileInput *FileAnalysisInput, mutex *sync.Mutex) task.TaskResult[*FileAnalysisResponse]
AnalyzeFileTask wraps the AnalyzeFile function to be used with the task runner. ToDo:Add Unit Tests
func (*MigrationCodeSummarizer) AnalyzeProject ¶
func (m *MigrationCodeSummarizer) AnalyzeProject(ctx context.Context) (*utils.CodeAssessment, []utils.QueryTranslationResult, error)
AnalyzeProject orchestrates the analysis of the entire project. ToDo:Add Unit Tests
func (*MigrationCodeSummarizer) InvokeCodeConversion ¶
func (m *MigrationCodeSummarizer) InvokeCodeConversion( ctx context.Context, originalPrompt, sourceCode, olderSchema, newSchema, identifier string, ) (string, error)
InvokeCodeConversion performs code conversion using the LLM.
type PerformanceSchemaCollector ¶
type PerformanceSchemaCollector struct {
Queries []utils.QueryAssessmentInfo
}
PerformanceSchemaCollector collects performance schema data from source databases
func GetDefaultPerformanceSchemaCollector ¶
func GetDefaultPerformanceSchemaCollector(sourceProfile profiles.SourceProfile) (PerformanceSchemaCollector, error)
GetDefaultPerformanceSchemaCollector creates a new PerformanceSchemaCollector with default settings
func GetPerformanceSchemaCollector ¶
func GetPerformanceSchemaCollector(sourceProfile profiles.SourceProfile, dbConnector collectorCommon.DBConnector, configProvider collectorCommon.ConnectionConfigProvider, performanceSchemaProvider PerformanceSchemaProvider) (PerformanceSchemaCollector, error)
GetPerformanceSchemaCollector creates a new PerformanceSchemaCollector with custom dependencies
func (PerformanceSchemaCollector) IsEmpty ¶
func (c PerformanceSchemaCollector) IsEmpty() bool
IsEmpty checks if the collector has any data
type PerformanceSchemaProvider ¶
type PerformanceSchemaProvider interface {
// contains filtered or unexported methods
}
DBConnector interface for establishing database connections
type SampleCollector ¶
type SampleCollector struct {
// contains filtered or unexported fields
}
This is sample implementation to bootstrap. Once the collectors are implemented, this can be deleted
func CreateSampleCollector ¶
func CreateSampleCollector() (SampleCollector, error)
func (SampleCollector) ListTables ¶
func (c SampleCollector) ListTables() []string