admin

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2023 License: Apache-2.0, MIT Imports: 5 Imported by: 0

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

func (DefaultHandler) InitHandler(ctx context.Context, db *gorm.DB) error

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

func (DefaultHandler) ResetHandler(ctx context.Context, db *gorm.DB) error

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.

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
}
var Default Handler = &DefaultHandler{}

type MockAdmin added in v0.5.0

type MockAdmin struct {
	mock.Mock
}

func (*MockAdmin) InitHandler added in v0.5.0

func (m *MockAdmin) InitHandler(ctx context.Context, db *gorm.DB) error

func (*MockAdmin) ResetHandler added in v0.5.0

func (m *MockAdmin) ResetHandler(ctx context.Context, db *gorm.DB) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL