Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Course ¶
type Course struct {
gorm.Model
Name string `gorm:"not null"`
Code string `gorm:"uniqueIndex;not null"`
Description string
TeacherID uint `gorm:"not null"` // Reference to Teacher
Teacher Teacher `gorm:"foreignKey:TeacherID"`
}
Course represents a course in the system
type Enrollment ¶
type Enrollment struct {
gorm.Model
StudentID uint `gorm:"not null"`
CourseID uint `gorm:"not null"`
Grade *string // Nullable grade
}
Enrollment represents a student's enrollment in a course
func (Enrollment) TableName ¶
func (Enrollment) TableName() string
type Student ¶
type Student struct {
gorm.Model
UserID uint `gorm:"uniqueIndex;not null"`
User User `gorm:"foreignKey:UserID"`
DateOfBirth string `gorm:"type:date"`
Address string
Phone string
}
Student represents a student in the system
type Teacher ¶
type Teacher struct {
gorm.Model
UserID uint `gorm:"uniqueIndex;not null"`
User User `gorm:"foreignKey:UserID"`
Subject string `gorm:"not null"`
Phone string
}
Teacher represents a teacher in the system
type User ¶
type User struct {
gorm.Model
Email string `gorm:"uniqueIndex;not null"`
Password string `gorm:"not null"`
FirstName string `gorm:"not null"`
LastName string `gorm:"not null"`
Role string `gorm:"not null"` // admin, teacher, student, parent
}
User represents a user in the system
func (*User) CheckPassword ¶
CheckPassword verifies if the provided password matches the hashed password
func (*User) SetPassword ¶
SetPassword hashes the password and sets it on the user
Click to show internal directories.
Click to hide internal directories.