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.
func (DefaultHandler) SetIdentityHandler ¶ added in v0.5.4
func (DefaultHandler) SetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error
type Handler ¶ added in v0.4.0
type Handler interface { InitHandler(ctx context.Context, db *gorm.DB) error ResetHandler(ctx context.Context, db *gorm.DB) error SetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error }
var Default Handler = &DefaultHandler{}
type MockAdmin ¶ added in v0.5.0
func (*MockAdmin) InitHandler ¶ added in v0.5.0
func (*MockAdmin) ResetHandler ¶ added in v0.5.0
func (*MockAdmin) SetIdentityHandler ¶ added in v0.5.4
type SetIdentityRequest ¶ added in v0.5.4
type SetIdentityRequest struct {
Identity string `json:"identity"`
}
Click to show internal directories.
Click to hide internal directories.