database

package
v0.0.0-...-ada6369 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostgresDB *pgxpool.Pool
View Source
var RedisClient *redis.Client

Functions

func ClosePostgres

func ClosePostgres(logger *logrus.Logger)

ClosePostgres closes the PostgreSQL database connection pool. It checks if the PostgresDB instance is not nil before attempting to close the connection.

Parameters:

  • logger (*logrus.Logger): Logrus logger instance for logging.

Returns:

  • None

func CloseRedis

func CloseRedis(logger *logrus.Logger)

CloseRedis closes the connection to Redis if it is not nil. It also logs any errors that occur while closing the connection.

Parameters:

  • logger (*logrus.Logger): The logger instance to log any errors that occur while closing the connection.

Returns:

  • None

func InitPostgres

func InitPostgres(logger *logrus.Logger)

InitPostgres initializes the PostgreSQL database connection pool. It reads database connection parameters from environment variables or uses default values.

Parameters:

  • logger (*logrus.Logger): Logrus logger instance for logging.

Returns:

  • None

func InitRedis

func InitRedis(logger *logrus.Logger)

InitRedis initializes a connection to Redis and stores the client in the RedisClient variable. It also checks if the connection was successful and logs the result.

Parameters:

  • logger (*logrus.Logger): The logger instance to log the result of the connection.

Returns:

  • None

Types

This section is empty.

Jump to

Keyboard shortcuts

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