Skip to main content

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

AttributeTypeDescription
HoststringThe host name of the database server.
ReadReplicaHoststringThe host name of the read replica database server.
PortintegerThe port name of the database server.
DbNamestringThe database name.
UserstringThe database user who is connecting to the server.
PasswordstringThe database password; either Password or PasswordPath must be set.
PasswordPathstringPoints to the file containing the database password; either Password or PasswordPath must be set.
ExtraOptionsstringSee http://gorm.io/docs/connecting_to_the_database.html for available options passed, in addition to the above.
DebugbooleanWhether 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

TypeDescription
boolReturns true if all fields in the PostgresConfig are empty or at their default values, false otherwise.