{"modulePath":"github.com/data-preservation-programs/singularity","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package admin\n\n## Types\n\n```go\ntype DefaultHandler struct{}\n```\n\n```go\nfunc (DefaultHandler) InitHandler(ctx context.Context, db *gorm.DB) error\n```\nInitHandler initializes the database by running migrations on the provided db instance. It ensures the database schema matches the expected schema defined in the model.\n\nParameters:\n\n  - db: A pointer to the gorm.DB instance representing the database connection.\n\nReturns:\n\n  - An error, if any occurred during the operation.\n\n```go\nfunc (DefaultHandler) ResetHandler(ctx context.Context, db *gorm.DB) error\n```\nResetHandler resets the database by dropping all existing tables and then recreating them using migrations defined in the model.\n\nIt's generally used during testing or for complete system resets, and caution should be exercised before invoking it in a production environment.\n\nParameters:\n\n  - db: A pointer to the gorm.DB instance representing the database connection.\n\nReturns:\n\n  - An error, if any occurred during the operation.\n\n```go\nfunc (DefaultHandler) SetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error\n```\n\n```go\ntype Handler interface {\n\tInitHandler(ctx context.Context, db *gorm.DB) error\n\tResetHandler(ctx context.Context, db *gorm.DB) error\n\tSetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error\n}\n```\n\n```go\nvar Default Handler = \u0026DefaultHandler{}\n```\n\n```go\ntype MockAdmin struct {\n\tmock.Mock\n}\n```\n\n```go\nfunc (m *MockAdmin) InitHandler(ctx context.Context, db *gorm.DB) error\n```\n\n```go\nfunc (m *MockAdmin) ResetHandler(ctx context.Context, db *gorm.DB) error\n```\n\n```go\nfunc (m *MockAdmin) SetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error\n```\n\n```go\ntype SetIdentityRequest struct {\n\tIdentity string `json:\"identity\"`\n}\n```\n\n","path":"github.com/data-preservation-programs/singularity/handler/admin","name":"admin","synopsis":"","isRedistributable":true}
