Documentation ¶
Index ¶
- Constants
- func IdBeltquestionArrayToPQ(ids []IdBeltquestion) pq.Int64Array
- func InsertBeltevolution(db DB, item Beltevolution) error
- func InsertManyBeltevolutions(tx *sql.Tx, items ...Beltevolution) error
- type Advance
- type Beltevolution
- type Beltevolutions
- func DeleteBeltevolutionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Beltevolutions, error)
- func ScanBeltevolutions(rs *sql.Rows) (Beltevolutions, error)
- func SelectAllBeltevolutions(db DB) (Beltevolutions, error)
- func SelectBeltevolutionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Beltevolutions, error)
- type Beltquestion
- type Beltquestions
- func DeleteBeltquestionsByDomainAndRank(tx DB, domain Domain, rank Rank) (item Beltquestions, err error)
- func ScanBeltquestions(rs *sql.Rows) (Beltquestions, error)
- func SelectAllBeltquestions(db DB) (Beltquestions, error)
- func SelectBeltquestions(tx DB, ids ...IdBeltquestion) (Beltquestions, error)
- func SelectBeltquestionsByDomainAndRank(tx DB, domain Domain, rank Rank) (item Beltquestions, err error)
- type DB
- type Domain
- type IdBeltquestion
- type IdBeltquestionSet
- type Level
- type Rank
- type Stat
- type Stats
Constants ¶
const ( NbDomains = Matrices + 1 // gomacro:no-enum NbRanks = Noire + 1 // gomacro:no-enum )
Variables ¶
This section is empty.
Functions ¶
func IdBeltquestionArrayToPQ ¶
func IdBeltquestionArrayToPQ(ids []IdBeltquestion) pq.Int64Array
func InsertBeltevolution ¶
func InsertBeltevolution(db DB, item Beltevolution) error
func InsertManyBeltevolutions ¶
func InsertManyBeltevolutions(tx *sql.Tx, items ...Beltevolution) error
Insert the links Beltevolution in the database. It is a no-op if 'items' is empty.
Types ¶
type Beltevolution ¶
Beltevolution is the evolution of one student in a belt scheme.
gomacro:SQL ADD UNIQUE(IdStudent)
func ScanBeltevolution ¶
func ScanBeltevolution(row *sql.Row) (Beltevolution, error)
func SelectBeltevolutionByIdStudent ¶
func SelectBeltevolutionByIdStudent(tx DB, idStudent teacher.IdStudent) (item Beltevolution, found bool, err error)
SelectBeltevolutionByIdStudent return zero or one item, thanks to a UNIQUE SQL constraint.
func (Beltevolution) Delete ¶
func (item Beltevolution) Delete(tx DB) error
Delete the link Beltevolution from the database. Only the foreign keys IdStudent fields are used in 'item'.
type Beltevolutions ¶
type Beltevolutions []Beltevolution
func DeleteBeltevolutionsByIdStudents ¶
func DeleteBeltevolutionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Beltevolutions, error)
func ScanBeltevolutions ¶
func ScanBeltevolutions(rs *sql.Rows) (Beltevolutions, error)
func SelectAllBeltevolutions ¶
func SelectAllBeltevolutions(db DB) (Beltevolutions, error)
SelectAll returns all the items in the beltevolutions table.
func SelectBeltevolutionsByIdStudents ¶
func SelectBeltevolutionsByIdStudents(tx DB, idStudents_ ...teacher.IdStudent) (Beltevolutions, error)
func (Beltevolutions) ByIdStudent ¶
func (items Beltevolutions) ByIdStudent() map[teacher.IdStudent]Beltevolution
ByIdStudent returns a map with 'IdStudent' as keys.
func (Beltevolutions) IdStudents ¶
func (items Beltevolutions) IdStudents() []teacher.IdStudent
IdStudents returns the list of ids of IdStudent contained in this link table. They are not garanteed to be distinct.
type Beltquestion ¶
type Beltquestion struct { Id IdBeltquestion Domain Domain // Location Rank Rank // Location Parameters questions.Parameters Enonce questions.Enonce // Correction an optional content describing the expected solution, // to be instantiated with the same parameters as [Enonce] Correction questions.Enonce // Repeat is the number of times the question is proposed, // defaulting to 1 Repeat int }
Beltquestion is one question, contained in a domain and color.
gomacro:SQL _SELECT KEY(Domain, Rank) gomacro:SQL ADD CHECK(Repeat > 0)
func DeleteBeltquestionById ¶
func DeleteBeltquestionById(tx DB, id IdBeltquestion) (Beltquestion, error)
Deletes the Beltquestion and returns the item
func ScanBeltquestion ¶
func ScanBeltquestion(row *sql.Row) (Beltquestion, error)
func SelectBeltquestion ¶
func SelectBeltquestion(tx DB, id IdBeltquestion) (Beltquestion, error)
SelectBeltquestion returns the entry matching 'id'.
func (Beltquestion) Insert ¶
func (item Beltquestion) Insert(tx DB) (out Beltquestion, err error)
Insert one Beltquestion in the database and returns the item with id filled.
func (Beltquestion) Page ¶
func (qu Beltquestion) Page() questions.QuestionPage
func (Beltquestion) Update ¶
func (item Beltquestion) Update(tx DB) (out Beltquestion, err error)
Update Beltquestion in the database and returns the new version.
type Beltquestions ¶
type Beltquestions map[IdBeltquestion]Beltquestion
func DeleteBeltquestionsByDomainAndRank ¶
func DeleteBeltquestionsByDomainAndRank(tx DB, domain Domain, rank Rank) (item Beltquestions, err error)
DeleteBeltquestionsByDomainAndRank deletes the item matching the given fields, returning the deleted items.
func ScanBeltquestions ¶
func ScanBeltquestions(rs *sql.Rows) (Beltquestions, error)
func SelectAllBeltquestions ¶
func SelectAllBeltquestions(db DB) (Beltquestions, error)
SelectAll returns all the items in the beltquestions table.
func SelectBeltquestions ¶
func SelectBeltquestions(tx DB, ids ...IdBeltquestion) (Beltquestions, error)
SelectBeltquestions returns the entry matching the given 'ids'.
func SelectBeltquestionsByDomainAndRank ¶
func SelectBeltquestionsByDomainAndRank(tx DB, domain Domain, rank Rank) (item Beltquestions, err error)
SelectBeltquestionsByDomainAndRank selects the items matching the given fields.
func (Beltquestions) IDs ¶
func (m Beltquestions) IDs() []IdBeltquestion
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 Domain ¶
type Domain uint8
Domain is a sub topic, like "Calcul littéral", "Calcul mental".
For now, we only support one scheme in maths.
const ( CalculMentalI Domain = iota // Calcul mental I CalculMentalII // Calcul mental II Puissances // Puissances et racines Fractions // Fractions Reduction // Réduction Factorisation // Factorisation Developpement // Développement IsolerVariable // Isoler une variable Equations // Équations Inequations // Inéquations Derivation // Dérivation Matrices // Matrices et systèmes )
type IdBeltquestion ¶
type IdBeltquestion int64
func DeleteBeltquestionsByIDs ¶
func DeleteBeltquestionsByIDs(tx DB, ids ...IdBeltquestion) ([]IdBeltquestion, error)
Deletes the Beltquestion in the database and returns the ids.
func ScanIdBeltquestionArray ¶
func ScanIdBeltquestionArray(rs *sql.Rows) ([]IdBeltquestion, error)
ScanIdBeltquestionArray scans the result of a query returning a list of ID's.
type IdBeltquestionSet ¶
type IdBeltquestionSet map[IdBeltquestion]bool
func NewIdBeltquestionSetFrom ¶
func NewIdBeltquestionSetFrom(ids []IdBeltquestion) IdBeltquestionSet
func (IdBeltquestionSet) Add ¶
func (s IdBeltquestionSet) Add(id IdBeltquestion)
func (IdBeltquestionSet) Has ¶
func (s IdBeltquestionSet) Has(id IdBeltquestion) bool
func (IdBeltquestionSet) Keys ¶
func (s IdBeltquestionSet) Keys() []IdBeltquestion