Documentation ¶
Overview ¶
Package tasks exposes the data structure required to assign exercices during activities, and to track the progression of the students.
Index ¶
- func IdMonoquestionArrayToPQ(ids []IdMonoquestion) pq.Int64Array
- func IdRandomMonoquestionArrayToPQ(ids []IdRandomMonoquestion) pq.Int64Array
- func IdTaskArrayToPQ(ids []IdTask) pq.Int64Array
- func InsertManyProgressions(tx *sql.Tx, items ...Progression) error
- func InsertManyRandomMonoquestionVariants(tx *sql.Tx, items ...RandomMonoquestionVariant) error
- func InsertProgression(db DB, item Progression) error
- func InsertRandomMonoquestionVariant(db DB, item RandomMonoquestionVariant) error
- func ResizeProgressions(db DB, id IdTask, nbQuestions int) error
- type DB
- type IdMonoquestion
- type IdMonoquestionSet
- type IdProgression
- type IdRandomMonoquestion
- func DeleteRandomMonoquestionsByIDs(tx DB, ids ...IdRandomMonoquestion) ([]IdRandomMonoquestion, error)
- func DeleteRandomMonoquestionsByIdQuestiongroups(tx DB, idQuestiongroups_ ...editor.IdQuestiongroup) ([]IdRandomMonoquestion, error)
- func ScanIdRandomMonoquestionArray(rs *sql.Rows) ([]IdRandomMonoquestion, error)
- type IdRandomMonoquestionSet
- type IdTask
- func DeleteTasksByIDs(tx DB, ids ...IdTask) ([]IdTask, error)
- func DeleteTasksByIdExercices(tx DB, idExercices_ ...editor.IdExercice) ([]IdTask, error)
- func DeleteTasksByIdMonoquestions(tx DB, idMonoquestions_ ...IdMonoquestion) ([]IdTask, error)
- func DeleteTasksByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) ([]IdTask, error)
- func ScanIdTaskArray(rs *sql.Rows) ([]IdTask, error)
- type IdTaskSet
- type Monoquestion
- type Monoquestions
- type OptionalIdMonoquestion
- type OptionalIdQuestion
- type OptionalIdRandomMonoquestion
- type Progression
- type Progressions
- func DeleteProgressionsByIdStudentAndIdTask(tx DB, idStudent teacher.IdStudent, idTask IdTask) (item Progressions, err error)
- func DeleteProgressionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Progressions, error)
- func DeleteProgressionsByIdTasks(tx DB, idTasks_ ...IdTask) (Progressions, error)
- func ScanProgressions(rs *sql.Rows) (Progressions, error)
- func SelectAllProgressions(db DB) (Progressions, error)
- func SelectProgressionsByIdStudentAndIdTask(tx DB, idStudent teacher.IdStudent, idTask IdTask) (item Progressions, err error)
- func SelectProgressionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Progressions, error)
- func SelectProgressionsByIdTasks(tx DB, idTasks_ ...IdTask) (Progressions, error)
- type QuestionHistory
- type RandomMonoquestion
- type RandomMonoquestionVariant
- func ScanRandomMonoquestionVariant(row *sql.Row) (RandomMonoquestionVariant, error)
- func SelectRandomMonoquestionVariantByIdStudentAndIdRandomMonoquestionAndIndex(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion, ...) (item RandomMonoquestionVariant, found bool, err error)
- type RandomMonoquestionVariants
- func DeleteRandomMonoquestionVariantsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) (RandomMonoquestionVariants, error)
- func DeleteRandomMonoquestionVariantsByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (RandomMonoquestionVariants, error)
- func DeleteRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion) (item RandomMonoquestionVariants, err error)
- func DeleteRandomMonoquestionVariantsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (RandomMonoquestionVariants, error)
- func ScanRandomMonoquestionVariants(rs *sql.Rows) (RandomMonoquestionVariants, error)
- func SelectAllRandomMonoquestionVariants(db DB) (RandomMonoquestionVariants, error)
- func SelectRandomMonoquestionVariantsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) (RandomMonoquestionVariants, error)
- func SelectRandomMonoquestionVariantsByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (RandomMonoquestionVariants, error)
- func SelectRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion) (item RandomMonoquestionVariants, err error)
- func SelectRandomMonoquestionVariantsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (RandomMonoquestionVariants, error)
- func (items RandomMonoquestionVariants) ByIdQuestion() map[editor.IdQuestion]RandomMonoquestionVariants
- func (items RandomMonoquestionVariants) ByIdRandomMonoquestion() map[IdRandomMonoquestion]RandomMonoquestionVariants
- func (items RandomMonoquestionVariants) ByIdStudent() map[teacher.IdStudent]RandomMonoquestionVariants
- func (l RandomMonoquestionVariants) EnsureOrder()
- func (items RandomMonoquestionVariants) IdQuestions() []editor.IdQuestion
- func (items RandomMonoquestionVariants) IdRandomMonoquestions() []IdRandomMonoquestion
- func (items RandomMonoquestionVariants) IdStudents() []teacher.IdStudent
- type RandomMonoquestions
- func ScanRandomMonoquestions(rs *sql.Rows) (RandomMonoquestions, error)
- func SelectAllRandomMonoquestions(db DB) (RandomMonoquestions, error)
- func SelectRandomMonoquestions(tx DB, ids ...IdRandomMonoquestion) (RandomMonoquestions, error)
- func SelectRandomMonoquestionsByIdQuestiongroups(tx DB, idQuestiongroups_ ...editor.IdQuestiongroup) (RandomMonoquestions, error)
- type Task
- type Tasks
- func ScanTasks(rs *sql.Rows) (Tasks, error)
- func SelectAllTasks(db DB) (Tasks, error)
- func SelectTasks(tx DB, ids ...IdTask) (Tasks, error)
- func SelectTasksByIdExercices(tx DB, idExercices_ ...editor.IdExercice) (Tasks, error)
- func SelectTasksByIdMonoquestions(tx DB, idMonoquestions_ ...IdMonoquestion) (Tasks, error)
- func SelectTasksByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (Tasks, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdMonoquestionArrayToPQ ¶
func IdMonoquestionArrayToPQ(ids []IdMonoquestion) pq.Int64Array
func IdRandomMonoquestionArrayToPQ ¶
func IdRandomMonoquestionArrayToPQ(ids []IdRandomMonoquestion) pq.Int64Array
func IdTaskArrayToPQ ¶
func IdTaskArrayToPQ(ids []IdTask) pq.Int64Array
func InsertManyProgressions ¶
func InsertManyProgressions(tx *sql.Tx, items ...Progression) error
Insert the links Progression in the database. It is a no-op if 'items' is empty.
func InsertManyRandomMonoquestionVariants ¶
func InsertManyRandomMonoquestionVariants(tx *sql.Tx, items ...RandomMonoquestionVariant) error
Insert the links RandomMonoquestionVariant in the database. It is a no-op if 'items' is empty.
func InsertProgression ¶
func InsertProgression(db DB, item Progression) error
func InsertRandomMonoquestionVariant ¶
func InsertRandomMonoquestionVariant(db DB, item RandomMonoquestionVariant) error
Types ¶
type DB ¶
type DB interface { Exec(query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row Prepare(query string) (*sql.Stmt, error) }
DB groups transaction like objects, and is implemented by *sql.DB and *sql.Tx
type IdMonoquestion ¶
type IdMonoquestion int64
func DeleteMonoquestionsByIDs ¶
func DeleteMonoquestionsByIDs(tx DB, ids ...IdMonoquestion) ([]IdMonoquestion, error)
Deletes the Monoquestion in the database and returns the ids.
func DeleteMonoquestionsByIdQuestions ¶
func DeleteMonoquestionsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) ([]IdMonoquestion, error)
func ScanIdMonoquestionArray ¶
func ScanIdMonoquestionArray(rs *sql.Rows) ([]IdMonoquestion, error)
ScanIdMonoquestionArray scans the result of a query returning a list of ID's.
func (IdMonoquestion) AsOptional ¶
func (id IdMonoquestion) AsOptional() OptionalIdMonoquestion
type IdMonoquestionSet ¶
type IdMonoquestionSet map[IdMonoquestion]bool
func NewIdMonoquestionSetFrom ¶
func NewIdMonoquestionSetFrom(ids []IdMonoquestion) IdMonoquestionSet
func (IdMonoquestionSet) Add ¶
func (s IdMonoquestionSet) Add(id IdMonoquestion)
func (IdMonoquestionSet) Has ¶
func (s IdMonoquestionSet) Has(id IdMonoquestion) bool
func (IdMonoquestionSet) Keys ¶
func (s IdMonoquestionSet) Keys() []IdMonoquestion
type IdProgression ¶
type IdProgression int64
type IdRandomMonoquestion ¶
type IdRandomMonoquestion int64
func DeleteRandomMonoquestionsByIDs ¶
func DeleteRandomMonoquestionsByIDs(tx DB, ids ...IdRandomMonoquestion) ([]IdRandomMonoquestion, error)
Deletes the RandomMonoquestion in the database and returns the ids.
func DeleteRandomMonoquestionsByIdQuestiongroups ¶
func DeleteRandomMonoquestionsByIdQuestiongroups(tx DB, idQuestiongroups_ ...editor.IdQuestiongroup) ([]IdRandomMonoquestion, error)
func ScanIdRandomMonoquestionArray ¶
func ScanIdRandomMonoquestionArray(rs *sql.Rows) ([]IdRandomMonoquestion, error)
ScanIdRandomMonoquestionArray scans the result of a query returning a list of ID's.
func (IdRandomMonoquestion) AsOptional ¶
func (id IdRandomMonoquestion) AsOptional() OptionalIdRandomMonoquestion
type IdRandomMonoquestionSet ¶
type IdRandomMonoquestionSet map[IdRandomMonoquestion]bool
func NewIdRandomMonoquestionSetFrom ¶
func NewIdRandomMonoquestionSetFrom(ids []IdRandomMonoquestion) IdRandomMonoquestionSet
func (IdRandomMonoquestionSet) Add ¶
func (s IdRandomMonoquestionSet) Add(id IdRandomMonoquestion)
func (IdRandomMonoquestionSet) Has ¶
func (s IdRandomMonoquestionSet) Has(id IdRandomMonoquestion) bool
func (IdRandomMonoquestionSet) Keys ¶
func (s IdRandomMonoquestionSet) Keys() []IdRandomMonoquestion
type IdTask ¶
type IdTask int64
func DeleteTasksByIDs ¶
Deletes the Task in the database and returns the ids.
func DeleteTasksByIdExercices ¶
func DeleteTasksByIdExercices(tx DB, idExercices_ ...editor.IdExercice) ([]IdTask, error)
func DeleteTasksByIdMonoquestions ¶
func DeleteTasksByIdMonoquestions(tx DB, idMonoquestions_ ...IdMonoquestion) ([]IdTask, error)
func DeleteTasksByIdRandomMonoquestions ¶
func DeleteTasksByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) ([]IdTask, error)
type IdTaskSet ¶
func NewIdTaskSetFrom ¶
type Monoquestion ¶
type Monoquestion struct { Id IdMonoquestion IdQuestion editor.IdQuestion NbRepeat int Bareme int // for one question }
Monoquestion is a shortcut for an exercice composed of only one question. It is used to avoid creating cumbersome exercice wrappers around questions. gomacro:SQL ADD CHECK(NbRepeat > 0)
func DeleteMonoquestionById ¶
func DeleteMonoquestionById(tx DB, id IdMonoquestion) (Monoquestion, error)
Deletes the Monoquestion and returns the item
func ScanMonoquestion ¶
func ScanMonoquestion(row *sql.Row) (Monoquestion, error)
func SelectMonoquestion ¶
func SelectMonoquestion(tx DB, id IdMonoquestion) (Monoquestion, error)
SelectMonoquestion returns the entry matching 'id'.
func (Monoquestion) Insert ¶
func (item Monoquestion) Insert(tx DB) (out Monoquestion, err error)
Insert one Monoquestion in the database and returns the item with id filled.
func (Monoquestion) Update ¶
func (item Monoquestion) Update(tx DB) (out Monoquestion, err error)
Update Monoquestion in the database and returns the new version.
type Monoquestions ¶
type Monoquestions map[IdMonoquestion]Monoquestion
func ScanMonoquestions ¶
func ScanMonoquestions(rs *sql.Rows) (Monoquestions, error)
func SelectAllMonoquestions ¶
func SelectAllMonoquestions(db DB) (Monoquestions, error)
SelectAll returns all the items in the monoquestions table.
func SelectMonoquestions ¶
func SelectMonoquestions(tx DB, ids ...IdMonoquestion) (Monoquestions, error)
SelectMonoquestions returns the entry matching the given 'ids'.
func SelectMonoquestionsByIdQuestions ¶
func SelectMonoquestionsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) (Monoquestions, error)
func (Monoquestions) ByIdQuestion ¶
func (items Monoquestions) ByIdQuestion() map[editor.IdQuestion]Monoquestions
ByIdQuestion returns a map with 'IdQuestion' as keys.
func (Monoquestions) IDs ¶
func (m Monoquestions) IDs() []IdMonoquestion
func (Monoquestions) IdQuestions ¶
func (items Monoquestions) IdQuestions() []editor.IdQuestion
IdQuestions returns the list of ids of IdQuestion contained in this table. They are not garanteed to be distinct.
type OptionalIdMonoquestion ¶
type OptionalIdMonoquestion struct { Valid bool ID IdMonoquestion }
func (*OptionalIdMonoquestion) Scan ¶
func (s *OptionalIdMonoquestion) Scan(src interface{}) error
type OptionalIdQuestion ¶
type OptionalIdQuestion struct { Valid bool ID editor.IdQuestion }
type OptionalIdRandomMonoquestion ¶
type OptionalIdRandomMonoquestion struct { Valid bool ID IdRandomMonoquestion }
func (*OptionalIdRandomMonoquestion) Scan ¶
func (s *OptionalIdRandomMonoquestion) Scan(src interface{}) error
type Progression ¶
type Progression struct { IdStudent teacher.IdStudent `gomacro-sql-on-delete:"CASCADE"` IdTask IdTask `gomacro-sql-on-delete:"CASCADE"` // Index in the question list // For exercice, it is the question number // For monoquestion, it is the "repetion" number Index int16 `json:"index"` History QuestionHistory `json:"history"` }
Progression is a link table storing the student progressions on tasks. gomacro:SQL ADD UNIQUE(IdStudent, IdTask, Index) gomacro:SQL _SELECT KEY (IdStudent, IdTask)
func ScanProgression ¶
func ScanProgression(row *sql.Row) (Progression, error)
func SelectProgressionByIdStudentAndIdTaskAndIndex ¶
func SelectProgressionByIdStudentAndIdTaskAndIndex(tx DB, idStudent teacher.IdStudent, idTask IdTask, index int16) (item Progression, found bool, err error)
SelectProgressionByIdStudentAndIdTaskAndIndex return zero or one item, thanks to a UNIQUE SQL constraint.
func (Progression) Delete ¶
func (item Progression) Delete(tx DB) error
Delete the link Progression from the database. Only the foreign keys IdStudent, IdTask fields are used in 'item'.
type Progressions ¶
type Progressions []Progression
func DeleteProgressionsByIdStudentAndIdTask ¶
func DeleteProgressionsByIdStudentAndIdTask(tx DB, idStudent teacher.IdStudent, idTask IdTask) (item Progressions, err error)
DeleteProgressionsByIdStudentAndIdTask deletes the item matching the given fields, returning the deleted items.
func DeleteProgressionsByIdStudents ¶
func DeleteProgressionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Progressions, error)
func DeleteProgressionsByIdTasks ¶
func DeleteProgressionsByIdTasks(tx DB, idTasks_ ...IdTask) (Progressions, error)
func ScanProgressions ¶
func ScanProgressions(rs *sql.Rows) (Progressions, error)
func SelectAllProgressions ¶
func SelectAllProgressions(db DB) (Progressions, error)
SelectAll returns all the items in the progressions table.
func SelectProgressionsByIdStudentAndIdTask ¶
func SelectProgressionsByIdStudentAndIdTask(tx DB, idStudent teacher.IdStudent, idTask IdTask) (item Progressions, err error)
SelectProgressionsByIdStudentAndIdTask selects the items matching the given fields.
func SelectProgressionsByIdStudents ¶
func SelectProgressionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Progressions, error)
func SelectProgressionsByIdTasks ¶
func SelectProgressionsByIdTasks(tx DB, idTasks_ ...IdTask) (Progressions, error)
func (Progressions) ByIdStudent ¶
func (items Progressions) ByIdStudent() map[teacher.IdStudent]Progressions
ByIdStudent returns a map with 'IdStudent' as keys.
func (Progressions) ByIdTask ¶
func (items Progressions) ByIdTask() map[IdTask]Progressions
ByIdTask returns a map with 'IdTask' as keys.
func (Progressions) EnsureOrder ¶
func (l Progressions) EnsureOrder()
EnsureOrder must be call on the questions of one exercice, to make sure the order in the slice is consistent with the one indicated by `Index`
func (Progressions) IdStudents ¶
func (items Progressions) IdStudents() []teacher.IdStudent
IdStudents returns the list of ids of IdStudent contained in this link table. They are not garanteed to be distinct.
func (Progressions) IdTasks ¶
func (items Progressions) IdTasks() []IdTask
IdTasks returns the list of ids of IdTask contained in this link table. They are not garanteed to be distinct.
type QuestionHistory ¶
type QuestionHistory []bool
QuestionHistory stores the successes for one question, in chronological order. For instance, [true, false, true] means : first try: correct, second: wrong answer,third: correct
func (*QuestionHistory) Scan ¶
func (s *QuestionHistory) Scan(src interface{}) error
func (QuestionHistory) Stats ¶
func (qh QuestionHistory) Stats() (success, failure int)
Stats returns the number of tries
func (QuestionHistory) Success ¶
func (qh QuestionHistory) Success() bool
Success return true if at least one try is sucessful
type RandomMonoquestion ¶
type RandomMonoquestion struct { Id IdRandomMonoquestion IdQuestiongroup editor.IdQuestiongroup NbRepeat int Bareme int // for one question Difficulty editor.DifficultyQuery // optional, empty for all questions }
RandomMonoquestion allows the teacher to specify a whole [Questiongroup], with questions chosen randomly for each student, according to an (optional) difficulty tag. gomacro:SQL ADD CHECK(NbRepeat > 0)
func DeleteRandomMonoquestionById ¶
func DeleteRandomMonoquestionById(tx DB, id IdRandomMonoquestion) (RandomMonoquestion, error)
Deletes the RandomMonoquestion and returns the item
func ScanRandomMonoquestion ¶
func ScanRandomMonoquestion(row *sql.Row) (RandomMonoquestion, error)
func SelectRandomMonoquestion ¶
func SelectRandomMonoquestion(tx DB, id IdRandomMonoquestion) (RandomMonoquestion, error)
SelectRandomMonoquestion returns the entry matching 'id'.
func (RandomMonoquestion) Insert ¶
func (item RandomMonoquestion) Insert(tx DB) (out RandomMonoquestion, err error)
Insert one RandomMonoquestion in the database and returns the item with id filled.
func (RandomMonoquestion) Update ¶
func (item RandomMonoquestion) Update(tx DB) (out RandomMonoquestion, err error)
Update RandomMonoquestion in the database and returns the new version.
type RandomMonoquestionVariant ¶
type RandomMonoquestionVariant struct { IdStudent teacher.IdStudent `gomacro-sql-on-delete:"CASCADE"` IdRandomMonoquestion IdRandomMonoquestion `gomacro-sql-on-delete:"CASCADE"` Index int16 `json:"index"` IdQuestion editor.IdQuestion }
RandomMonoquestionVariant is a link table storing which variants is attributed to a given student gomacro:SQL ADD UNIQUE(IdStudent, IdRandomMonoquestion, Index) gomacro:SQL _SELECT KEY (IdStudent, IdRandomMonoquestion)
func ScanRandomMonoquestionVariant ¶
func ScanRandomMonoquestionVariant(row *sql.Row) (RandomMonoquestionVariant, error)
func SelectRandomMonoquestionVariantByIdStudentAndIdRandomMonoquestionAndIndex ¶
func SelectRandomMonoquestionVariantByIdStudentAndIdRandomMonoquestionAndIndex(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion, index int16) (item RandomMonoquestionVariant, found bool, err error)
SelectRandomMonoquestionVariantByIdStudentAndIdRandomMonoquestionAndIndex return zero or one item, thanks to a UNIQUE SQL constraint.
func (RandomMonoquestionVariant) Delete ¶
func (item RandomMonoquestionVariant) Delete(tx DB) error
Delete the link RandomMonoquestionVariant from the database. Only the foreign keys IdStudent, IdRandomMonoquestion, IdQuestion fields are used in 'item'.
type RandomMonoquestionVariants ¶
type RandomMonoquestionVariants []RandomMonoquestionVariant
func DeleteRandomMonoquestionVariantsByIdQuestions ¶
func DeleteRandomMonoquestionVariantsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) (RandomMonoquestionVariants, error)
func DeleteRandomMonoquestionVariantsByIdRandomMonoquestions ¶
func DeleteRandomMonoquestionVariantsByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (RandomMonoquestionVariants, error)
func DeleteRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion ¶
func DeleteRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion) (item RandomMonoquestionVariants, err error)
DeleteRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion deletes the item matching the given fields, returning the deleted items.
func DeleteRandomMonoquestionVariantsByIdStudents ¶
func DeleteRandomMonoquestionVariantsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (RandomMonoquestionVariants, error)
func ScanRandomMonoquestionVariants ¶
func ScanRandomMonoquestionVariants(rs *sql.Rows) (RandomMonoquestionVariants, error)
func SelectAllRandomMonoquestionVariants ¶
func SelectAllRandomMonoquestionVariants(db DB) (RandomMonoquestionVariants, error)
SelectAll returns all the items in the random_monoquestion_variants table.
func SelectRandomMonoquestionVariantsByIdQuestions ¶
func SelectRandomMonoquestionVariantsByIdQuestions(tx DB, idQuestions_ ...editor.IdQuestion) (RandomMonoquestionVariants, error)
func SelectRandomMonoquestionVariantsByIdRandomMonoquestions ¶
func SelectRandomMonoquestionVariantsByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (RandomMonoquestionVariants, error)
func SelectRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion ¶
func SelectRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion(tx DB, idStudent teacher.IdStudent, idRandomMonoquestion IdRandomMonoquestion) (item RandomMonoquestionVariants, err error)
SelectRandomMonoquestionVariantsByIdStudentAndIdRandomMonoquestion selects the items matching the given fields.
func SelectRandomMonoquestionVariantsByIdStudents ¶
func SelectRandomMonoquestionVariantsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (RandomMonoquestionVariants, error)
func (RandomMonoquestionVariants) ByIdQuestion ¶
func (items RandomMonoquestionVariants) ByIdQuestion() map[editor.IdQuestion]RandomMonoquestionVariants
ByIdQuestion returns a map with 'IdQuestion' as keys.
func (RandomMonoquestionVariants) ByIdRandomMonoquestion ¶
func (items RandomMonoquestionVariants) ByIdRandomMonoquestion() map[IdRandomMonoquestion]RandomMonoquestionVariants
ByIdRandomMonoquestion returns a map with 'IdRandomMonoquestion' as keys.
func (RandomMonoquestionVariants) ByIdStudent ¶
func (items RandomMonoquestionVariants) ByIdStudent() map[teacher.IdStudent]RandomMonoquestionVariants
ByIdStudent returns a map with 'IdStudent' as keys.
func (RandomMonoquestionVariants) EnsureOrder ¶
func (l RandomMonoquestionVariants) EnsureOrder()
EnsureOrder must be call on the questions of one exercice, to make sure the order in the slice is consistent with the one indicated by `Index`
func (RandomMonoquestionVariants) IdQuestions ¶
func (items RandomMonoquestionVariants) IdQuestions() []editor.IdQuestion
IdQuestions returns the list of ids of IdQuestion contained in this link table. They are not garanteed to be distinct.
func (RandomMonoquestionVariants) IdRandomMonoquestions ¶
func (items RandomMonoquestionVariants) IdRandomMonoquestions() []IdRandomMonoquestion
IdRandomMonoquestions returns the list of ids of IdRandomMonoquestion contained in this link table. They are not garanteed to be distinct.
func (RandomMonoquestionVariants) IdStudents ¶
func (items RandomMonoquestionVariants) IdStudents() []teacher.IdStudent
IdStudents returns the list of ids of IdStudent contained in this link table. They are not garanteed to be distinct.
type RandomMonoquestions ¶
type RandomMonoquestions map[IdRandomMonoquestion]RandomMonoquestion
func ScanRandomMonoquestions ¶
func ScanRandomMonoquestions(rs *sql.Rows) (RandomMonoquestions, error)
func SelectAllRandomMonoquestions ¶
func SelectAllRandomMonoquestions(db DB) (RandomMonoquestions, error)
SelectAll returns all the items in the random_monoquestions table.
func SelectRandomMonoquestions ¶
func SelectRandomMonoquestions(tx DB, ids ...IdRandomMonoquestion) (RandomMonoquestions, error)
SelectRandomMonoquestions returns the entry matching the given 'ids'.
func SelectRandomMonoquestionsByIdQuestiongroups ¶
func SelectRandomMonoquestionsByIdQuestiongroups(tx DB, idQuestiongroups_ ...editor.IdQuestiongroup) (RandomMonoquestions, error)
func (RandomMonoquestions) ByIdQuestiongroup ¶
func (items RandomMonoquestions) ByIdQuestiongroup() map[editor.IdQuestiongroup]RandomMonoquestions
ByIdQuestiongroup returns a map with 'IdQuestiongroup' as keys.
func (RandomMonoquestions) IDs ¶
func (m RandomMonoquestions) IDs() []IdRandomMonoquestion
func (RandomMonoquestions) IdQuestiongroups ¶
func (items RandomMonoquestions) IdQuestiongroups() []editor.IdQuestiongroup
IdQuestiongroups returns the list of ids of IdQuestiongroup contained in this table. They are not garanteed to be distinct.
type Task ¶
type Task struct { Id IdTask IdExercice editor.OptionalIdExercice `gomacro-sql-foreign:"Exercice"` IdMonoquestion OptionalIdMonoquestion `gomacro-sql-foreign:"Monoquestion"` IdRandomMonoquestion OptionalIdRandomMonoquestion `gomacro-sql-foreign:"RandomMonoquestion"` }
Task is a pointer to an assignement to one exercice, either an `Exercice`, a `Monoquestion` or a `RandomMonoquestion` gomacro:SQL ADD UNIQUE(Id, IdExercice) gomacro:SQL ADD CHECK((IdExercice IS NOT NULL)::int + (IdMonoquestion IS NOT NULL)::int + (IdRandomMonoquestion IS NOT NULL)::int = 1)
func DeleteTaskById ¶
Deletes the Task and returns the item
func SelectTask ¶
SelectTask returns the entry matching 'id'.
func SelectTaskByIdAndIdExercice ¶
func SelectTaskByIdAndIdExercice(tx DB, id IdTask, idExercice editor.OptionalIdExercice) (item Task, found bool, err error)
SelectTaskByIdAndIdExercice return zero or one item, thanks to a UNIQUE SQL constraint.
type Tasks ¶
func SelectAllTasks ¶
SelectAll returns all the items in the tasks table.
func SelectTasks ¶
SelectTasks returns the entry matching the given 'ids'.
func SelectTasksByIdExercices ¶
func SelectTasksByIdExercices(tx DB, idExercices_ ...editor.IdExercice) (Tasks, error)
func SelectTasksByIdMonoquestions ¶
func SelectTasksByIdMonoquestions(tx DB, idMonoquestions_ ...IdMonoquestion) (Tasks, error)
func SelectTasksByIdRandomMonoquestions ¶
func SelectTasksByIdRandomMonoquestions(tx DB, idRandomMonoquestions_ ...IdRandomMonoquestion) (Tasks, error)