Documentation ¶
Index ¶
- func IdTrivialArrayToPQ(ids []IdTrivial) pq.Int64Array
- func InsertManySelfaccessTrivials(tx *sql.Tx, items ...SelfaccessTrivial) error
- func InsertSelfaccessTrivial(db DB, item SelfaccessTrivial) error
- type CategoriesQuestions
- type DB
- type IdTrivial
- type IdTrivialSet
- type QuestionCriterion
- type SelfaccessTrivial
- type SelfaccessTrivials
- func DeleteSelfaccessTrivialsByIdClassrooms(tx DB, idClassrooms_ ...teacher.IdClassroom) (SelfaccessTrivials, error)
- func DeleteSelfaccessTrivialsByIdTeachers(tx DB, idTeachers_ ...teacher.IdTeacher) (SelfaccessTrivials, error)
- func DeleteSelfaccessTrivialsByIdTrivialAndIdTeacher(tx DB, idTrivial IdTrivial, idTeacher teacher.IdTeacher) (item SelfaccessTrivials, err error)
- func DeleteSelfaccessTrivialsByIdTrivials(tx DB, idTrivials_ ...IdTrivial) (SelfaccessTrivials, error)
- func ScanSelfaccessTrivials(rs *sql.Rows) (SelfaccessTrivials, error)
- func SelectAllSelfaccessTrivials(db DB) (SelfaccessTrivials, error)
- func SelectSelfaccessTrivialsByIdClassrooms(tx DB, idClassrooms_ ...teacher.IdClassroom) (SelfaccessTrivials, error)
- func SelectSelfaccessTrivialsByIdTeachers(tx DB, idTeachers_ ...teacher.IdTeacher) (SelfaccessTrivials, error)
- func SelectSelfaccessTrivialsByIdTrivialAndIdTeacher(tx DB, idTrivial IdTrivial, idTeacher teacher.IdTeacher) (item SelfaccessTrivials, err error)
- func SelectSelfaccessTrivialsByIdTrivials(tx DB, idTrivials_ ...IdTrivial) (SelfaccessTrivials, error)
- func (items SelfaccessTrivials) ByIdClassroom() map[teacher.IdClassroom]SelfaccessTrivials
- func (items SelfaccessTrivials) ByIdTeacher() map[teacher.IdTeacher]SelfaccessTrivials
- func (items SelfaccessTrivials) ByIdTrivial() map[IdTrivial]SelfaccessTrivials
- func (items SelfaccessTrivials) IdClassrooms() []teacher.IdClassroom
- func (items SelfaccessTrivials) IdTeachers() []teacher.IdTeacher
- func (items SelfaccessTrivials) IdTrivials() []IdTrivial
- type Trivial
- type Trivials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdTrivialArrayToPQ ¶
func IdTrivialArrayToPQ(ids []IdTrivial) pq.Int64Array
func InsertManySelfaccessTrivials ¶
func InsertManySelfaccessTrivials(tx *sql.Tx, items ...SelfaccessTrivial) error
Insert the links SelfaccessTrivial in the database. It is a no-op if 'items' is empty.
func InsertSelfaccessTrivial ¶
func InsertSelfaccessTrivial(db DB, item SelfaccessTrivial) error
Types ¶
type CategoriesQuestions ¶
type CategoriesQuestions struct { Tags [trivial.NbCategories]QuestionCriterion // Union. An empty slice means no selection : all variants are accepted. Difficulties editor.DifficultyQuery }
CategoriesQuestions defines a union of intersection of tags, for every category.
func (CategoriesQuestions) Levels ¶
func (cat CategoriesQuestions) Levels() []string
Levels returns all the levels targetted. It may return an empty slice.
func (CategoriesQuestions) MatchMatiere ¶
func (cat CategoriesQuestions) MatchMatiere(matiere teacher.MatiereTag) bool
MatchMatiere returns true if [matiere] is in one of the categories.
If there is no matiere defined at all, [Autre] will match.
func (*CategoriesQuestions) Normalize ¶
func (query *CategoriesQuestions) Normalize()
Normalize removes empty intersections and normalizes tags, for each categories
func (*CategoriesQuestions) Scan ¶
func (s *CategoriesQuestions) Scan(src interface{}) error
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 IdTrivial ¶
type IdTrivial int64
func DeleteTrivialsByIDs ¶
Deletes the Trivial in the database and returns the ids.
type IdTrivialSet ¶
func NewIdTrivialSetFrom ¶
func NewIdTrivialSetFrom(ids []IdTrivial) IdTrivialSet
func (IdTrivialSet) Add ¶
func (s IdTrivialSet) Add(id IdTrivial)
func (IdTrivialSet) Has ¶
func (s IdTrivialSet) Has(id IdTrivial) bool
func (IdTrivialSet) Keys ¶
func (s IdTrivialSet) Keys() []IdTrivial
type QuestionCriterion ¶
type QuestionCriterion [][]editor.TagSection
QuestionCriterion is an union of intersection of tags.
type SelfaccessTrivial ¶
type SelfaccessTrivial struct { IdClassroom teacher.IdClassroom `gomacro-sql-on-delete:"CASCADE"` IdTrivial IdTrivial `gomacro-sql-on-delete:"CASCADE"` IdTeacher teacher.IdTeacher }
SelfaccessTrivial is a link table enabling a teacher to publish (or hide) a Trivial for the students of a classroom. gomacro:SQL ADD FOREIGN KEY (IdClassroom, IdTeacher) REFERENCES Classrooms (Id, IdTeacher) ON DELETE CASCADE gomacro:SQL _SELECT KEY (IdTrivial, IdTeacher)
func ScanSelfaccessTrivial ¶
func ScanSelfaccessTrivial(row *sql.Row) (SelfaccessTrivial, error)
func (SelfaccessTrivial) Delete ¶
func (item SelfaccessTrivial) Delete(tx DB) error
Delete the link SelfaccessTrivial from the database. Only the foreign keys IdClassroom, IdTrivial, IdTeacher fields are used in 'item'.
type SelfaccessTrivials ¶
type SelfaccessTrivials []SelfaccessTrivial
func DeleteSelfaccessTrivialsByIdClassrooms ¶
func DeleteSelfaccessTrivialsByIdClassrooms(tx DB, idClassrooms_ ...teacher.IdClassroom) (SelfaccessTrivials, error)
func DeleteSelfaccessTrivialsByIdTeachers ¶
func DeleteSelfaccessTrivialsByIdTeachers(tx DB, idTeachers_ ...teacher.IdTeacher) (SelfaccessTrivials, error)
func DeleteSelfaccessTrivialsByIdTrivialAndIdTeacher ¶
func DeleteSelfaccessTrivialsByIdTrivialAndIdTeacher(tx DB, idTrivial IdTrivial, idTeacher teacher.IdTeacher) (item SelfaccessTrivials, err error)
DeleteSelfaccessTrivialsByIdTrivialAndIdTeacher deletes the item matching the given fields, returning the deleted items.
func DeleteSelfaccessTrivialsByIdTrivials ¶
func DeleteSelfaccessTrivialsByIdTrivials(tx DB, idTrivials_ ...IdTrivial) (SelfaccessTrivials, error)
func ScanSelfaccessTrivials ¶
func ScanSelfaccessTrivials(rs *sql.Rows) (SelfaccessTrivials, error)
func SelectAllSelfaccessTrivials ¶
func SelectAllSelfaccessTrivials(db DB) (SelfaccessTrivials, error)
SelectAll returns all the items in the selfaccess_trivials table.
func SelectSelfaccessTrivialsByIdClassrooms ¶
func SelectSelfaccessTrivialsByIdClassrooms(tx DB, idClassrooms_ ...teacher.IdClassroom) (SelfaccessTrivials, error)
func SelectSelfaccessTrivialsByIdTeachers ¶
func SelectSelfaccessTrivialsByIdTeachers(tx DB, idTeachers_ ...teacher.IdTeacher) (SelfaccessTrivials, error)
func SelectSelfaccessTrivialsByIdTrivialAndIdTeacher ¶
func SelectSelfaccessTrivialsByIdTrivialAndIdTeacher(tx DB, idTrivial IdTrivial, idTeacher teacher.IdTeacher) (item SelfaccessTrivials, err error)
SelectSelfaccessTrivialsByIdTrivialAndIdTeacher selects the items matching the given fields.
func SelectSelfaccessTrivialsByIdTrivials ¶
func SelectSelfaccessTrivialsByIdTrivials(tx DB, idTrivials_ ...IdTrivial) (SelfaccessTrivials, error)
func (SelfaccessTrivials) ByIdClassroom ¶
func (items SelfaccessTrivials) ByIdClassroom() map[teacher.IdClassroom]SelfaccessTrivials
ByIdClassroom returns a map with 'IdClassroom' as keys.
func (SelfaccessTrivials) ByIdTeacher ¶
func (items SelfaccessTrivials) ByIdTeacher() map[teacher.IdTeacher]SelfaccessTrivials
ByIdTeacher returns a map with 'IdTeacher' as keys.
func (SelfaccessTrivials) ByIdTrivial ¶
func (items SelfaccessTrivials) ByIdTrivial() map[IdTrivial]SelfaccessTrivials
ByIdTrivial returns a map with 'IdTrivial' as keys.
func (SelfaccessTrivials) IdClassrooms ¶
func (items SelfaccessTrivials) IdClassrooms() []teacher.IdClassroom
IdClassrooms returns the list of ids of IdClassroom contained in this link table. They are not garanteed to be distinct.
func (SelfaccessTrivials) IdTeachers ¶
func (items SelfaccessTrivials) IdTeachers() []teacher.IdTeacher
IdTeachers returns the list of ids of IdTeacher contained in this link table. They are not garanteed to be distinct.
func (SelfaccessTrivials) IdTrivials ¶
func (items SelfaccessTrivials) IdTrivials() []IdTrivial
IdTrivials returns the list of ids of IdTrivial contained in this link table. They are not garanteed to be distinct.
type Trivial ¶
type Trivial struct { Id IdTrivial Questions CategoriesQuestions QuestionTimeout int // in seconds ShowDecrassage bool Public bool IdTeacher teacher.IdTeacher Name string }
Trivial is a trivial game configuration stored in the DB, one per activity.
func DeleteTrivialById ¶
Deletes the Trivial and returns the item
func SelectTrivial ¶
SelectTrivial returns the entry matching 'id'.
type Trivials ¶
func SelectAllTrivials ¶
SelectAll returns all the items in the trivials table.
func SelectTrivials ¶
SelectTrivials returns the entry matching the given 'ids'.
func (Trivials) ByIdTeacher ¶
ByIdTeacher returns a map with 'IdTeacher' as keys.
func (Trivials) IdTeachers ¶
IdTeachers returns the list of ids of IdTeacher contained in this table. They are not garanteed to be distinct.