test

package
v0.0.0-...-7625c6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteExercicesByIDs

func DeleteExercicesByIDs(tx DB, ids ...int64) ([]int64, error)

Deletes the Exercice in the database and returns the ids.

func DeleteQuestionsByIDs

func DeleteQuestionsByIDs(tx DB, ids ...int64) ([]int64, error)

Deletes the Question in the database and returns the ids.

func DeleteQuestionsByNeedExercices

func DeleteQuestionsByNeedExercices(tx DB, needExercices_ ...int64) ([]int64, error)

func DeleteTable1sByEx1s

func DeleteTable1sByEx1s(tx DB, ex1s_ ...RepasID) ([]int64, error)

func DeleteTable1sByEx2s

func DeleteTable1sByEx2s(tx DB, ex2s_ ...RepasID) ([]int64, error)

func DeleteTable1sByIDs

func DeleteTable1sByIDs(tx DB, ids ...int64) ([]int64, error)

Deletes the Table1 in the database and returns the ids.

func DeleteTable1sByLs

func DeleteTable1sByLs(tx DB, ls_ ...int64) ([]int64, error)

func DeleteTable1sByOthers

func DeleteTable1sByOthers(tx DB, others_ ...RepasID) ([]int64, error)

func DeleteWithOptionalTimesByIDs

func DeleteWithOptionalTimesByIDs(tx DB, ids ...int64) ([]int64, error)

Deletes the WithOptionalTime in the database and returns the ids.

func IdExerciceArrayToPQ

func IdExerciceArrayToPQ(ids []IdExercice) pq.Int64Array

func IdProgressionArrayToPQ

func IdProgressionArrayToPQ(ids []IdProgression) pq.Int64Array

func InsertExerciceQuestion

func InsertExerciceQuestion(db DB, item ExerciceQuestion) error
func InsertLink(db DB, item Link) error

func InsertManyExerciceQuestions

func InsertManyExerciceQuestions(tx *sql.Tx, items ...ExerciceQuestion) error

Insert the links ExerciceQuestion in the database. It is a no-op if 'items' is empty.

func InsertManyLinks(tx *sql.Tx, items ...Link) error

Insert the links Link in the database. It is a no-op if 'items' is empty.

func InsertManyProgressionQuestions

func InsertManyProgressionQuestions(tx *sql.Tx, items ...ProgressionQuestion) error

Insert the links ProgressionQuestion in the database. It is a no-op if 'items' is empty.

func InsertManyQuestionTags

func InsertManyQuestionTags(tx *sql.Tx, items ...QuestionTag) error

Insert the links QuestionTag in the database. It is a no-op if 'items' is empty.

func InsertProgressionQuestion

func InsertProgressionQuestion(db DB, item ProgressionQuestion) error

func InsertQuestionTag

func InsertQuestionTag(db DB, item QuestionTag) error

func Newint64SetFrom

func Newint64SetFrom(ids []int64) int64Set

func RepasIDArrayToPQ

func RepasIDArrayToPQ(ids []RepasID) pq.Int64Array

func Scanint64Array

func Scanint64Array(rs *sql.Rows) ([]int64, error)

Scanint64Array scans the result of a query returning a list of ID's.

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 DifficultyTag

type DifficultyTag string

DifficultyTag are special question tags used to indicate the difficulty of one question. It is used to select question among implicit groups

type EnumArray

type EnumArray []testsource.EnumUInt

func (*EnumArray) Scan

func (s *EnumArray) Scan(src interface{}) error

func (EnumArray) Value

func (s EnumArray) Value() (driver.Value, error)

type Exercice

type Exercice struct {
	Id          int64
	Title       string // displayed to the students
	Description string // used internally by the teachers
	// Parameters are parameters shared by all the questions,
	// which are added to the individual ones.
	// It will be empty for parallel exercices
	Parameters Map
	Flow       testsource.EnumInt
	// IdTeacher is the owner of the exercice
	IdTeacher int64 `json:"id_teacher"`
	Public    bool
}

