Documentation
¶
Index ¶
- Variables
- func BuildClassIndex(tx *gorm.DB, req *model.ClassQueryRequest) *gorm.DB
- func BuildQuerySQL(tx *gorm.DB, query *model.QueryRequest, role ...string) *gorm.DB
- func IgnoreStructCopy(to, from any, ignore string)
- func IsValidPassword(password string) bool
- func OK[T any](c *gin.Context, data T)
- func Throw(c *gin.Context, errCode errhandle.ErrCode)
- func ThrowError(c *gin.Context, err error)
- type Class
- func (c *Class) AddClass(name string) (id int64, err error)
- func (c *Class) BelongsTo(teacherid int64, classname ...string) *model.GetClassBelongsResponse
- func (c *Class) GetClassIDByName(name string) (int64, bool)
- func (c *Class) GetClassNameByID(id int64) (string, bool)
- func (c *Class) GetStudentClassID(studentid int64) (int64, error)
- func (c *Class) GetStudents(id int64, classname string) (ret []*model.GetUserResponse)
- func (c *Class) GetTeacherClass(teacherid int64) (ret []int64, err error)
- func (c *Class) RemoveClassByID(id int64) (err error)
- func (c *Class) StudentJoin(studentid int64, name string, filter ...int64) (err error)
- func (c *Class) StudentLeave(studentid int64, filter ...int64) (err error)
- func (c *Class) TeacherJoin(Teacherid int64, name string) (err error)
- func (c *Class) TeacherLeave(Teacherid int64, classname string) (err error)
- type ServerUtils
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrClassNotExists = errors.New("class doesn't exist")
)
Functions ¶
func BuildClassIndex ¶
func BuildQuerySQL ¶
func IgnoreStructCopy ¶
func IsValidPassword ¶
func ThrowError ¶
Types ¶
type Class ¶
type Class struct {
*ServerUtils
}
func NewClass ¶
func NewClass(db *ServerUtils) *Class
func (*Class) BelongsTo ¶
func (c *Class) BelongsTo(teacherid int64, classname ...string) *model.GetClassBelongsResponse
func (*Class) GetStudents ¶
func (c *Class) GetStudents(id int64, classname string) (ret []*model.GetUserResponse)
func (*Class) GetTeacherClass ¶
func (*Class) RemoveClassByID ¶
func (*Class) StudentJoin ¶
func (*Class) StudentLeave ¶
type ServerUtils ¶
type ServerUtils struct { DB *gorm.DB RedisDB *redis.Client Config *config.Config Token token.TokenGenerate Class *Class }
func NewServerUtils ¶
func NewServerUtils(cfg *config.Config) *ServerUtils
Click to show internal directories.
Click to hide internal directories.