Documentation ¶
Index ¶
- Constants
- Variables
- func BindCreate(c *fiber.Ctx) (*model.Activity, error)
- func BindCreateActivityUser(c *fiber.Ctx) (*model.ActivityUser, error)
- func BindUpdate(c *fiber.Ctx, activity *model.Activity) error
- func UpdateAddr(c *fiber.Ctx) error
- func UpdateContent(c *fiber.Ctx) error
- func UpdateFee(c *fiber.Ctx) error
- func UpdateQuota(c *fiber.Ctx) error
- func UpdateTime(c *fiber.Ctx) error
- func UpdateTitle(c *fiber.Ctx) error
- type ActivityDao
- func (as ActivityDao) Create(activity *model.Activity) error
- func (as ActivityDao) CreateActivityUser(activityUser *model.ActivityUser) error
- func (as ActivityDao) Delete(aid uint) error
- func (as ActivityDao) GetByGroupID(gid uint) ([]*model.Activity, error)
- func (as ActivityDao) GetByID(aid uint) (*model.Activity, error)
- func (as ActivityDao) GetByOrganizerUserID(uid uint) ([]*model.Activity, error)
- func (as ActivityDao) GetByPage(page int, pageSize int) ([]*model.Activity, error)
- func (as ActivityDao) GetByUserID(uid uint) ([]*model.Activity, error)
- func (as ActivityDao) Update(activity *model.Activity) error
- type RequestCreate
- type RequestCreateActivityUser
Constants ¶
View Source
const ( KeyPostDB = "activity.gorm.db" KeyPostNoCheckRouter = "activity.router.nocheck" KeyPostCheckRouter = "activity.router.check" )
View Source
const ( SqlQueryActivityByID = `SELECT * FROM activities WHERE id = ? AND deleted_at IS NULL` SqlQueryActivitiesByOrganizerUserID = `SELECT * FROM activities WHERE user_id = ? AND deleted_at IS NULL ORDER BY id DESC` SqlQueryActivitiesByUserID = `` /* 224-byte string literal not displayed */ SqlQueryActivitiesByUserID2 = `` /* 227-byte string literal not displayed */ SqlQueryActivitiesByGroupID = `SELECT * FROM activities WHERE group_id = ? AND deleted_at IS NULL ORDER BY id DESC` SqlQueryActivitiesByPage = `SELECT * FROM activities WHERE deleted_at IS NULL ORDER BY id DESC LIMIT ? OFFSET ?` SqlDeleteActivitiesByGroupID = `DELETE FROM activities WHERE group_id = ?` )
View Source
const ( SqlQueryActivityUsersByActivityID = `SELECT * FROM activity_users WHERE activity_id = ? AND deleted_at IS NULL` SqlQueryActivityUsersByUserID = `SELECT * FROM activity_users WHERE user_id = ? AND deleted_at IS NULL` SqlQueryActivityUserByActivityIDAndUserID = `SELECT * FROM activity_users WHERE activity_id = ? AND user_id = ? AND deleted_at IS NULL` SqlInsertActivityUser = `INSERT INTO activity_users (activity_id, user_id, nick, is_friend) VALUES (?, ?, ?, ?)` SqlDeleteActivityUserByID = `DELETE FROM activity_users WHERE id = ?` )
Variables ¶
View Source
var Dao = new(ActivityDao)
Functions ¶
func BindCreate ¶
func BindCreateActivityUser ¶
func BindCreateActivityUser(c *fiber.Ctx) (*model.ActivityUser, error)
BindCreateActivityUser
func BindUpdate ¶
func UpdateAddr ¶
func UpdateAddr(c *fiber.Ctx) error
func UpdateContent ¶
func UpdateContent(c *fiber.Ctx) error
func UpdateQuota ¶
func UpdateQuota(c *fiber.Ctx) error
func UpdateTime ¶
func UpdateTime(c *fiber.Ctx) error
func UpdateTitle ¶
func UpdateTitle(c *fiber.Ctx) error
Types ¶
type ActivityDao ¶
type ActivityDao struct { }
func (ActivityDao) Create ¶
func (as ActivityDao) Create(activity *model.Activity) error
Create create a new activity
func (ActivityDao) CreateActivityUser ¶
func (as ActivityDao) CreateActivityUser(activityUser *model.ActivityUser) error
CreateActivityUser create activity user record
func (ActivityDao) Delete ¶
func (as ActivityDao) Delete(aid uint) error
Delete delete the activity by activity id
func (ActivityDao) GetByGroupID ¶
func (as ActivityDao) GetByGroupID(gid uint) ([]*model.Activity, error)
GetByGroupID get the activities by group id
func (ActivityDao) GetByID ¶
func (as ActivityDao) GetByID(aid uint) (*model.Activity, error)
GetByID get the activity by the activity id
func (ActivityDao) GetByOrganizerUserID ¶
func (as ActivityDao) GetByOrganizerUserID(uid uint) ([]*model.Activity, error)
GetByOrganizerUserID get the activities by organizer user id
func (ActivityDao) GetByUserID ¶
func (as ActivityDao) GetByUserID(uid uint) ([]*model.Activity, error)
GetByUserID get the activities by user id
type RequestCreate ¶
type RequestCreate struct { ID uint `json:"id"` UserID uint `json:"user_id" form:"user_id" validate:"required,numeric,min=1,max=999999999"` GroupID uint `json:"group_id" form:"group_id" validate:"required,numeric,min=0,max=1000"` Kind uint `json:"kind" form:"kind" validate:"required,numeric,min=1,max=20"` Type uint `json:"type" form:"type" validate:"required,numeric,min=1,max=5"` Title string `json:"title" form:"title" validate:"required"` Description string `json:"description" form:"description" validate:"required"` Quota uint `json:"quota" form:"quota" validate:"required,numeric,min=1,max=100"` Waiting uint `json:"waiting" form:"waiting" validate:"required,numeric,min=0,max=100"` Stage uint `json:"stage" form:"stage" validate:"required,numeric,min=1,max=4"` FeeType uint `json:"fee_type" form:"fee_type" validate:"required"` FeeMale uint `json:"fee_male" form:"fee_male" validate:"required_if=FeeType 2,3,4,5"` FeeFemale uint `json:"fee_female" form:"fee_female" validate:"required_if=FeeType 2,3,4,5"` Address string `json:"address" form:"address" validate:"required"` Ahead uint `json:"ahead" form:"ahead" validate:"required,numeric,min=0,max=240"` BeginAt string `json:"begin_at" form:"begin_at" validate:"required,datetime=2006-01-02 15:04:05"` EndAt string `json:"end_at" form:"end_at" validate:"required,datetime=2006-01-02 15:04:05"` }
type RequestCreateActivityUser ¶
type RequestCreateActivityUser struct { ActivityID uint `json:"activity_id" form:"activity_id" validate:"required,numeric,min=1,max=999999999"` UserID uint `json:"user_id" form:"user_id" validate:"required,numeric,min=1,max=999999999"` Nick string `json:"nick" form:"nick" validate:"required"` IsFriend uint8 `json:"is_friend" form:"is_friend" validate:"required,numeric,min=0,max=1"` }
RequestCreateActivityUser
Click to show internal directories.
Click to hide internal directories.