Exercice is the data structure for a full exercice, composed of a list of questions. There are two kinds of exercice :

  • parallel : all the questions are independant
  • progression : the questions are linked together by a shared Parameters set

func DeleteExerciceById

func DeleteExerciceById(tx DB, id int64) (Exercice, error)

Deletes the Exercice and returns the item

func ScanExercice

func ScanExercice(row *sql.Row) (Exercice, error)

func SelectExercice

func SelectExercice(tx DB, id int64) (Exercice, error)

SelectExercice returns the entry matching 'id'.

func (Exercice) Insert

func (item Exercice) Insert(tx DB) (out Exercice, err error)

Insert one Exercice in the database and returns the item with id filled.

func (Exercice) Update

func (item Exercice) Update(tx DB) (out Exercice, err error)

Update Exercice in the database and returns the new version.

type ExerciceQuestion

type ExerciceQuestion struct {
	IdExercice int64 `json:"id_exercice" gomacro-sql-foreign:"Exercice" gomacro-sql-on-delete:"CASCADE"`
	IdQuestion int64 `json:"id_question" gomacro-sql-foreign:"Question"`
	Bareme     int16 `json:"bareme"`
	Index      int   `json:"-" sql:"index"`
}

ExerciceQuestion models an ordered list of questions. All link items should be updated at once to preserve `Index` invariants gomacro:SQL ADD PRIMARY KEY (IdExercice, Index) gomacro:SQL _SELECT KEY(IdQuestion, Bareme)

func ScanExerciceQuestion

func ScanExerciceQuestion(row *sql.Row) (ExerciceQuestion, error)

func SelectExerciceQuestionByIdExerciceAndIndex

func SelectExerciceQuestionByIdExerciceAndIndex(tx DB, idExercice int64, index int) (item ExerciceQuestion, found bool, err error)

SelectExerciceQuestionByIdExerciceAndIndex return zero or one item, thanks to a UNIQUE SQL constraint.

func (ExerciceQuestion) Delete

func (item ExerciceQuestion) Delete(tx DB) error

Delete the link ExerciceQuestion from the database. Only the foreign keys IdExercice, IdQuestion fields are used in 'item'.

type ExerciceQuestions

type ExerciceQuestions []ExerciceQuestion

func DeleteExerciceQuestionsByIdExercices

func DeleteExerciceQuestionsByIdExercices(tx DB, idExercices_ ...int64) (ExerciceQuestions, error)

func DeleteExerciceQuestionsByIdQuestionAndBareme

func DeleteExerciceQuestionsByIdQuestionAndBareme(tx DB, idQuestion int64, bareme int16) (item ExerciceQuestions, err error)

DeleteExerciceQuestionsByIdQuestionAndBareme deletes the item matching the given fields, returning the deleted items.

func DeleteExerciceQuestionsByIdQuestions

func DeleteExerciceQuestionsByIdQuestions(tx DB, idQuestions_ ...int64) (ExerciceQuestions, error)

func ScanExerciceQuestions

func ScanExerciceQuestions(rs *sql.Rows) (ExerciceQuestions, error)

func SelectAllExerciceQuestions

func SelectAllExerciceQuestions(db DB) (ExerciceQuestions, error)

SelectAll returns all the items in the exercice_questions table.

func SelectExerciceQuestionsByIdExercices

func SelectExerciceQuestionsByIdExercices(tx DB, idExercices_ ...int64) (ExerciceQuestions, error)

func SelectExerciceQuestionsByIdQuestionAndBareme

func SelectExerciceQuestionsByIdQuestionAndBareme(tx DB, idQuestion int64, bareme int16) (item ExerciceQuestions, err error)

SelectExerciceQuestionsByIdQuestionAndBareme selects the items matching the given fields.

func SelectExerciceQuestionsByIdQuestions

func SelectExerciceQuestionsByIdQuestions(tx DB, idQuestions_ ...int64) (ExerciceQuestions, error)

