PostgresConfig
This class includes specific config options for opening a connection to a Postgres database. It defines parameters such as host, port, database name, user, and password (or password path) required for establishing a database connection. Additionally, it supports extra options and a debug mode setting.
Attributes
| Attribute | Type | Description |
|---|---|---|
| Host | string | The host name of the database server. |
| ReadReplicaHost | string | The host name of the read replica database server. |
| Port | integer | The port name of the database server. |
| DbName | string | The database name. |
| User | string | The database user who is connecting to the server. |
| Password | string | The database password; either Password or PasswordPath must be set. |
| PasswordPath | string | Points to the file containing the database password; either Password or PasswordPath must be set. |
| ExtraOptions | string | See http://gorm.io/docs/connecting_to_the_database.html for available options passed, in addition to the above. |
| Debug | boolean | Whether or not to start the database connection with debug mode enabled. |
Methods
IsEmpty()
@classmethod
def IsEmpty() - > bool
Checks if the PostgresConfig object is empty. This method determines if all configuration fields are at their default or zero values, indicating an uninitialized or empty configuration.
Returns
| Type | Description |
|---|---|
bool | Returns true if all fields in the PostgresConfig are empty or at their default values, false otherwise. |