 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type PostgresConfig
- type PostgresConnectionManager
- func (m *PostgresConnectionManager) Close() error
- func (m *PostgresConnectionManager) Connect(ctx context.Context) error
- func (m *PostgresConnectionManager) ExecuteInGORMTransaction(fn func(tx *gorm.DB) error) error
- func (m *PostgresConnectionManager) ExecuteInTransaction(ctx context.Context, fn func(tx *sql.Tx) error) error
- func (m *PostgresConnectionManager) GetDSN() string
- func (m *PostgresConnectionManager) GetGORM() *gorm.DB
- func (m *PostgresConnectionManager) GetSQL() *sql.DB
- func (m *PostgresConnectionManager) GetSQLX() *sqlx.DB
- func (m *PostgresConnectionManager) GetStats() map[string]interface{}
- func (m *PostgresConnectionManager) Ping(ctx context.Context) error
- func (m *PostgresConnectionManager) RunMigrations(models ...interface{}) error
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresConfig ¶
type PostgresConfig struct {
	Host     string
	Port     int
	Database string
	Username string
	Password string
	SSLMode  string
	TimeZone string
	// Connection Pool Settings
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
	ConnMaxIdleTime time.Duration
	// Timeouts
	ConnectTimeout   time.Duration
	StatementTimeout time.Duration
	// Logging
	LogLevel      logger.LogLevel
	SlowThreshold time.Duration
	// Advanced Settings
	ApplicationName string
	SearchPath      string
	PgBouncerMode   bool
}
    PostgresConfig configuración para conexión PostgreSQL
func DefaultPostgresConfig ¶
func DefaultPostgresConfig() *PostgresConfig
DefaultPostgresConfig retorna configuración por defecto
func NewPostgresConfigFromEnv ¶
func NewPostgresConfigFromEnv() *PostgresConfig
NewPostgresConfigFromEnv crea configuración desde variables de entorno
func (*PostgresConfig) Clone ¶
func (c *PostgresConfig) Clone() *PostgresConfig
Clone crea una copia de la configuración
func (*PostgresConfig) Validate ¶
func (c *PostgresConfig) Validate() error
ValidateConfig valida la configuración
type PostgresConnectionManager ¶
type PostgresConnectionManager struct {
	// contains filtered or unexported fields
}
    PostgresConnectionManager maneja conexiones PostgreSQL
func NewPostgresConnectionManager ¶
func NewPostgresConnectionManager(config *PostgresConfig, logger *logrus.Logger) *PostgresConnectionManager
NewPostgresConnectionManager crea un nuevo manager de conexiones
func (*PostgresConnectionManager) Close ¶
func (m *PostgresConnectionManager) Close() error
Close cierra todas las conexiones
func (*PostgresConnectionManager) Connect ¶
func (m *PostgresConnectionManager) Connect(ctx context.Context) error
Connect establece todas las conexiones de base de datos
func (*PostgresConnectionManager) ExecuteInGORMTransaction ¶
func (m *PostgresConnectionManager) ExecuteInGORMTransaction(fn func(tx *gorm.DB) error) error
ExecuteInGORMTransaction ejecuta una función dentro de una transacción GORM
func (*PostgresConnectionManager) ExecuteInTransaction ¶
func (m *PostgresConnectionManager) ExecuteInTransaction(ctx context.Context, fn func(tx *sql.Tx) error) error
ExecuteInTransaction ejecuta una función dentro de una transacción
func (*PostgresConnectionManager) GetDSN ¶
func (m *PostgresConnectionManager) GetDSN() string
GetDSN retorna el DSN de conexión
func (*PostgresConnectionManager) GetGORM ¶
func (m *PostgresConnectionManager) GetGORM() *gorm.DB
GetGORM retorna la conexión GORM
func (*PostgresConnectionManager) GetSQL ¶
func (m *PostgresConnectionManager) GetSQL() *sql.DB
GetSQL retorna la conexión database/sql
func (*PostgresConnectionManager) GetSQLX ¶
func (m *PostgresConnectionManager) GetSQLX() *sqlx.DB
GetSQLX retorna la conexión SQLX
func (*PostgresConnectionManager) GetStats ¶
func (m *PostgresConnectionManager) GetStats() map[string]interface{}
GetStats retorna estadísticas de las conexiones
func (*PostgresConnectionManager) Ping ¶
func (m *PostgresConnectionManager) Ping(ctx context.Context) error
Ping verifica la conectividad de todas las conexiones
func (*PostgresConnectionManager) RunMigrations ¶
func (m *PostgresConnectionManager) RunMigrations(models ...interface{}) error
RunMigrations ejecuta migraciones usando GORM