func (ExerciceQuestions) ByIdExercice

func (items ExerciceQuestions) ByIdExercice() map[int64]ExerciceQuestions

ByIdExercice returns a map with 'IdExercice' as keys.

func (ExerciceQuestions) ByIdQuestion

func (items ExerciceQuestions) ByIdQuestion() map[int64]ExerciceQuestions

ByIdQuestion returns a map with 'IdQuestion' as keys.

func (ExerciceQuestions) IdExercices

func (items ExerciceQuestions) IdExercices() []int64

IdExercices returns the list of ids of IdExercice contained in this link table. They are not garanteed to be distinct.

func (ExerciceQuestions) IdQuestions

func (items ExerciceQuestions) IdQuestions() []int64

IdQuestions returns the list of ids of IdQuestion contained in this link table. They are not garanteed to be distinct.

type Exercices

type Exercices map[int64]Exercice

func ScanExercices

func ScanExercices(rs *sql.Rows) (Exercices, error)

func SelectAllExercices

func SelectAllExercices(db DB) (Exercices, error)

SelectAll returns all the items in the exercices table.

func SelectExercices

func SelectExercices(tx DB, ids ...int64) (Exercices, error)

SelectExercices returns the entry matching the given 'ids'.

func (Exercices) IDs

func (m Exercices) IDs() []int64

type FixedArray

type FixedArray [5]int32

func (*FixedArray) Scan

func (s *FixedArray) Scan(src interface{}) error

func (FixedArray) Value

func (s FixedArray) Value() (driver.Value, error)

type IDInvalid

type IDInvalid string

type IdExercice

type IdExercice int64

func ScanIdExerciceArray

func ScanIdExerciceArray(rs *sql.Rows) ([]IdExercice, error)

ScanIdExerciceArray scans the result of a query returning a list of ID's.

type IdExerciceSet

type IdExerciceSet map[IdExercice]bool

func NewIdExerciceSetFrom

func NewIdExerciceSetFrom(ids []IdExercice) IdExerciceSet

func (IdExerciceSet) Add

func (s IdExerciceSet) Add(id IdExercice)

func (IdExerciceSet) Has

func (s IdExerciceSet) Has(id IdExercice) bool

func (IdExerciceSet) Keys

func (s IdExerciceSet) Keys() []IdExercice

type IdProgression

type IdProgression int64

func DeleteProgressionsByIDs

func DeleteProgressionsByIDs(tx DB, ids ...IdProgression) ([]IdProgression, error)

Deletes the Progression in the database and returns the ids.

func ScanIdProgressionArray

func ScanIdProgressionArray(rs *sql.Rows) ([]IdProgression, error)

ScanIdProgressionArray scans the result of a query returning a list of ID's.

type IdProgressionSet

type IdProgressionSet map[IdProgression]bool

func NewIdProgressionSetFrom

func NewIdProgressionSetFrom(ids []IdProgression) IdProgressionSet

func (IdProgressionSet) Add

func (s IdProgressionSet) Add(id IdProgression)

func (IdProgressionSet) Has

func (IdProgressionSet) Keys

func (s IdProgressionSet) Keys() []IdProgression
type Link struct {
	Repas    RepasID
	IdTable1 int64
}
func ScanLink(row *sql.Row) (Link, error)

func (Link) Delete

func (item Link) Delete(tx DB) error

Delete the link Link from the database. Only the foreign keys Repas fields are used in 'item'.

type Links []Link

func DeleteLinksByRepass

func DeleteLinksByRepass(tx DB, repass_ ...RepasID) (Links, error)
func ScanLinks(rs *sql.Rows) (Links, error)
func SelectAllLinks(db DB) (Links, error)

SelectAll returns all the items in the links table.

func SelectLinksByRepass

func SelectLinksByRepass(tx DB, repass_ ...RepasID) (Links, error)

func (Links) ByRepas

func (items Links) ByRepas() map[RepasID]Links

ByRepas returns a map with 'Repas' as keys.

