module

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 9 Imported by: 0

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