models

package
v0.0.0-...-c9b56a8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeNull uint16 = iota
	EventTypeOther
	EventTypeSalon
	EventTypeLecture
	EventTypeHackathon
)

Variables

This section is empty.

Functions

func CreateAttendance

func CreateAttendance(tx *gorm.DB, userID int64, eventID int64) error

func DeleteAttendance

func DeleteAttendance(tx *gorm.DB, userID int64, eventID int64) error

func FindAttendanceByUserIDAndEventID

func FindAttendanceByUserIDAndEventID(tx *gorm.DB, userID int64, eventID int64, dest interface{}) error

func FindEventByID

func FindEventByID(tx *gorm.DB, id int64, dest interface{}) error

func FindEventsByIDs

func FindEventsByIDs(tx *gorm.DB, ids []int64, dests interface{}) error

func FindHackathonByEventID

func FindHackathonByEventID(tx *gorm.DB, eventID int64, dest interface{}) error

func FindScheduleByEventID

func FindScheduleByEventID(tx *gorm.DB, eventID int64, dest interface{}) error

func FindUserEnrolledEventsByUserID

func FindUserEnrolledEventsByUserID(tx *gorm.DB, userID int64, dests *[]Event) error

Types

type Attendance

type Attendance struct {
	UserID  int64 `gorm:"type:bigint;primaryKey;not null"`
	User    *userModels.User
	EventID int64 `gorm:"type:bigint;primaryKey;not null"`
	Event   *Event
	Checked bool `gorm:"default:false"`
}

type Event

type Event struct {
	gorm.Model
	// 活动ID
	ID int64 `gorm:"type:bigint;primaryKey;not null"`
	// 活动添加者ID
	OwnerUserID int64 `gorm:"type:bigint;not null"`

	// 活动举办方
	Organizer string `gorm:"not null"`
	// 活动标题
	Title string `gorm:"not null"`
	// 活动介绍
	Description string `gorm:"not null"`
	// 活动宣传图
	ImageUrl string `gorm:"not null"`

	// 活动开始时间
	StartedAt time.Time `gorm:"not null"`
	// 活动结束时间
	EndedAt time.Time `gorm:"not null"`

	// 活动地点
	Location string `gorm:"not null"`
	// 活动类型
	EventType uint16 `gorm:"not null;default:1"`
}

type Hackathon

type Hackathon struct {
	gorm.Model
	// 活动时间表主键
	ID int64 `gorm:"type:bigint;primaryKey;not null"`
	// 从属的活动ID
	EventID int64 `gorm:"type:bigint;not null"`

	// 步骤
	Steps string `gorm:"not null"`
}

类型为 EventKindHackathon 的活动详细步骤

type Schedule

type Schedule struct {
	gorm.Model
	// 活动时间表主键
	ID int64 `gorm:"type:bigint;primaryKey;not null"`
	// 从属的活动ID
	EventID int64 `gorm:"type:bigint;not null"`

	// 标题
	Title string `gorm:"not null"`
	// 该时间段开始时间
	StartedAt time.Time `gorm:"not null"`
	// 该时间段结束时间
	EndedAt time.Time `gorm:"not null"`

	// 该时间段主讲人姓名
	TalkerName string `gorm:"not null"`
	// 头衔
	TalkerTitle string `gorm:"not null"`
	// 头像
	TalkerAvatarURL string `gorm:"not null"`
	// 介绍
	TalkerDescription string `gorm:"not null"`
}

类型为 EventKindSalon, EventKindLecture 的时间安排表

Jump to

Keyboard shortcuts

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