func (Links) Repass

func (items Links) Repass() []RepasID

Repass returns the list of ids of Repas contained in this link table. They are not garanteed to be distinct.

type LocalEnum

type LocalEnum uint8
const (
	A LocalEnum = iota
	B
)

type Map

type Map map[string]bool

func (*Map) Scan

func (s *Map) Scan(src interface{}) error

func (Map) Value

func (s Map) Value() (driver.Value, error)

type Progression

type Progression struct {
	Id         IdProgression
	IdExercice int64 `json:"id_exercice" gomacro-sql-on-delete:"CASCADE"`
}

Progression is the table storing the student progression for one exercice. Note that this data structure may also be used in memory, for instance for the editor loopback. gomacro:SQL ADD UNIQUE(Id, IdExercice)

func DeleteProgressionById

func DeleteProgressionById(tx DB, id IdProgression) (Progression, error)

Deletes the Progression and returns the item

func ScanProgression

func ScanProgression(row *sql.Row) (Progression, error)

func SelectProgression

func SelectProgression(tx DB, id IdProgression) (Progression, error)

SelectProgression returns the entry matching 'id'.

func SelectProgressionByIdAndIdExercice

func SelectProgressionByIdAndIdExercice(tx DB, id IdProgression, idExercice int64) (item Progression, found bool, err error)

SelectProgressionByIdAndIdExercice return zero or one item, thanks to a UNIQUE SQL constraint.

func (Progression) Insert

func (item Progression) Insert(tx DB) (out Progression, err error)

Insert one Progression in the database and returns the item with id filled.

func (Progression) Update

func (item Progression) Update(tx DB) (out Progression, err error)

Update Progression in the database and returns the new version.

type ProgressionQuestion

type ProgressionQuestion struct {
	IdProgression IdProgression `json:"id_progression" gomacro-sql-on-delete:"CASCADE"`
	IdExercice    IdExercice    `json:"id_exercice" gomacro-sql-on-delete:"CASCADE"`
	Index         int           `json:"index"` // in the question list
	History       EnumArray     `json:"history"`
}

We enforce consistency with the additional `id_exercice` field gomacro:SQL ADD UNIQUE(IdProgression, Index) gomacro:SQL ADD FOREIGN KEY (IdExercice, Index) REFERENCES exercice_questions ON DELETE CASCADE gomacro:SQL ADD FOREIGN KEY (IdProgression, IdExercice) REFERENCES progressions (Id, IdExercice) ON DELETE CASCADE

func ScanProgressionQuestion

func ScanProgressionQuestion(row *sql.Row) (ProgressionQuestion, error)

func SelectProgressionQuestionByIdProgressionAndIndex

func SelectProgressionQuestionByIdProgressionAndIndex(tx DB, idProgression IdProgression, index int) (item ProgressionQuestion, found bool, err error)

SelectProgressionQuestionByIdProgressionAndIndex return zero or one item, thanks to a UNIQUE SQL constraint.

func (ProgressionQuestion) Delete

func (item ProgressionQuestion) Delete(tx DB) error

Delete the link ProgressionQuestion from the database. Only the foreign keys IdProgression, IdExercice fields are used in 'item'.

type ProgressionQuestions

type ProgressionQuestions []ProgressionQuestion

func DeleteProgressionQuestionsByIdExercices

func DeleteProgressionQuestionsByIdExercices(tx DB, idExercices_ ...IdExercice) (ProgressionQuestions, error)

func DeleteProgressionQuestionsByIdProgressions

func DeleteProgressionQuestionsByIdProgressions(tx DB, idProgressions_ ...IdProgression) (ProgressionQuestions, error)

func ScanProgressionQuestions

func ScanProgressionQuestions(rs *sql.Rows) (ProgressionQuestions, error)

func SelectAllProgressionQuestions

func SelectAllProgressionQuestions(db DB) (ProgressionQuestions, error)

SelectAll returns all the items in the progression_questions table.

func SelectProgressionQuestionsByIdExercices

