Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultHandler ¶ added in v0.4.0
type DefaultHandler struct{}
func (DefaultHandler) InitHandler ¶ added in v0.4.0
InitHandler initializes the database by running migrations on the provided db instance. It ensures the database schema matches the expected schema defined in the model.
Parameters: - db: A pointer to the gorm.DB instance representing the database connection.
Returns: - An error, if any occurred during the operation.
func (DefaultHandler) ResetHandler ¶ added in v0.4.0
ResetHandler resets the database by dropping all existing tables and then recreating them using migrations defined in the model. It's generally used during testing or for complete system resets, and caution should be exercised before invoking it in a production environment.
Parameters: - db: A pointer to the gorm.DB instance representing the database connection.
Returns: - An error, if any occurred during the operation.