admin

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0, MIT Imports: 6 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.

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

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

func (*MockAdmin) SetIdentityHandler added in v0.5.4

func (m *MockAdmin) SetIdentityHandler(ctx context.Context, db *gorm.DB, request SetIdentityRequest) error

type SetIdentityRequest added in v0.5.4

type SetIdentityRequest struct {
	Identity string `json:"identity"`
}

Jump to

Keyboard shortcuts

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