func SelectProgressionQuestionsByIdExercices(tx DB, idExercices_ ...IdExercice) (ProgressionQuestions, error)

func SelectProgressionQuestionsByIdProgressions

func SelectProgressionQuestionsByIdProgressions(tx DB, idProgressions_ ...IdProgression) (ProgressionQuestions, error)

func (ProgressionQuestions) ByIdExercice

func (items ProgressionQuestions) ByIdExercice() map[IdExercice]ProgressionQuestions

ByIdExercice returns a map with 'IdExercice' as keys.

func (ProgressionQuestions) ByIdProgression

func (items ProgressionQuestions) ByIdProgression() map[IdProgression]ProgressionQuestions

ByIdProgression returns a map with 'IdProgression' as keys.

func (ProgressionQuestions) IdExercices

func (items ProgressionQuestions) IdExercices() []IdExercice

IdExercices returns the list of ids of IdExercice contained in this link table. They are not garanteed to be distinct.

func (ProgressionQuestions) IdProgressions

func (items ProgressionQuestions) IdProgressions() []IdProgression

IdProgressions returns the list of ids of IdProgression contained in this link table. They are not garanteed to be distinct.

type Progressions

type Progressions map[IdProgression]Progression

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 SelectProgressions

func SelectProgressions(tx DB, ids ...IdProgression) (Progressions, error)

SelectProgressions returns the entry matching the given 'ids'.

func (Progressions) IDs

func (m Progressions) IDs() []IdProgression

type Question

type Question struct {
	Id          int64                    `json:"id"`
	Page        testsource.ComplexStruct `json:"page"`
	Public      bool                     `json:"public"` // in practice only true for admins
	IdTeacher   int64                    `json:"id_teacher"`
	Description string                   `json:"description"`
	// NeedExercice is not null if the question cannot be instantiated (or edited)
	// on its own
	NeedExercice sql.NullInt64 `json:"need_exercice" gomacro-sql-foreign:"Exercice"`
}

Question is a standalone question, used for instance in games.

func DeleteQuestionById

func DeleteQuestionById(tx DB, id int64) (Question, error)

Deletes the Question and returns the item

func ScanQuestion

func ScanQuestion(row *sql.Row) (Question, error)

func SelectQuestion

func SelectQuestion(tx DB, id int64) (Question, error)

SelectQuestion returns the entry matching 'id'.

func (Question) Insert

func (item Question) Insert(tx DB) (out Question, err error)

Insert one Question in the database and returns the item with id filled.

func (Question) Update

func (item Question) Update(tx DB) (out Question, err error)

Update Question in the database and returns the new version.

type QuestionTag

type QuestionTag struct {
	Tag        string `json:"tag"`
	IdQuestion int64  ` gomacro-sql-foreign:"Question" gomacro-sql-on-delete:"CASCADE" json:"id_question"`
}

gomacro:SQL ADD UNIQUE(IdQuestion, Tag) gomacro:SQL CREATE UNIQUE INDEX index_name ON QuestionTag (Tag)

func ScanQuestionTag

func ScanQuestionTag(row *sql.Row) (QuestionTag, error)

func SelectQuestionTagByIdQuestionAndTag

func SelectQuestionTagByIdQuestionAndTag(tx DB, idQuestion int64, tag string) (item QuestionTag, found bool, err error)

SelectQuestionTagByIdQuestionAndTag return zero or one item, thanks to a UNIQUE SQL constraint.

func (QuestionTag) Delete

func (item QuestionTag) Delete(tx DB) error

Delete the link QuestionTag from the database. Only the foreign keys IdQuestion fields are used in 'item'.

type QuestionTags

type QuestionTags []QuestionTag

func DeleteQuestionTagsByIdQuestions

func DeleteQuestionTagsByIdQuestions(tx DB, idQuestions_ ...int64) (QuestionTags, error)

func ScanQuestionTags

func ScanQuestionTags(rs *sql.Rows) (QuestionTags, error)

