database

package
v0.0.0-...-ede8d43 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DbLoad

func DbLoad()

Types

type Database

type Database struct {
	GormStore  *GormStore
	RedisStore *RedisStore
}
var DB Database

type GormStore

type GormStore struct {
	*gorm.DB
}

func (*GormStore) CheckIfPermissionExistsByCodeOrName

func (gs *GormStore) CheckIfPermissionExistsByCodeOrName(code, name string) error

func (*GormStore) CheckIfRoleExistsByIds

func (gs *GormStore) CheckIfRoleExistsByIds(id []uint) error

func (*GormStore) CheckIfRoleExistsByName

func (gs *GormStore) CheckIfRoleExistsByName(name string) error

func (*GormStore) CheckIfUserExistsByUsernameOrEmail

func (gs *GormStore) CheckIfUserExistsByUsernameOrEmail(email, username string) error

func (*GormStore) CreateAdmin

func (gs *GormStore) CreateAdmin() error

func (*GormStore) GetPermissionByIds

func (gs *GormStore) GetPermissionByIds(ids []uint) ([]models.Permission, error)

func (*GormStore) GetRoleByIds

func (gs *GormStore) GetRoleByIds(ids []uint) ([]models.Role, error)

func (*GormStore) GetUserByID

func (gs *GormStore) GetUserByID(id uint) (*models.User, error)

func (*GormStore) GetUserByUsernameOrEmail

func (gs *GormStore) GetUserByUsernameOrEmail(text string) (*models.User, error)

func (*GormStore) Health

func (gs *GormStore) Health() map[string]string

type RedisStore

type RedisStore struct {
	Client *redis.Client
}

func (*RedisStore) GetKey

func (rs *RedisStore) GetKey(key string) (string, error)

func (*RedisStore) Health

func (rs *RedisStore) Health() map[string]string

func (*RedisStore) SetKey

func (rs *RedisStore) SetKey(key string, value string, expiration time.Duration) error

Jump to

Keyboard shortcuts

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