Reihenfolge innerhalb aller structs so verändert, dass möglichst wenige Pointerbytes verwendet werden.

This commit is contained in:
Jason Streifling 2024-01-06 16:18:19 +01:00
parent 66f7179267
commit b4d453b108
4 changed files with 13 additions and 13 deletions

View File

@ -18,38 +18,38 @@ type DB struct {
} }
type Person struct { type Person struct {
ID int64
FirstName string FirstName string
LastName string LastName string
ID int64
} }
type Instructor Person type Instructor Person
type Participant struct { type Participant struct {
Person
Company string Company string
Person
} }
type Briefing struct { type Briefing struct {
ID int64
DateTime string DateTime string
Location string Location string
Document string Document string
AsOf string AsOf string
InstructorID int64 InstructorID int64
ID int64
} }
type Answer struct { type Answer struct {
ID int64
Text string Text string
IsImage bool // TODO: relocate to sessionStructs if possible IsImage bool // TODO: relocate to sessionStructs if possible
ID int64
} }
type Question struct { type Question struct {
ID int64
Text string Text string
Answers []Answer Answers []Answer
Correct int Correct int
ID int64
} }
type GivenAnswer struct { type GivenAnswer struct {

View File

@ -26,9 +26,9 @@ import (
type briefing struct { type briefing struct {
*data.Briefing *data.Briefing
uuid uuid.UUID
participants []*participant participants []*participant
questions []data.Question questions []data.Question
uuid uuid.UUID
} }
func generateLogin() (string, error) { func generateLogin() (string, error) {

View File

@ -17,27 +17,27 @@ import (
) )
type tableHTMLData struct { type tableHTMLData struct {
sessionID uuid.UUID
otd []data.OverviewTableData otd []data.OverviewTableData
sessionID uuid.UUID
} }
type participantHTMLData struct { type participantHTMLData struct {
briefingID uuid.UUID
participant participant
briefingID uuid.UUID
} }
type questionHTMLData struct { type questionHTMLData struct {
question data.Question
participantHTMLData participantHTMLData
questionID int64 questionID int64
question data.Question
} }
type resultAnswer struct { type resultAnswer struct {
id int64
text string text string
correct bool correct bool
chosen bool chosen bool
isImage bool // TODO: relocate to sessionStructs if possible isImage bool // TODO: relocate to sessionStructs if possible
id int64
} }
type resultQuestion struct { type resultQuestion struct {
@ -46,12 +46,12 @@ type resultQuestion struct {
} }
type resultHTMLData struct { type resultHTMLData struct {
participantHTMLData
questions []resultQuestion questions []resultQuestion
participantHTMLData
} }
type summaryHTMLData struct { type summaryHTMLData struct {
participantsData []participantHTMLData
sessionID uuid.UUID sessionID uuid.UUID
briefingID uuid.UUID briefingID uuid.UUID
participantsData []participantHTMLData
} }

View File

@ -21,9 +21,9 @@ import (
) )
type Session struct { type Session struct {
uuid uuid.UUID
instructor data.Instructor instructor data.Instructor
briefings []*briefing briefings []*briefing
uuid uuid.UUID
} }
func (s *Session) handleSearch(db *data.DB) http.HandlerFunc { func (s *Session) handleSearch(db *data.DB) http.HandlerFunc {