Documentation ¶
Overview ¶
Package storage creates a database connection and runs the migrations located in the `db/migrations` directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToDatabase ¶
func ConnectToDatabase(ctx context.Context, config *DatabaseConfig) *pgxpool.Pool
ConnectToDatabase returns a connection pool, which can be used to execute queries to the database.
func DuplicateConstraintViolation ¶
DuplicateConstraintViolation returns true if the errors represents a duplicate constraint violation (SQLSTATE 23505) occurred in the database.
func RunMigrations ¶
func RunMigrations(config *DatabaseConfig, migrationsRepo string)
RunMigrations either from source code on a local machine if available (for developers) or from a GitHub repository (for production).
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
// contains filtered or unexported fields
}
func NewDatabaseConfig ¶
func NewDatabaseConfig(host, port, username, password, dbName string) *DatabaseConfig
Click to show internal directories.
Click to hide internal directories.