data

package
v0.0.0-...-a5d30ca Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfDir = conf.GetConfDir()
)
View Source
var Courses []Course
View Source
var DB *gorm.DB
View Source
var Records []Record
View Source
var StudentCourses []StudentCourse
View Source
var Students []Student

Functions

func AddCourse

func AddCourse(newCourse *Course) error

func AddRecord

func AddRecord(newRecord *Record) error

func AddStudent

func AddStudent(newStudent *Student) error

func AddStudentCourse

func AddStudentCourse(newGrade *StudentCourse) error

func CheckFiles

func CheckFiles()

func CourseIndexByID

func CourseIndexByID(id uint) int

func CourseIndexByName

func CourseIndexByName(name string) int

func CourseIndexbyName

func CourseIndexbyName(name string) int

func CoursesNames

func CoursesNames() []string

func CreateDatabase

func CreateDatabase() error

func Delete

func Delete(i Deleter) error

func EditCourse

func EditCourse(id uint, newGrade Course) error

func EditGradeByStruct

func EditGradeByStruct(g *Course, newGrade Course) error

func EditStudent

func EditStudent(id uint, newStudent Student) error

func EditStudentByStruct

func EditStudentByStruct(s *Student, newStudent Student) error

func EditStudentCourse

func EditStudentCourse(id uint, newStudentGrade StudentCourse) error

func LoadCourses

func LoadCourses() error

func LoadEverything

func LoadEverything()

func LoadFiles

func LoadFiles()

func LoadRecords

func LoadRecords() error

func LoadStudentCourses

func LoadStudentCourses() error

func LoadStudents

func LoadStudents() error

func OpenDB

func OpenDB() *gorm.DB

func RecordIndexByID

func RecordIndexByID(id uint) int

func RecordIndexByName

func RecordIndexByName(name string) int

func StudentCourseIndexByID

func StudentCourseIndexByID(id uint) int

func StudentDNIs

func StudentDNIs() []string

func StudentIDs

func StudentIDs() []uint

func StudentIndexByDNI

func StudentIndexByDNI(dni string) int

func StudentIndexByID

func StudentIndexByID(id uint) int

func StudentIndexByName

func StudentIndexByName(name string) int

Types

type Course

type Course struct {
	gorm.Model
	Name  string
	Info  string
	Price string
}

func CourseByName

func CourseByName(name string) Course

func (Course) Delete

func (c Course) Delete() error

func (*Course) Edit

func (c *Course) Edit(newCourse *Course) error

type Deleter

type Deleter interface {
	Delete() error
}

type Record

type Record struct {
	gorm.Model
	StudentID uint
	Name      string
	Date      string
	Info      string
}

func (Record) Delete

func (r Record) Delete() error

func (*Record) Edit

func (r *Record) Edit(newRecord *Record) error

type Student

type Student struct {
	gorm.Model
	Name           string
	Age            uint
	DNI            string
	PhoneNumber    string
	ImageFilePath  string
	StudentCourses []StudentCourse `gorm:"-"`
	StudentRecords []Record        `gorm:"-"`
}

func (Student) AddCourse

func (s Student) AddCourse(newGrade *StudentCourse) error

func (Student) AddRecord

func (s Student) AddRecord(newRecord *Record) error

func (Student) CourseIndexByName

func (s Student) CourseIndexByName(name string) int

Note: This is extremely slow.

func (Student) CourseNames

func (s Student) CourseNames() []string

func (*Student) Courses

func (s *Student) Courses()

func (Student) Delete

func (s Student) Delete() error

func (*Student) DeleteRecord

func (s *Student) DeleteRecord(id uint) error

func (*Student) Edit

func (s *Student) Edit(newStudent *Student) error

func (*Student) Records

func (s *Student) Records()

type StudentCourse

type StudentCourse struct {
	gorm.Model
	CourseID  uint
	StudentID uint
	Start     string
	End       string
}

func (StudentCourse) Delete

func (s StudentCourse) Delete() error

func (*StudentCourse) Edit

func (s *StudentCourse) Edit(nSG *StudentCourse) error

Jump to

Keyboard shortcuts

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