module

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Connection *gorm.DB
}

Database struct

func (*Database) AutoConnect

func (db *Database) AutoConnect() error

AutoConnect connects to a MySQL database using loaded configs

func (*Database) Close

func (db *Database) Close() error

Close closes MySQL database connection

func (*Database) Connect

func (db *Database) Connect(dsn model.DSN) error

Connect connects to a MySQL database

func (*Database) CreateRole

func (db *Database) CreateRole(role *model.Role) *model.Role

CreateRole creates a new entity

func (*Database) DeleteRoleByID

func (db *Database) DeleteRoleByID(id int)

DeleteRoleByID deletes an entity by ID

func (*Database) GetRoleByID

func (db *Database) GetRoleByID(id int) model.Role

GetRoleByID gets an entity by ID

func (*Database) GetRoles

func (db *Database) GetRoles() []model.Role

GetRoles gets auth methods

func (*Database) HasTable

func (db *Database) HasTable(table string) bool

HasTable checks if table exists

func (*Database) Migrate

func (db *Database) Migrate() bool

Migrate migrates the database

func (*Database) Ping

func (db *Database) Ping() error

Ping check the db connection

func (*Database) Rollback

func (db *Database) Rollback() bool

Rollback drop tables

func (*Database) UpdateRoleByID

func (db *Database) UpdateRoleByID(role *model.Role) *model.Role

UpdateRoleByID updates an entity by ID

Jump to

Keyboard shortcuts

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