func SelectAllQuestionTags

func SelectAllQuestionTags(db DB) (QuestionTags, error)

SelectAll returns all the items in the question_tags table.

func SelectQuestionTagsByIdQuestions

func SelectQuestionTagsByIdQuestions(tx DB, idQuestions_ ...int64) (QuestionTags, error)

func (QuestionTags) ByIdQuestion

func (items QuestionTags) ByIdQuestion() map[int64]QuestionTags

ByIdQuestion returns a map with 'IdQuestion' as keys.

func (QuestionTags) IdQuestions

func (items QuestionTags) IdQuestions() []int64

IdQuestions returns the list of ids of IdQuestion contained in this link table. They are not garanteed to be distinct.

type Questions

type Questions map[int64]Question

func ScanQuestions

func ScanQuestions(rs *sql.Rows) (Questions, error)

func SelectAllQuestions

func SelectAllQuestions(db DB) (Questions, error)

SelectAll returns all the items in the questions table.

func SelectQuestions

func SelectQuestions(tx DB, ids ...int64) (Questions, error)

SelectQuestions returns the entry matching the given 'ids'.

func SelectQuestionsByNeedExercices

func SelectQuestionsByNeedExercices(tx DB, needExercices_ ...int64) (Questions, error)

func (Questions) IDs

func (m Questions) IDs() []int64

type Repas

type Repas struct {
	Order string
	Id    RepasID
	V     LocalEnum
}

