assessment

package
v1.0.1-0...-23bcde9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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,
}
View Source
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

type FileDependencyInfo struct {
	PublicMethodSignatures []any
	IsDAODependent         bool
}

FileDependencyInfo stores dependency analysis data for a single file.

type FrameworkPair

type FrameworkPair struct {
	Source string
	Target string
}

type InfoSchemaCollector

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

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 (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 (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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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