dal

package
v0.0.0-...-0259ebf Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const UnlockScript = `
	if redis.call("get", KEYS[1]) == ARGV[1] then
		return redis.call("del", KEYS[1])
	else
		return 0
	end
`

Variables

View Source
var (
	DB *gorm.DB

	RDB *redis.Client
)

Functions

func GetDB

func GetDB() (*gorm.DB, *redis.Client)

func Lock

func Lock(ctx context.Context, rdb *redis.Client, key string, value string, t time.Duration) (bool, error)

func UnLock

func UnLock(ctx context.Context, rdb *redis.Client, key string, value string) error

Types

type Dal

type Dal interface {
	GetAllUsers(ctx context.Context, pager *model.Pager) ([]*model.User, error)
	CeateUser(ctx context.Context, user *model.User) (*model.User, error)
	GetUser(ctx context.Context, id int) (*model.User, error)
	GetUserByName(ctx context.Context, username string) (*model.User, error)
	GetUserWithPasswordByName(ctx context.Context, username string) (*model.User, error)
	UpdateUser(ctx context.Context, user *model.User) (*model.User, error)
	DeleteUser(ctx context.Context, userID int) error

	GetAllRooms(ctx context.Context, pager *model.Pager) ([]*model.Room, error)
	CreateRoom(ctx context.Context, room *model.Room) (*model.Room, error)
	GetRoom(ctx context.Context, id int) (*model.Room, error)
	UpdateRoom(ctx context.Context, room *model.Room) (*model.Room, error)
	DeleteRoom(ctx context.Context, roomID int) error

	GetAllSeats(ctx context.Context, roomID int, pager *model.Pager) ([]*model.Seat, error)
	CreateSeat(ctx context.Context, seat *model.Seat) (*model.Seat, error)
	GetSeat(ctx context.Context, id int) (*model.Seat, error)
	UpdateSeat(ctx context.Context, seat *model.Seat) (*model.Seat, error)
	DeleteSeat(ctx context.Context, seatID int) error

	CreateResv(ctx context.Context, resv *model.Resv) (*model.Resv, error)
	GetResv(ctx context.Context, resvID int) (*model.Resv, error)
	UpdateResvStatus(ctx context.Context, resv *model.Resv) (*model.Resv, error)
	GetResvsByUser(ctx context.Context, userID int, pager *model.Pager) ([]*model.Resv, error)
	GetResvsBySeat(ctx context.Context, seatID int, pager *model.Pager) ([]*model.Resv, error)

	GetAllAdmins(ctx context.Context, pager *model.Pager) ([]*model.Admin, error)
	CeateAdmin(ctx context.Context, admin *model.Admin) (*model.Admin, error)
	GetAdmin(ctx context.Context, id int) (*model.Admin, error)
	GetAdminByName(ctx context.Context, name string) (*model.Admin, error)
	GetAdminWithPasswordByName(ctx context.Context, name string) (*model.Admin, error)
	DeleteAdmin(ctx context.Context, adminID int) error
}

func GetDal

func GetDal(db *gorm.DB, rdb *redis.Client) Dal

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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