Documentation
¶
Index ¶
- type DatabaseUseCase
- func (uc *DatabaseUseCase) ExecuteQuery(ctx context.Context, dbID, query string, params []interface{}) (string, error)
- func (uc *DatabaseUseCase) ExecuteStatement(ctx context.Context, dbID, statement string, params []interface{}) (string, error)
- func (uc *DatabaseUseCase) ExecuteTransaction(ctx context.Context, dbID, action string, txID string, statement string, ...) (string, map[string]interface{}, error)
- func (uc *DatabaseUseCase) GetDatabaseInfo(dbID string) (map[string]interface{}, error)
- func (uc *DatabaseUseCase) GetDatabaseType(dbID string) (string, error)
- func (uc *DatabaseUseCase) ListDatabases() []string
- type GenericQueryFactory
- type MySQLQueryFactory
- type PostgresQueryFactory
- type QueryFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseUseCase ¶
type DatabaseUseCase struct {
// contains filtered or unexported fields
}
DatabaseUseCase defines operations for managing database functionality
func NewDatabaseUseCase ¶
func NewDatabaseUseCase(repo domain.DatabaseRepository) *DatabaseUseCase
NewDatabaseUseCase creates a new database use case
func (*DatabaseUseCase) ExecuteQuery ¶
func (uc *DatabaseUseCase) ExecuteQuery(ctx context.Context, dbID, query string, params []interface{}) (string, error)
ExecuteQuery executes a SQL query and returns the formatted results
func (*DatabaseUseCase) ExecuteStatement ¶
func (uc *DatabaseUseCase) ExecuteStatement(ctx context.Context, dbID, statement string, params []interface{}) (string, error)
ExecuteStatement executes a SQL statement (INSERT, UPDATE, DELETE)
func (*DatabaseUseCase) ExecuteTransaction ¶
func (uc *DatabaseUseCase) ExecuteTransaction(ctx context.Context, dbID, action string, txID string, statement string, params []interface{}, readOnly bool) (string, map[string]interface{}, error)
ExecuteTransaction executes operations in a transaction
func (*DatabaseUseCase) GetDatabaseInfo ¶ added in v1.5.0
func (uc *DatabaseUseCase) GetDatabaseInfo(dbID string) (map[string]interface{}, error)
GetDatabaseInfo returns information about a database
func (*DatabaseUseCase) GetDatabaseType ¶ added in v1.6.0
func (uc *DatabaseUseCase) GetDatabaseType(dbID string) (string, error)
GetDatabaseType returns the type of a database by ID
func (*DatabaseUseCase) ListDatabases ¶
func (uc *DatabaseUseCase) ListDatabases() []string
ListDatabases returns a list of available databases
type GenericQueryFactory ¶ added in v1.6.4
type GenericQueryFactory struct{}
GenericQueryFactory creates generic queries for unknown database types
func (*GenericQueryFactory) GetTablesQueries ¶ added in v1.6.4
func (f *GenericQueryFactory) GetTablesQueries() []string
type MySQLQueryFactory ¶ added in v1.6.4
type MySQLQueryFactory struct{}
MySQLQueryFactory creates queries for MySQL
func (*MySQLQueryFactory) GetTablesQueries ¶ added in v1.6.4
func (f *MySQLQueryFactory) GetTablesQueries() []string
type PostgresQueryFactory ¶ added in v1.6.4
type PostgresQueryFactory struct{}
PostgresQueryFactory creates queries for PostgreSQL
func (*PostgresQueryFactory) GetTablesQueries ¶ added in v1.6.4
func (f *PostgresQueryFactory) GetTablesQueries() []string
type QueryFactory ¶ added in v1.6.4
type QueryFactory interface {
GetTablesQueries() []string
}
QueryFactory provides database-specific queries
func NewQueryFactory ¶ added in v1.6.4
func NewQueryFactory(dbType string) QueryFactory
NewQueryFactory creates the appropriate query factory for the database type