summaryrefslogtreecommitdiff
path: root/modules/subject/subject.go
blob: f9586cc48c3452400c96fe37f7624c881ae2b428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package subject

import (
	"encoding/json"
	"os"
	"io"
	"log"
)

type subjects struct {
	Subjects	[]subject 	`json:"subjects"`
}

type subject struct {
	Name		string		`json:"name"`
	Description	string		`json:"description"`
}

func GetSubjectList() subjects {
	content, err := os.Open("/data/subjects/subjects.json")
	if err != nil {
		log.Fatal("Error when opening file: ", err)
	}

	content.Close()
	
	var subjects subjects 

	bytevalue, _ := io.ReadAll(content)

	json.Unmarshal(bytevalue, &subjects)

	for i := 0; i < len(subjects.Subjects); i++ {

	}

	return subjects
}