 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type GormLogger
- func (gl *GormLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (gl *GormLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (gl *GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
- func (gl *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (gl *GormLogger) Warn(ctx context.Context, msg string, data ...interface{})
 
- type PostgresClient
- func (pc *PostgresClient) Close() error
- func (pc *PostgresClient) GetDB() *gorm.DB
- func (pc *PostgresClient) GetSQLDB() *sql.DB
- func (pc *PostgresClient) HealthCheck() observability.HealthCheck
- func (pc *PostgresClient) Stats() sql.DBStats
- func (pc *PostgresClient) Transaction(ctx context.Context, fn func(*gorm.DB) error) error
- func (pc *PostgresClient) WithContext(ctx context.Context) *gorm.DB
 
- type PostgresOptions
- type Repository
- func (r *Repository) Create(ctx context.Context, model interface{}) error
- func (r *Repository) Delete(ctx context.Context, model interface{}, id interface{}) error
- func (r *Repository) GetByID(ctx context.Context, model interface{}, id interface{}) error
- func (r *Repository) Update(ctx context.Context, model interface{}) error
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormLogger ¶
type GormLogger struct {
	// contains filtered or unexported fields
}
    Custom GORM logger that integrates with our logger
func NewGormLogger ¶
func NewGormLogger(logger logger.Logger) *GormLogger
NewGormLogger creates a new GORM logger
func (*GormLogger) Error ¶
func (gl *GormLogger) Error(ctx context.Context, msg string, data ...interface{})
Error logs error messages
func (*GormLogger) Info ¶
func (gl *GormLogger) Info(ctx context.Context, msg string, data ...interface{})
Info logs info messages
func (*GormLogger) LogMode ¶
func (gl *GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
LogMode sets the log level
type PostgresClient ¶
type PostgresClient struct {
	// contains filtered or unexported fields
}
    PostgresClient provides PostgreSQL database operations
func NewPostgresClient ¶
func NewPostgresClient(opts PostgresOptions) (*PostgresClient, error)
NewPostgresClient creates a new PostgreSQL client
func (*PostgresClient) Close ¶
func (pc *PostgresClient) Close() error
Close closes the database connection
func (*PostgresClient) GetDB ¶
func (pc *PostgresClient) GetDB() *gorm.DB
GetDB returns the GORM database instance
func (*PostgresClient) GetSQLDB ¶
func (pc *PostgresClient) GetSQLDB() *sql.DB
GetSQLDB returns the underlying sql.DB instance
func (*PostgresClient) HealthCheck ¶
func (pc *PostgresClient) HealthCheck() observability.HealthCheck
HealthCheck returns a health check for the database
func (*PostgresClient) Stats ¶
func (pc *PostgresClient) Stats() sql.DBStats
Stats returns database connection statistics
func (*PostgresClient) Transaction ¶
Transaction executes a function within a database transaction
func (*PostgresClient) WithContext ¶
func (pc *PostgresClient) WithContext(ctx context.Context) *gorm.DB
WithContext returns a new GORM DB instance with context
type PostgresOptions ¶
type PostgresOptions struct {
	Config config.DatabaseConfig
	Logger logger.Logger
	Models []interface{} // Models to auto-migrate
}
    PostgresOptions holds options for PostgreSQL client
type Repository ¶
type Repository struct {
	// contains filtered or unexported fields
}
    Repository provides common repository patterns
func NewRepository ¶
func NewRepository(db *gorm.DB, logger logger.Logger) *Repository
NewRepository creates a new repository instance
func (*Repository) Create ¶
func (r *Repository) Create(ctx context.Context, model interface{}) error
Create creates a new record
func (*Repository) Delete ¶
func (r *Repository) Delete(ctx context.Context, model interface{}, id interface{}) error
Delete deletes a record