gomacro:SQL ADD CHECK (V = #[LocalEnum.A] OR V = #[LocalEnum.B])

func DeleteRepasById

func DeleteRepasById(tx DB, id RepasID) (Repas, error)

Deletes the Repas and returns the item

func ScanRepas

func ScanRepas(row *sql.Row) (Repas, error)

func SelectRepas

func SelectRepas(tx DB, id RepasID) (Repas, error)

SelectRepas returns the entry matching 'id'.

func (Repas) Insert

func (item Repas) Insert(tx DB) (out Repas, err error)

Insert one Repas in the database and returns the item with id filled.

func (Repas) Update

func (item Repas) Update(tx DB) (out Repas, err error)

Update Repas in the database and returns the new version.

type RepasID

type RepasID int64

func DeleteRepassByIDs

func DeleteRepassByIDs(tx DB, ids ...RepasID) ([]RepasID, error)

Deletes the Repas in the database and returns the ids.

func ScanRepasIDArray

func ScanRepasIDArray(rs *sql.Rows) ([]RepasID, error)

ScanRepasIDArray scans the result of a query returning a list of ID's.

type RepasIDSet

type RepasIDSet map[RepasID]bool

func NewRepasIDSetFrom

func NewRepasIDSetFrom(ids []RepasID) RepasIDSet

func (RepasIDSet) Add

func (s RepasIDSet) Add(id RepasID)

func (RepasIDSet) Has

func (s RepasIDSet) Has(id RepasID) bool

func (RepasIDSet) Keys

func (s RepasIDSet) Keys() []RepasID

type Repass

type Repass map[RepasID]Repas

func ScanRepass

func ScanRepass(rs *sql.Rows) (Repass, error)

func SelectAllRepass

func SelectAllRepass(db DB) (Repass, error)

SelectAll returns all the items in the repass table.

func SelectRepass

func SelectRepass(tx DB, ids ...RepasID) (Repass, error)

SelectRepass returns the entry matching the given 'ids'.

func (Repass) IDs

func (m Repass) IDs() []RepasID

type Table1

type Table1 struct {
	Id    int64
	Ex1   RepasID
	Ex2   RepasID
	L     sql.NullInt64 `gomacro-sql-foreign:"Link"`
	Other optionalID    `gomacro-sql-foreign:"Repas"`
	F     FixedArray
}

func DeleteTable1ById

func DeleteTable1ById(tx DB, id int64) (Table1, error)

Deletes the Table1 and returns the item

func ScanTable1

func ScanTable1(row *sql.Row) (Table1, error)

func SelectTable1

func SelectTable1(tx DB, id int64) (Table1, error)

SelectTable1 returns the entry matching 'id'.

func (Table1) Insert

func (item Table1) Insert(tx DB) (out Table1, err error)

Insert one Table1 in the database and returns the item with id filled.

func (Table1) Update

func (item Table1) Update(tx DB) (out Table1, err error)

Update Table1 in the database and returns the new version.

type Table1s

type Table1s map[int64]Table1

func ScanTable1s

func ScanTable1s(rs *sql.Rows) (Table1s, error)

func SelectAllTable1s

func SelectAllTable1s(db DB) (Table1s, error)

SelectAll returns all the items in the table1s table.

func SelectTable1s

func SelectTable1s(tx DB, ids ...int64) (Table1s, error)

SelectTable1s returns the entry matching the given 'ids'.

func SelectTable1sByEx1s

func SelectTable1sByEx1s(tx DB, ex1s_ ...RepasID) (Table1s, error)

func SelectTable1sByEx2s

func SelectTable1sByEx2s(tx DB, ex2s_ ...RepasID) (Table1s, error)

func SelectTable1sByLs

func SelectTable1sByLs(tx DB, ls_ ...int64) (Table1s, error)

func SelectTable1sByOthers

func SelectTable1sByOthers(tx DB, others_ ...RepasID) (Table1s, error)

func (Table1s) ByEx1

func (items Table1s) ByEx1() map[RepasID]Table1s

ByEx1 returns a map with 'Ex1' as keys.

func (Table1s) ByEx2

func (items Table1s) ByEx2() map[RepasID]Table1s

ByEx2 returns a map with 'Ex2' as keys.

func (Table1s) Ex1s

func (items Table1s) Ex1s() []RepasID

Ex1s returns the list of ids of Ex1 contained in this table. They are not garanteed to be distinct.

func (Table1s) Ex2s

func (items Table1s) Ex2s() []RepasID

Ex2s returns the list of ids of Ex2 contained in this table. They are not garanteed to be distinct.

func (Table1s) IDs

func (m Table1s) IDs() []int64

type WithOptionalTime

type WithOptionalTime struct {
	Id         int64
	Deadine    time.Time
	DeadineOpt sql.NullTime
}

func DeleteWithOptionalTimeById

func DeleteWithOptionalTimeById(tx DB, id int64) (WithOptionalTime, error)

Deletes the WithOptionalTime and returns the item

func ScanWithOptionalTime

func ScanWithOptionalTime(row *sql.Row) (WithOptionalTime, error)

func SelectWithOptionalTime

func SelectWithOptionalTime(tx DB, id int64) (WithOptionalTime, error)

SelectWithOptionalTime returns the entry matching 'id'.

func (WithOptionalTime) Insert

func (item WithOptionalTime) Insert(tx DB) (out WithOptionalTime, err error)

Insert one WithOptionalTime in the database and returns the item with id filled.

func (WithOptionalTime) Update

func (item WithOptionalTime) Update(tx DB) (out WithOptionalTime, err error)

Update WithOptionalTime in the database and returns the new version.

type WithOptionalTimes

type WithOptionalTimes map[int64]WithOptionalTime

func ScanWithOptionalTimes

func ScanWithOptionalTimes(rs *sql.Rows) (WithOptionalTimes, error)

func SelectAllWithOptionalTimes

func SelectAllWithOptionalTimes(db DB) (WithOptionalTimes, error)

SelectAll returns all the items in the with_optional_times table.

func SelectWithOptionalTimes

func SelectWithOptionalTimes(tx DB, ids ...int64) (WithOptionalTimes, error)

SelectWithOptionalTimes returns the entry matching the given 'ids'.

func (WithOptionalTimes) IDs

func (m WithOptionalTimes) IDs() []int64

Directories

Path Synopsis
Package pq is used as replacement for "github.com/lib/pq" in tests
Package pq is used as replacement for "github.com/lib/pq" in tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL