group

package
v0.0.0-...-e3494e8 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPostDB            = "group.gorm.db"
	KeyPostNoCheckRouter = "group.router.nocheck"
	KeyPostCheckRouter   = "group.router.check"
)
View Source
const (
	SqlQueryGroupByID = `SELECT * 
						 FROM groups 
						 WHERE id = ? AND deleted_at IS NULL`
	SqlQueryGroupByName = `SELECT * 
						   FROM groups 
						   WHERE name = ? AND deleted_at IS NULL`
	SqlQueryGroupByUserID = `` /* 207-byte string literal not displayed */

	SqlQueryGroupByPage = `SELECT * 
						   FROM groups 
						   WHERE deleted_at IS NULL 
						   ORDER BY id DESC 
						   LIMIT ? OFFSET ?`
	SqlUpdateGroupNameByID = `UPDATE groups 
							  SET name = ? 
							  WHERE id = ?`
	SqlUpdateGroupLogoByID = `UPDATE groups 
							  SET logo = ? 
							  WHERE id = ?`
	SqlUpdateGroupNoticeByID = `UPDATE groups 
								SET notice = ? 
								WHERE id = ?`
	SqlUpdateGroupAddrByID = `UPDATE groups 
							  SET addr = ? 
							  WHERE id = ?`
	SqlDeleteGroupnByID = `DELETE 
						   FROM group 
						   WHERE id = ?`
)

group

View Source
const (
	SqlQueryGroupApplicationsByGroupID = `SELECT * 
										  FROM group_application 
										  WHERE group_id = ? AND deleted_at IS NULL`
	SqlQueryGroupApplicationsByUserID = `SELECT * 
										FROM group_application 
										WHERE user_id = ? AND deleted_at IS NULL`
	SqlQueryGroupApplicationByGroupIDAndUserID = `SELECT * 
												  FROM group_application 
												  WHERE group_id = ? AND user_id = ? AND deleted_at IS NULL`
	SqlDeleteGroupApplicationByGroupIDAndUserID = `DELETE 
												   FROM group_application 
												   WHERE group_id = ? AND user_id = ?`
	SqlDeleteGroupApplicationByGroupID = `DELETE 
										  FROM group_application 
										  WHERE group_id = ?`
)

group application

View Source
const (
	SqlQueryGroupMemberByGroupID = `SELECT * 
									FROM group_members 
									WHERE group_id = ? AND deleted_at IS NULL`
	SqlQueryGroupMemberByGroupIDAndPosition = `SELECT * 
											   FROM group_members 
											   WHERE group_id = ? AND position > ? AND deleted_at IS NULL`
	SqlQueryGroupMemberByGroupIDAndUserID = `SELECT * 
											 FROM group_members 
											 WHERE group_id = ? AND user_id = ? AND deleted_at IS NULL`
	SqlUpdateGroupMemberPositionByGroupIDAndUserID = `` /* 127-byte string literal not displayed */

	SqlDeleteGroupMemberByGroupID = `DELETE 
									 FROM group_members 
									 WHERE group_id = ?`
	SqlDeleteGroupMemberByGroupIDAndUserID = `DELETE 
											  FROM group_members 
											  WHERE group_id = ? AND user_id = ?`
)

group member

Variables

View Source
var Dao = new(GroupDao)

Functions

func BindCreate

func BindCreate(c *fiber.Ctx) (*model.Group, error)

func GetGroupsByUserID

func GetGroupsByUserID(c *fiber.Ctx) error

GetGroupsByUserID 获取当前登录用户的群组列表

Types

type GroupDao

type GroupDao struct{}

func (GroupDao) Apply

func (gd GroupDao) Apply(gid, uid uint) error

Apply apply for the group

func (GroupDao) Approve

func (gd GroupDao) Approve(gid, uid, mid uint) error

Approve approve the application

func (GroupDao) Cancel

func (gd GroupDao) Cancel(gid, uid uint) error

Cancel cancel the application of the group

func (GroupDao) Create

func (gd GroupDao) Create(group *model.Group) error

Create create a new group

func (GroupDao) Exists

func (gd GroupDao) Exists(gid uint) error

Exists group exists or not

func (GroupDao) ExistsName

func (gd GroupDao) ExistsName(name string) error

ExistsName group name exists or not

func (GroupDao) Fire

func (gd GroupDao) Fire(gid, uid, mid uint) error

Fire kick the member out of the group

func (GroupDao) GetApplictionsByGroupID

func (gd GroupDao) GetApplictionsByGroupID(gid uint) ([]model.GroupApplication, error)

GetApplictionsByGroupID return the applications of the group

func (GroupDao) GetByID

func (gd GroupDao) GetByID(gid uint) (*model.Group, error)

GetByID get the group by the group id

func (GroupDao) GetByPage

func (gd GroupDao) GetByPage(page int, pageSize int) ([]*model.Group, error)

GetByPage get the groups by page

func (GroupDao) GetByUserID

func (gd GroupDao) GetByUserID(uid uint) ([]*model.Group, error)

GetByUserID get the groups by user id

func (GroupDao) Promote

func (gd GroupDao) Promote(gid, uid, mid uint) error

Promote promote the member to the manager

func (GroupDao) Quit

func (gd GroupDao) Quit(gid, mid uint) error

Quit quit the group

func (GroupDao) Refuse

func (gd GroupDao) Refuse(gid, uid, mid uint) error

Refuse refuse the application of the user

func (GroupDao) Remove

func (gd GroupDao) Remove(gid, uid uint) error

Remove remove the group

func (GroupDao) Transfer

func (gd GroupDao) Transfer(gid, uid, mid uint) error

Transfer transfer the owner to the other member

func (GroupDao) UpdateAddress

func (gd GroupDao) UpdateAddress(gid, uid uint, addr string) error

UpdateAddress update the address of the group

func (gd GroupDao) UpdateLogo(gid, uid uint, logo string) error

UpdateLogo update the logo of the group

func (GroupDao) UpdateName

func (gd GroupDao) UpdateName(gid, uid uint, name string) error

UpdateName update the name of the group

func (GroupDao) UpdateNotice

func (gd GroupDao) UpdateNotice(gid, uid uint, notice string) error

UpdateNotice update the logo of the group

type RequestUpdate

type RequestUpdate struct {
	ID      uint   `json:"id" form:"id"`
	Uid     uint   `json:"uid" form:"uid"`
	Mid     uint   `json:"mid" form:"mid"`
	Name    string `json:"name" form:"name"`
	Notice  string `json:"notice" form:"notice"`
	Address string `json:"address" form:"address"`
}

func Bind

func Bind(c *fiber.Ctx) (*RequestUpdate, error)

type Result

type Result struct {
	Group       model.Group
	Member      model.GroupMember
	Application model.GroupApplication
	Error       error
}

Jump to

Keyboard shortcuts

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