interfaces

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkRepo

type BulkRepo interface {
	BulkInsert(tableName string, records []map[string]interface{}) ([]map[string]interface{}, error)
	BulkUpdate(tableName string, updates []map[string]interface{}, whereColumn string) (int64, error)
	BulkDelete(tableName string, ids []interface{}, idColumn string) (int64, error)
	Upsert(tableName string, data map[string]interface{}, conflictColumns, updateColumns []string) (map[string]interface{}, error)
}

Bulk operations interface

type CoreRepo

type CoreRepo interface {
	Ping() (bool, error)
	ListCollections(schema string) ([]models.Table, error)
	ExecuteQuery(name string, params models.QueryParams) (any, error)
	ExecuteFunction(ctx context.Context, name string, args map[string]interface{}) (any, error)
	ExecuteRawSQL(ctx context.Context, sql string) error
}

Core database operations interface

type DB

type DB interface {
	Exec(query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
	Close() error
	Ping() error
	Begin() (*sql.Tx, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	Driver() driver.Driver
}

DB interface considering only *sql.DB methods

type DBStats

type DBStats struct {
	OpenConnections int
	InUse           int
	Idle            int
}

DBStats represents database statistics (define fields as needed)

type DDLRepo

type DDLRepo interface {
	CreateCollection(req models.CreateTableRequest) error
	AddField(collection string, req models.AddColumnRequest) error
	AlterCollection(collection string, req models.AlterTableRequest) error
	CheckTableExists(tableName string) (bool, error)
}

DDL operations interface

type DMLRepo

type DMLRepo interface {
	Insert(collection string, data map[string]any) (any, error)
	Update(collection string, id any, data map[string]any) (any, error)
	Delete(collection string, id any) error
}

DML operations interface

type DatabaseRepo

DatabaseRepo is a composite interface that includes all repository operations Implementations should satisfy this interface to provide complete database functionality

type MigrationRepo

type MigrationRepo interface {
	GetMigrationHistory() ([]map[string]interface{}, error)
	RecordMigration(name, sql, checksum string) error
}

Migration operations interface

type PerformanceRepo

type PerformanceRepo interface {
	CreateIndex(tableName, indexName, columns string) error
	GetPerformanceMetrics() (map[string]interface{}, error)
	AnalyzeQuery(query string) ([]string, error)
}

Performance operations interface

type RelationshipRepo

type RelationshipRepo interface {
	CreateForeignKeyConstraint(relationship *models.RelationshipDefinition) error
	DropRelationshipConstraints(relationship *models.RelationshipDefinition) error
	CreateJoinTable(relationship *models.RelationshipDefinition, joinTable models.CreateJoinTableRequest) error
	DropJoinTable(tableName string) error
	SetOneToOneRelation(relationship *models.RelationshipDefinition, sourceID interface{}, targetID interface{}) error
	SetOneToManyRelation(relationship *models.RelationshipDefinition, sourceID interface{}, targetIDs []interface{}) error
	SetOneToManyRelations(relationship *models.RelationshipDefinition, sourceID interface{}, targetIDs []interface{}) error
	SetManyToManyRelations(relationship *models.RelationshipDefinition, sourceID interface{}, targetIDs []interface{}, data map[string]interface{}) ([]map[string]interface{}, error)
	RemoveOneToManyRelations(relationship *models.RelationshipDefinition, sourceID interface{}, targetIDs []interface{}) (int, error)
	RemoveManyToManyRelations(relationship *models.RelationshipDefinition, sourceID interface{}, targetIDs []interface{}) (int, error)
	GetRelationshipData(ctx context.Context, relationship *models.RelationshipDefinition, sourceID string, params models.QueryParams) ([]map[string]interface{}, error)
}

Relationship operations interface

Jump to

Keyboard shortcuts

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