Documentation
¶
Overview ¶
Définit la structure de la base de données.
Index ¶
- func ConnectDB(credences logs.SQL) (*sql.DB, error)
- func InsertManyCommandeProduits(tx *sql.Tx, items ...CommandeProduit) error
- func InsertManyDefautProduits(tx *sql.Tx, items ...DefautProduit) error
- func InsertManyIngredientProduits(tx *sql.Tx, items ...IngredientProduit) error
- func InsertManyLienIngredients(tx *sql.Tx, items ...LienIngredient) error
- func InsertManyMenuIngredients(tx *sql.Tx, items ...MenuIngredient) error
- func InsertManyMenuRecettes(tx *sql.Tx, items ...MenuRecette) error
- func InsertManyRecetteIngredients(tx *sql.Tx, items ...RecetteIngredient) error
- func InsertManyRepasGroupes(tx *sql.Tx, items ...RepasGroupe) error
- func InsertManyRepasIngredients(tx *sql.Tx, items ...RepasIngredient) error
- func InsertManyRepasRecettes(tx *sql.Tx, items ...RepasRecette) error
- func InsertManySejourFournisseurs(tx *sql.Tx, items ...SejourFournisseur) error
- func InsertManyUtilisateurFournisseurs(tx *sql.Tx, items ...UtilisateurFournisseur) error
- func NullableId(id int64) sql.NullInt64
- func ScanIds(rs *sql.Rows) ([]int64, error)
- type Callories
- type Categorie
- type Commande
- type CommandeProduit
- type CommandeProduits
- func DeleteCommandeProduitsByIdCommandes(tx DB, idCommandes ...int64) (CommandeProduits, error)
- func DeleteCommandeProduitsByIdProduits(tx DB, idProduits ...int64) (CommandeProduits, error)
- func ScanCommandeProduits(rs *sql.Rows) (CommandeProduits, error)
- func SelectAllCommandeProduits(tx DB) (CommandeProduits, error)
- func SelectCommandeProduitsByIdCommandes(tx DB, idCommandes ...int64) (CommandeProduits, error)
- func SelectCommandeProduitsByIdProduits(tx DB, idProduits ...int64) (CommandeProduits, error)
- type Commandes
- type Conditionnement
- type DB
- type DefautProduit
- type DefautProduits
- func DeleteDefautProduitsByIdFournisseurs(tx DB, idFournisseurs ...int64) (DefautProduits, error)
- func DeleteDefautProduitsByIdIngredients(tx DB, idIngredients ...int64) (DefautProduits, error)
- func DeleteDefautProduitsByIdProduits(tx DB, idProduits ...int64) (DefautProduits, error)
- func DeleteDefautProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (DefautProduits, error)
- func ScanDefautProduits(rs *sql.Rows) (DefautProduits, error)
- func SelectAllDefautProduits(tx DB) (DefautProduits, error)
- func SelectDefautProduitsByIdFournisseurs(tx DB, idFournisseurs ...int64) (DefautProduits, error)
- func SelectDefautProduitsByIdIngredients(tx DB, idIngredients ...int64) (DefautProduits, error)
- func SelectDefautProduitsByIdProduits(tx DB, idProduits ...int64) (DefautProduits, error)
- func SelectDefautProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (DefautProduits, error)
- type Fournisseur
- type Fournisseurs
- type Groupe
- type Groupes
- type Horaire
- type Ids
- func DeleteCommandesByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (Ids, error)
- func DeleteCommandesByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteFournisseursByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteGroupesByIdSejours(tx DB, idSejours ...int64) (Ids, error)
- func DeleteGroupesByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteIngredientsByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteLivraisonsByIdFournisseurs(tx DB, idFournisseurs ...int64) (Ids, error)
- func DeleteLivraisonsByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteMenusByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (Ids, error)
- func DeleteMenusByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteProduitsByIdLivraisons(tx DB, idLivraisons ...int64) (Ids, error)
- func DeleteProduitsByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteRecettesByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (Ids, error)
- func DeleteRecettesByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteRepassByIdSejours(tx DB, idSejours ...int64) (Ids, error)
- func DeleteRepassByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteSejoursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (Ids, error)
- func DeleteSejoursByIds(tx DB, ids ...int64) (Ids, error)
- func DeleteUtilisateursByIds(tx DB, ids ...int64) (Ids, error)
- type Ingredient
- type IngredientProduit
- type IngredientProduits
- func DeleteIngredientProduitsByIdIngredients(tx DB, idIngredients ...int64) (IngredientProduits, error)
- func DeleteIngredientProduitsByIdProduits(tx DB, idProduits ...int64) (IngredientProduits, error)
- func DeleteIngredientProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (IngredientProduits, error)
- func ScanIngredientProduits(rs *sql.Rows) (IngredientProduits, error)
- func SelectAllIngredientProduits(tx DB) (IngredientProduits, error)
- func SelectIngredientProduitsByIdIngredients(tx DB, idIngredients ...int64) (IngredientProduits, error)
- func SelectIngredientProduitsByIdProduits(tx DB, idProduits ...int64) (IngredientProduits, error)
- func SelectIngredientProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (IngredientProduits, error)
- type Ingredients
- type JoursLivraison
- type LienIngredient
- type LienIngredients
- func DeleteLienIngredientsByIdIngredients(tx DB, idIngredients ...int64) (LienIngredients, error)
- func ScanLienIngredients(rs *sql.Rows) (LienIngredients, error)
- func SelectAllLienIngredients(tx DB) (LienIngredients, error)
- func SelectLienIngredientsByIdIngredients(tx DB, idIngredients ...int64) (LienIngredients, error)
- func (ls LienIngredients) AsMenuIngredients(idMenu int64) []MenuIngredient
- func (ls LienIngredients) AsRecetteIngredients(idRecette int64) []RecetteIngredient
- func (ls LienIngredients) AsRepasIngredients(idRepas int64) []RepasIngredient
- func (items LienIngredients) ByIdIngredient() map[int64]LienIngredients
- type Livraison
- type Livraisons
- type Menu
- type MenuIngredient
- type MenuIngredients
- func DeleteMenuIngredientsByIdIngredients(tx DB, idIngredients ...int64) (MenuIngredients, error)
- func DeleteMenuIngredientsByIdMenus(tx DB, idMenus ...int64) (MenuIngredients, error)
- func ScanMenuIngredients(rs *sql.Rows) (MenuIngredients, error)
- func SelectAllMenuIngredients(tx DB) (MenuIngredients, error)
- func SelectMenuIngredientsByIdIngredients(tx DB, idIngredients ...int64) (MenuIngredients, error)
- func SelectMenuIngredientsByIdMenus(tx DB, idMenus ...int64) (MenuIngredients, error)
- type MenuRecette
- type MenuRecettes
- func DeleteMenuRecettesByIdMenus(tx DB, idMenus ...int64) (MenuRecettes, error)
- func DeleteMenuRecettesByIdRecettes(tx DB, idRecettes ...int64) (MenuRecettes, error)
- func ScanMenuRecettes(rs *sql.Rows) (MenuRecettes, error)
- func SelectAllMenuRecettes(tx DB) (MenuRecettes, error)
- func SelectMenuRecettesByIdMenus(tx DB, idMenus ...int64) (MenuRecettes, error)
- func SelectMenuRecettesByIdRecettes(tx DB, idRecettes ...int64) (MenuRecettes, error)
- type Menus
- type Produit
- type Produits
- type Recette
- type RecetteIngredient
- type RecetteIngredients
- func DeleteRecetteIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RecetteIngredients, error)
- func DeleteRecetteIngredientsByIdRecettes(tx DB, idRecettes ...int64) (RecetteIngredients, error)
- func ScanRecetteIngredients(rs *sql.Rows) (RecetteIngredients, error)
- func SelectAllRecetteIngredients(tx DB) (RecetteIngredients, error)
- func SelectRecetteIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RecetteIngredients, error)
- func SelectRecetteIngredientsByIdRecettes(tx DB, idRecettes ...int64) (RecetteIngredients, error)
- type Recettes
- type Repas
- type RepasGroupe
- type RepasGroupes
- func DeleteRepasGroupesByIdGroupes(tx DB, idGroupes ...int64) (RepasGroupes, error)
- func DeleteRepasGroupesByIdRepass(tx DB, idRepass ...int64) (RepasGroupes, error)
- func ScanRepasGroupes(rs *sql.Rows) (RepasGroupes, error)
- func SelectAllRepasGroupes(tx DB) (RepasGroupes, error)
- func SelectRepasGroupesByIdGroupes(tx DB, idGroupes ...int64) (RepasGroupes, error)
- func SelectRepasGroupesByIdRepass(tx DB, idRepass ...int64) (RepasGroupes, error)
- type RepasIngredient
- type RepasIngredients
- func DeleteRepasIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RepasIngredients, error)
- func DeleteRepasIngredientsByIdRepass(tx DB, idRepass ...int64) (RepasIngredients, error)
- func ScanRepasIngredients(rs *sql.Rows) (RepasIngredients, error)
- func SelectAllRepasIngredients(tx DB) (RepasIngredients, error)
- func SelectRepasIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RepasIngredients, error)
- func SelectRepasIngredientsByIdRepass(tx DB, idRepass ...int64) (RepasIngredients, error)
- type RepasRecette
- type RepasRecettes
- func DeleteRepasRecettesByIdRecettes(tx DB, idRecettes ...int64) (RepasRecettes, error)
- func DeleteRepasRecettesByIdRepass(tx DB, idRepass ...int64) (RepasRecettes, error)
- func ScanRepasRecettes(rs *sql.Rows) (RepasRecettes, error)
- func SelectAllRepasRecettes(tx DB) (RepasRecettes, error)
- func SelectRepasRecettesByIdRecettes(tx DB, idRecettes ...int64) (RepasRecettes, error)
- func SelectRepasRecettesByIdRepass(tx DB, idRepass ...int64) (RepasRecettes, error)
- type Repass
- type Sejour
- type SejourFournisseur
- type SejourFournisseurs
- func DeleteSejourFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (SejourFournisseurs, error)
- func DeleteSejourFournisseursByIdSejours(tx DB, idSejours ...int64) (SejourFournisseurs, error)
- func DeleteSejourFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (SejourFournisseurs, error)
- func ScanSejourFournisseurs(rs *sql.Rows) (SejourFournisseurs, error)
- func SelectAllSejourFournisseurs(tx DB) (SejourFournisseurs, error)
- func SelectSejourFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (SejourFournisseurs, error)
- func SelectSejourFournisseursByIdSejours(tx DB, idSejours ...int64) (SejourFournisseurs, error)
- func SelectSejourFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (SejourFournisseurs, error)
- type Sejours
- type Set
- type Unite
- type Utilisateur
- type UtilisateurFournisseur
- type UtilisateurFournisseurs
- func DeleteUtilisateurFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (UtilisateurFournisseurs, error)
- func DeleteUtilisateurFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (UtilisateurFournisseurs, error)
- func ScanUtilisateurFournisseurs(rs *sql.Rows) (UtilisateurFournisseurs, error)
- func SelectAllUtilisateurFournisseurs(tx DB) (UtilisateurFournisseurs, error)
- func SelectUtilisateurFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (UtilisateurFournisseurs, error)
- func SelectUtilisateurFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (UtilisateurFournisseurs, error)
- type Utilisateurs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertManyCommandeProduits ¶
func InsertManyCommandeProduits(tx *sql.Tx, items ...CommandeProduit) error
Insert the links CommandeProduit in the database.
func InsertManyDefautProduits ¶
func InsertManyDefautProduits(tx *sql.Tx, items ...DefautProduit) error
Insert the links DefautProduit in the database.
func InsertManyIngredientProduits ¶
func InsertManyIngredientProduits(tx *sql.Tx, items ...IngredientProduit) error
Insert the links IngredientProduit in the database.
func InsertManyLienIngredients ¶
func InsertManyLienIngredients(tx *sql.Tx, items ...LienIngredient) error
Insert the links LienIngredient in the database.
func InsertManyMenuIngredients ¶
func InsertManyMenuIngredients(tx *sql.Tx, items ...MenuIngredient) error
Insert the links MenuIngredient in the database.
func InsertManyMenuRecettes ¶
func InsertManyMenuRecettes(tx *sql.Tx, items ...MenuRecette) error
Insert the links MenuRecette in the database.
func InsertManyRecetteIngredients ¶
func InsertManyRecetteIngredients(tx *sql.Tx, items ...RecetteIngredient) error
Insert the links RecetteIngredient in the database.
func InsertManyRepasGroupes ¶
func InsertManyRepasGroupes(tx *sql.Tx, items ...RepasGroupe) error
Insert the links RepasGroupe in the database.
func InsertManyRepasIngredients ¶
func InsertManyRepasIngredients(tx *sql.Tx, items ...RepasIngredient) error
Insert the links RepasIngredient in the database.
func InsertManyRepasRecettes ¶
func InsertManyRepasRecettes(tx *sql.Tx, items ...RepasRecette) error
Insert the links RepasRecette in the database.
func InsertManySejourFournisseurs ¶
func InsertManySejourFournisseurs(tx *sql.Tx, items ...SejourFournisseur) error
Insert the links SejourFournisseur in the database.
func InsertManyUtilisateurFournisseurs ¶
func InsertManyUtilisateurFournisseurs(tx *sql.Tx, items ...UtilisateurFournisseur) error
Insert the links UtilisateurFournisseur in the database.
func NullableId ¶
------------------- Helpers --------------------------------
Types ¶
type Commande ¶
type Commande struct { Id int64 `json:"id"` IdUtilisateur int64 `json:"id_utilisateur"` DateEmission time.Time `json:"date_emission"` Tag string `json:"tag"` }
func DeleteCommandeById ¶
Deletes the Commande and returns the item
func SelectCommande ¶
SelectCommande returns the entry matching id.
type CommandeProduit ¶
type CommandeProduit struct { IdCommande int64 `json:"id_commande"` IdProduit int64 `json:"id_produit"` Quantite int64 `json:"quantite"` }
sql: ADD UNIQUE(id_commande, id_produit)
func ScanCommandeProduit ¶
func ScanCommandeProduit(row *sql.Row) (CommandeProduit, error)
func (CommandeProduit) Delete ¶
func (item CommandeProduit) Delete(tx DB) error
Delete the link CommandeProduit in the database. Only the 'IdCommande' 'IdProduit' fields are used.
type CommandeProduits ¶
type CommandeProduits []CommandeProduit
func DeleteCommandeProduitsByIdCommandes ¶
func DeleteCommandeProduitsByIdCommandes(tx DB, idCommandes ...int64) (CommandeProduits, error)
func DeleteCommandeProduitsByIdProduits ¶
func DeleteCommandeProduitsByIdProduits(tx DB, idProduits ...int64) (CommandeProduits, error)
func ScanCommandeProduits ¶
func ScanCommandeProduits(rs *sql.Rows) (CommandeProduits, error)
func SelectAllCommandeProduits ¶
func SelectAllCommandeProduits(tx DB) (CommandeProduits, error)
func SelectCommandeProduitsByIdCommandes ¶
func SelectCommandeProduitsByIdCommandes(tx DB, idCommandes ...int64) (CommandeProduits, error)
func SelectCommandeProduitsByIdProduits ¶
func SelectCommandeProduitsByIdProduits(tx DB, idProduits ...int64) (CommandeProduits, error)
func (CommandeProduits) ByIdCommande ¶
func (items CommandeProduits) ByIdCommande() map[int64]CommandeProduits
ByIdCommande returns a map with 'IdCommande' as keys.
func (CommandeProduits) ByIdProduit ¶
func (items CommandeProduits) ByIdProduit() map[int64]CommandeProduits
ByIdProduit returns a map with 'IdProduit' as keys.
type Commandes ¶
func SelectAllCommandes ¶
func SelectCommandes ¶
SelectCommandes returns the entry matching the given ids.
type Conditionnement ¶
func (Conditionnement) IsNull ¶
func (c Conditionnement) IsNull() bool
func (*Conditionnement) Scan ¶
func (s *Conditionnement) Scan(src interface{}) error
func (Conditionnement) String ¶
func (c Conditionnement) String() string
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
type DefautProduit ¶
type DefautProduit struct { IdUtilisateur int64 `json:"id_utilisateur"` IdIngredient int64 `json:"id_ingredient"` IdFournisseur int64 `json:"id_fournisseur"` IdProduit int64 `json:"id_produit" sql_on_delete:"CASCADE"` }
sql: ADD UNIQUE(id_utilisateur, id_ingredient, id_fournisseur) sql: ADD FOREIGN KEY (id_utilisateur, id_fournisseur) REFERENCES utilisateur_fournisseurs (id_utilisateur, id_fournisseur) sql: ADD FOREIGN KEY (id_ingredient, id_produit) REFERENCES ingredient_produits (id_ingredient, id_produit)
func ScanDefautProduit ¶
func ScanDefautProduit(row *sql.Row) (DefautProduit, error)
func (DefautProduit) Delete ¶
func (item DefautProduit) Delete(tx DB) error
Delete the link DefautProduit in the database. Only the 'IdUtilisateur' 'IdIngredient' 'IdFournisseur' 'IdProduit' fields are used.
type DefautProduits ¶
type DefautProduits []DefautProduit
func DeleteDefautProduitsByIdFournisseurs ¶
func DeleteDefautProduitsByIdFournisseurs(tx DB, idFournisseurs ...int64) (DefautProduits, error)
func DeleteDefautProduitsByIdIngredients ¶
func DeleteDefautProduitsByIdIngredients(tx DB, idIngredients ...int64) (DefautProduits, error)
func DeleteDefautProduitsByIdProduits ¶
func DeleteDefautProduitsByIdProduits(tx DB, idProduits ...int64) (DefautProduits, error)
func DeleteDefautProduitsByIdUtilisateurs ¶
func DeleteDefautProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (DefautProduits, error)
func ScanDefautProduits ¶
func ScanDefautProduits(rs *sql.Rows) (DefautProduits, error)
func SelectAllDefautProduits ¶
func SelectAllDefautProduits(tx DB) (DefautProduits, error)
func SelectDefautProduitsByIdFournisseurs ¶
func SelectDefautProduitsByIdFournisseurs(tx DB, idFournisseurs ...int64) (DefautProduits, error)
func SelectDefautProduitsByIdIngredients ¶
func SelectDefautProduitsByIdIngredients(tx DB, idIngredients ...int64) (DefautProduits, error)
func SelectDefautProduitsByIdProduits ¶
func SelectDefautProduitsByIdProduits(tx DB, idProduits ...int64) (DefautProduits, error)
func SelectDefautProduitsByIdUtilisateurs ¶
func SelectDefautProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (DefautProduits, error)
func (DefautProduits) ByIdFournisseur ¶
func (items DefautProduits) ByIdFournisseur() map[int64]DefautProduits
ByIdFournisseur returns a map with 'IdFournisseur' as keys.
func (DefautProduits) ByIdIngredient ¶
func (items DefautProduits) ByIdIngredient() map[int64]DefautProduits
ByIdIngredient returns a map with 'IdIngredient' as keys.
func (DefautProduits) ByIdProduit ¶
func (items DefautProduits) ByIdProduit() map[int64]DefautProduits
ByIdProduit returns a map with 'IdProduit' as keys.
func (DefautProduits) ByIdUtilisateur ¶
func (items DefautProduits) ByIdUtilisateur() map[int64]DefautProduits
ByIdUtilisateur returns a map with 'IdUtilisateur' as keys.
type Fournisseur ¶
Fournisseur définit un fournisseur. Chaque fournisseur possède au moins une contrainte de livraison (voir `Livraison`), et peut en posséder plusieurs.
func DeleteFournisseurById ¶
func DeleteFournisseurById(tx DB, id int64) (Fournisseur, error)
Deletes the Fournisseur and returns the item
func ScanFournisseur ¶
func ScanFournisseur(row *sql.Row) (Fournisseur, error)
func SelectFournisseur ¶
func SelectFournisseur(tx DB, id int64) (Fournisseur, error)
SelectFournisseur returns the entry matching id.
func (Fournisseur) Insert ¶
func (item Fournisseur) Insert(tx DB) (out Fournisseur, err error)
Insert Fournisseur in the database and returns the item with id filled.
func (Fournisseur) Update ¶
func (item Fournisseur) Update(tx DB) (out Fournisseur, err error)
Update Fournisseur in the database and returns the new version.
type Fournisseurs ¶
type Fournisseurs map[int64]Fournisseur
func ScanFournisseurs ¶
func ScanFournisseurs(rs *sql.Rows) (Fournisseurs, error)
func SelectAllFournisseurs ¶
func SelectAllFournisseurs(tx DB) (Fournisseurs, error)
func SelectFournisseurs ¶
func SelectFournisseurs(tx DB, ids ...int64) (Fournisseurs, error)
SelectFournisseurs returns the entry matching the given ids.
func (Fournisseurs) Ids ¶
func (m Fournisseurs) Ids() Ids
type Groupe ¶
type Groupe struct { Id int64 `json:"id"` IdSejour int64 `json:"id_sejour"` Nom string `json:"nom"` NbPersonnes int64 `json:"nb_personnes"` Couleur string `json:"couleur"` }
Groupe est un groupe de personnes lié à un séjour
func DeleteGroupeById ¶
Deletes the Groupe and returns the item
func SelectGroupe ¶
SelectGroupe returns the entry matching id.
type Groupes ¶
func SelectAllGroupes ¶
func SelectGroupes ¶
SelectGroupes returns the entry matching the given ids.
type Ids ¶
type Ids []int64
----------------------------------------------------
func DeleteCommandesByIds ¶
Deletes the Commande in the database and returns the ids.
func DeleteFournisseursByIds ¶
Deletes the Fournisseur in the database and returns the ids.
func DeleteGroupesByIds ¶
Deletes the Groupe in the database and returns the ids.
func DeleteIngredientsByIds ¶
Deletes the Ingredient in the database and returns the ids.
func DeleteLivraisonsByIds ¶
Deletes the Livraison in the database and returns the ids.
func DeleteMenusByIds ¶
Deletes the Menu in the database and returns the ids.
func DeleteProduitsByIds ¶
Deletes the Produit in the database and returns the ids.
func DeleteRecettesByIds ¶
Deletes the Recette in the database and returns the ids.
func DeleteRepassByIds ¶
Deletes the Repas in the database and returns the ids.
func DeleteSejoursByIds ¶
Deletes the Sejour in the database and returns the ids.
func DeleteUtilisateursByIds ¶
Deletes the Utilisateur in the database and returns the ids.
func (Ids) AsMenuRecettes ¶
func (ids Ids) AsMenuRecettes(idMenu int64) []MenuRecette
func (Ids) AsRepasRecettes ¶
func (ids Ids) AsRepasRecettes(idRepas int64) []RepasRecette
func (Ids) AsSQL ¶
func (ids Ids) AsSQL() pq.Int64Array
type Ingredient ¶
type Ingredient struct { Id int64 `json:"id"` Nom string `json:"nom"` Unite Unite `json:"unite"` Categorie Categorie `json:"categorie"` Callories Callories `json:"callories"` // optionnel, zero signifie pas de contrainte Conditionnement Conditionnement `json:"conditionnement,omitempty"` }
Les ingrédients sont _partagés_ : n'importe quel intendant peut utiliser un ingrédient déjà défini, et ajouter un produit lié. En revanche, les recettes et menus ne sont modifiables que par son _propriétaire_ (mais copiables libremement). En cas de modification par le propriétaire, les intendants utilisant la ressource sont notifiés par mail et peuvent choisir d'accepter la modification ou de s'approprier la ressource en la copiant. Les recettes et menus peuvent n'être liés à aucun propriétaire, et sont alors éditable par tout le monde.
sql: ADD UNIQUE(nom) sql: ADD CHECK(conditionnement->>'unite' = ” OR conditionnement->>'unite' = unite) sql: ADD CHECK(conditionnement->>'unite' != ” OR (conditionnement->'quantite')::real = 0) sql: ADD CHECK(conditionnement->>'unite' = ” OR unite = 'P')
func DeleteIngredientById ¶
func DeleteIngredientById(tx DB, id int64) (Ingredient, error)
Deletes the Ingredient and returns the item
func ScanIngredient ¶
func ScanIngredient(row *sql.Row) (Ingredient, error)
func SelectIngredient ¶
func SelectIngredient(tx DB, id int64) (Ingredient, error)
SelectIngredient returns the entry matching id.
func (Ingredient) GetProduits ¶
func (ig Ingredient) GetProduits(tx DB, fournisseurs Fournisseurs) (Produits, error)
GetProduits renvoie les produits associé à l'ingrédient. Si `fournisseurs` est non nil, seul les produits de ces fournisseurs sont renvoyés Seul le champ 'Id' est utilisé.
func (Ingredient) Insert ¶
func (item Ingredient) Insert(tx DB) (out Ingredient, err error)
Insert Ingredient in the database and returns the item with id filled.
func (Ingredient) Update ¶
func (item Ingredient) Update(tx DB) (out Ingredient, err error)
Update Ingredient in the database and returns the new version.
type IngredientProduit ¶
type IngredientProduit struct { IdIngredient int64 `json:"id_ingredient"` IdProduit int64 `json:"id_produit" sql_on_delete:"CASCADE"` IdUtilisateur int64 `json:"id_utilisateur"` // ajouteur }
sql: ADD UNIQUE(id_ingredient, id_produit)
func ScanIngredientProduit ¶
func ScanIngredientProduit(row *sql.Row) (IngredientProduit, error)
func (IngredientProduit) Delete ¶
func (item IngredientProduit) Delete(tx DB) error
Delete the link IngredientProduit in the database. Only the 'IdIngredient' 'IdProduit' 'IdUtilisateur' fields are used.
type IngredientProduits ¶
type IngredientProduits []IngredientProduit
func DeleteIngredientProduitsByIdIngredients ¶
func DeleteIngredientProduitsByIdIngredients(tx DB, idIngredients ...int64) (IngredientProduits, error)
func DeleteIngredientProduitsByIdProduits ¶
func DeleteIngredientProduitsByIdProduits(tx DB, idProduits ...int64) (IngredientProduits, error)
func DeleteIngredientProduitsByIdUtilisateurs ¶
func DeleteIngredientProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (IngredientProduits, error)
func ScanIngredientProduits ¶
func ScanIngredientProduits(rs *sql.Rows) (IngredientProduits, error)
func SelectAllIngredientProduits ¶
func SelectAllIngredientProduits(tx DB) (IngredientProduits, error)
func SelectIngredientProduitsByIdIngredients ¶
func SelectIngredientProduitsByIdIngredients(tx DB, idIngredients ...int64) (IngredientProduits, error)
func SelectIngredientProduitsByIdProduits ¶
func SelectIngredientProduitsByIdProduits(tx DB, idProduits ...int64) (IngredientProduits, error)
func SelectIngredientProduitsByIdUtilisateurs ¶
func SelectIngredientProduitsByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (IngredientProduits, error)
func (IngredientProduits) ByIdIngredient ¶
func (items IngredientProduits) ByIdIngredient() map[int64]IngredientProduits
ByIdIngredient returns a map with 'IdIngredient' as keys.
func (IngredientProduits) ByIdProduit ¶
func (items IngredientProduits) ByIdProduit() map[int64]IngredientProduits
ByIdProduit returns a map with 'IdProduit' as keys.
func (IngredientProduits) ByIdUtilisateur ¶
func (items IngredientProduits) ByIdUtilisateur() map[int64]IngredientProduits
ByIdUtilisateur returns a map with 'IdUtilisateur' as keys.
type Ingredients ¶
type Ingredients map[int64]Ingredient
func ScanIngredients ¶
func ScanIngredients(rs *sql.Rows) (Ingredients, error)
func SelectAllIngredients ¶
func SelectAllIngredients(tx DB) (Ingredients, error)
func SelectIngredients ¶
func SelectIngredients(tx DB, ids ...int64) (Ingredients, error)
SelectIngredients returns the entry matching the given ids.
func (Ingredients) Ids ¶
func (m Ingredients) Ids() Ids
type JoursLivraison ¶
type JoursLivraison [7]bool
Lundi = 0, Mardi = 1 , etc...
func (JoursLivraison) BestJour ¶
func (js JoursLivraison) BestJour(dateLivraison time.Time) time.Time
BestJour remonte jusqu'au premier jour de livraison possible (incluant `date`).
func (*JoursLivraison) Scan ¶
func (s *JoursLivraison) Scan(src interface{}) error
type LienIngredient ¶
type LienIngredient struct { IdIngredient int64 `json:"id_ingredient"` Quantite float64 `json:"quantite"` Cuisson string `json:"cuisson"` }
func ScanLienIngredient ¶
func ScanLienIngredient(row *sql.Row) (LienIngredient, error)
func (LienIngredient) Delete ¶
func (item LienIngredient) Delete(tx DB) error
Delete the link LienIngredient in the database. Only the 'IdIngredient' fields are used.
type LienIngredients ¶
type LienIngredients []LienIngredient
func DeleteLienIngredientsByIdIngredients ¶
func DeleteLienIngredientsByIdIngredients(tx DB, idIngredients ...int64) (LienIngredients, error)
func ScanLienIngredients ¶
func ScanLienIngredients(rs *sql.Rows) (LienIngredients, error)
func SelectAllLienIngredients ¶
func SelectAllLienIngredients(tx DB) (LienIngredients, error)
func SelectLienIngredientsByIdIngredients ¶
func SelectLienIngredientsByIdIngredients(tx DB, idIngredients ...int64) (LienIngredients, error)
func (LienIngredients) AsMenuIngredients ¶
func (ls LienIngredients) AsMenuIngredients(idMenu int64) []MenuIngredient
AsMenuIngredients lie les ingrédients au menu donné
func (LienIngredients) AsRecetteIngredients ¶
func (ls LienIngredients) AsRecetteIngredients(idRecette int64) []RecetteIngredient
AsRecetteIngredients lie les ingrédients au menu donné
func (LienIngredients) AsRepasIngredients ¶
func (ls LienIngredients) AsRepasIngredients(idRepas int64) []RepasIngredient
AsRepasIngredients lie les ingrédients au menu donné
func (LienIngredients) ByIdIngredient ¶
func (items LienIngredients) ByIdIngredient() map[int64]LienIngredients
ByIdIngredient returns a map with 'IdIngredient' as keys.
type Livraison ¶
type Livraison struct { Id int64 `json:"id"` IdFournisseur int64 `json:"id_fournisseur" sql_on_delete:"CASCADE"` Nom string `json:"nom"` JoursLivraison JoursLivraison `json:"jours_livraison"` // jours possibles de livraison DelaiCommande int64 `json:"delai_commande"` // nombre de jours à anticiper par rapport au jour de livraison Anticipation int64 `json:"anticipation"` // nombre de jours entre la livraison et l'utilisation (défaut : 1) }
Livraison enregistre les contraintes d'un fournisseur quant à la livraison d'une gamme de produit.
sql: ADD CHECK(anticipation >= 0) sql: ADD CHECK(delai_commande >= 0) sql: ADD UNIQUE(id_fournisseur, nom)
func DeleteLivraisonById ¶
Deletes the Livraison and returns the item
func SelectLivraison ¶
SelectLivraison returns the entry matching id.
func (Livraison) DateCommande ¶
DateCommande calcule la date conseillée de commande la plus proche possible de `dateDemande` en tenant compte des contraintes. Renvoie la quantités intermédiaire 'dateLivraison'
type Livraisons ¶
func ScanLivraisons ¶
func ScanLivraisons(rs *sql.Rows) (Livraisons, error)
func SelectAllLivraisons ¶
func SelectAllLivraisons(tx DB) (Livraisons, error)
func SelectLivraisons ¶
func SelectLivraisons(tx DB, ids ...int64) (Livraisons, error)
SelectLivraisons returns the entry matching the given ids.
func SelectLivraisonsByIdFournisseurs ¶
func SelectLivraisonsByIdFournisseurs(tx DB, idFournisseurs ...int64) (Livraisons, error)
func (Livraisons) Ids ¶
func (m Livraisons) Ids() Ids
type Menu ¶
type Menu struct { Id int64 `json:"id"` IdUtilisateur sql.NullInt64 `json:"id_utilisateur"` Commentaire string `json:"commentaire"` }
Menu définit un raccourci pour organiser recettes et ingrédients Voir `Repas` pour un repas effectif.
func DeleteMenuById ¶
Deletes the Menu and returns the item
func SelectMenu ¶
SelectMenu returns the entry matching id.
type MenuIngredient ¶
type MenuIngredient struct { IdMenu int64 `json:"id_menu"` LienIngredient }
sql: ADD UNIQUE(id_menu, id_ingredient)
func ScanMenuIngredient ¶
func ScanMenuIngredient(row *sql.Row) (MenuIngredient, error)
func (MenuIngredient) Delete ¶
func (item MenuIngredient) Delete(tx DB) error
Delete the link MenuIngredient in the database. Only the 'IdMenu' 'IdIngredient' fields are used.
type MenuIngredients ¶
type MenuIngredients []MenuIngredient
func DeleteMenuIngredientsByIdIngredients ¶
func DeleteMenuIngredientsByIdIngredients(tx DB, idIngredients ...int64) (MenuIngredients, error)
func DeleteMenuIngredientsByIdMenus ¶
func DeleteMenuIngredientsByIdMenus(tx DB, idMenus ...int64) (MenuIngredients, error)
func ScanMenuIngredients ¶
func ScanMenuIngredients(rs *sql.Rows) (MenuIngredients, error)
func SelectAllMenuIngredients ¶
func SelectAllMenuIngredients(tx DB) (MenuIngredients, error)
func SelectMenuIngredientsByIdIngredients ¶
func SelectMenuIngredientsByIdIngredients(tx DB, idIngredients ...int64) (MenuIngredients, error)
func SelectMenuIngredientsByIdMenus ¶
func SelectMenuIngredientsByIdMenus(tx DB, idMenus ...int64) (MenuIngredients, error)
func (MenuIngredients) ByIdIngredient ¶
func (items MenuIngredients) ByIdIngredient() map[int64]MenuIngredients
ByIdIngredient returns a map with 'IdIngredient' as keys.
func (MenuIngredients) ByIdMenu ¶
func (items MenuIngredients) ByIdMenu() map[int64]MenuIngredients
ByIdMenu returns a map with 'IdMenu' as keys.
type MenuRecette ¶
sql: ADD UNIQUE(id_menu, id_recette)
func ScanMenuRecette ¶
func ScanMenuRecette(row *sql.Row) (MenuRecette, error)
func (MenuRecette) Delete ¶
func (item MenuRecette) Delete(tx DB) error
Delete the link MenuRecette in the database. Only the 'IdMenu' 'IdRecette' fields are used.
type MenuRecettes ¶
type MenuRecettes []MenuRecette
func DeleteMenuRecettesByIdMenus ¶
func DeleteMenuRecettesByIdMenus(tx DB, idMenus ...int64) (MenuRecettes, error)
func DeleteMenuRecettesByIdRecettes ¶
func DeleteMenuRecettesByIdRecettes(tx DB, idRecettes ...int64) (MenuRecettes, error)
func ScanMenuRecettes ¶
func ScanMenuRecettes(rs *sql.Rows) (MenuRecettes, error)
func SelectAllMenuRecettes ¶
func SelectAllMenuRecettes(tx DB) (MenuRecettes, error)
func SelectMenuRecettesByIdMenus ¶
func SelectMenuRecettesByIdMenus(tx DB, idMenus ...int64) (MenuRecettes, error)
func SelectMenuRecettesByIdRecettes ¶
func SelectMenuRecettesByIdRecettes(tx DB, idRecettes ...int64) (MenuRecettes, error)
func (MenuRecettes) ByIdMenu ¶
func (items MenuRecettes) ByIdMenu() map[int64]MenuRecettes
ByIdMenu returns a map with 'IdMenu' as keys.
func (MenuRecettes) ByIdRecette ¶
func (items MenuRecettes) ByIdRecette() map[int64]MenuRecettes
ByIdRecette returns a map with 'IdRecette' as keys.
type Menus ¶
func SelectAllMenus ¶
func SelectMenus ¶
SelectMenus returns the entry matching the given ids.
type Produit ¶
type Produit struct { Id int64 `json:"id"` IdLivraison int64 `json:"id_livraison"` Nom string `json:"nom"` Conditionnement Conditionnement `json:"conditionnement"` Prix float64 `json:"prix"` ReferenceFournisseur string `json:"reference_fournisseur"` // zero signifie pas de contrainte Colisage int64 `json:"colisage"` }
sql: ADD CHECK(prix >= 0) sql: ADD UNIQUE(id_livraison, nom)
func DeleteProduitById ¶
Deletes the Produit and returns the item
func SelectProduit ¶
SelectProduit returns the entry matching id.
func (Produit) ColisageNeeded ¶
ColisageNeeded renvoie le nombre nécessaire d'exemplaire du produit pour obtenir (au mieux) `quantite` (exprimée dans l'unité du produit). Le cas particulier des ingrédients à la pièce est indiqué par `isUnitePieces`. Si oui, `quantite` est interprétée directement comme le nombre de produits à utiliser. Le colisage est pris en compte (c'est à dire que le résultat est un multiple du colisage du produit).
type Produits ¶
func SelectAllProduits ¶
func SelectProduits ¶
SelectProduits returns the entry matching the given ids.
type Recette ¶
type Recette struct { Id int64 `json:"id"` IdUtilisateur sql.NullInt64 `json:"id_utilisateur"` Nom string `json:"nom"` ModeEmploi string `json:"mode_emploi"` }
func DeleteRecetteById ¶
Deletes the Recette and returns the item
func SelectRecette ¶
SelectRecette returns the entry matching id.
type RecetteIngredient ¶
type RecetteIngredient struct { IdRecette int64 `json:"id_recette"` LienIngredient }
sql: ADD UNIQUE(id_recette, id_ingredient)
func ScanRecetteIngredient ¶
func ScanRecetteIngredient(row *sql.Row) (RecetteIngredient, error)
func (RecetteIngredient) Delete ¶
func (item RecetteIngredient) Delete(tx DB) error
Delete the link RecetteIngredient in the database. Only the 'IdRecette' 'IdIngredient' fields are used.
type RecetteIngredients ¶
type RecetteIngredients []RecetteIngredient
func DeleteRecetteIngredientsByIdIngredients ¶
func DeleteRecetteIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RecetteIngredients, error)
func DeleteRecetteIngredientsByIdRecettes ¶
func DeleteRecetteIngredientsByIdRecettes(tx DB, idRecettes ...int64) (RecetteIngredients, error)
func ScanRecetteIngredients ¶
func ScanRecetteIngredients(rs *sql.Rows) (RecetteIngredients, error)
func SelectAllRecetteIngredients ¶
func SelectAllRecetteIngredients(tx DB) (RecetteIngredients, error)
func SelectRecetteIngredientsByIdIngredients ¶
func SelectRecetteIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RecetteIngredients, error)
func SelectRecetteIngredientsByIdRecettes ¶
func SelectRecetteIngredientsByIdRecettes(tx DB, idRecettes ...int64) (RecetteIngredients, error)
func (RecetteIngredients) ByIdIngredient ¶
func (items RecetteIngredients) ByIdIngredient() map[int64]RecetteIngredients
ByIdIngredient returns a map with 'IdIngredient' as keys.
func (RecetteIngredients) ByIdRecette ¶
func (items RecetteIngredients) ByIdRecette() map[int64]RecetteIngredients
ByIdRecette returns a map with 'IdRecette' as keys.
type Recettes ¶
func SelectAllRecettes ¶
func SelectRecettes ¶
SelectRecettes returns the entry matching the given ids.
type Repas ¶
type Repas struct { Id int64 `json:"id"` IdSejour int64 `json:"id_sejour"` OffsetPersonnes int64 `json:"offset_personnes"` JourOffset int64 `json:"jour_offset"` Horaire Horaire `json:"horaire"` Anticipation int64 `json:"anticipation"` // commande les ingrédients en avance (en jours) }
Le concept de journée nécessite d'être lié à la donnée du nombre de personnes pour chaque menu. Cela ne colle pas bien avec un schéma SQL classique. De plus, une journée n'a pas vraiment d'intérêt à être partagée : la modification sur une journée entrainerait celle sur une autre, ce qui est serait plutôt déroutant. On propose donc de ne pas utiliser de table "journée", mais de construire (dynamiquement) les journées à partir de la table _repas_ (voir ci dessous). En revanche, le concept de journée sera bien présent pour l'utilisateur, pour organiser son emploi du temps, ou pour copier des journées déjà existantes.
Repas représente un repas effectif, lié à un séjour. Il est constitué de recettes et d'ingrédients (de la même manière qu'un menu)
func DeleteRepasById ¶
Deletes the Repas and returns the item
func SelectRepas ¶
SelectRepas returns the entry matching id.
type RepasGroupe ¶
type RepasGroupe struct { IdRepas int64 `json:"id_repas" sql_on_delete:"CASCADE"` IdGroupe int64 `json:"id_groupe" sql_on_delete:"CASCADE"` }
sql: ADD UNIQUE(id_repas, id_groupe)
func ScanRepasGroupe ¶
func ScanRepasGroupe(row *sql.Row) (RepasGroupe, error)
func (RepasGroupe) Delete ¶
func (item RepasGroupe) Delete(tx DB) error
Delete the link RepasGroupe in the database. Only the 'IdRepas' 'IdGroupe' fields are used.
type RepasGroupes ¶
type RepasGroupes []RepasGroupe
func DeleteRepasGroupesByIdGroupes ¶
func DeleteRepasGroupesByIdGroupes(tx DB, idGroupes ...int64) (RepasGroupes, error)
func DeleteRepasGroupesByIdRepass ¶
func DeleteRepasGroupesByIdRepass(tx DB, idRepass ...int64) (RepasGroupes, error)
func ScanRepasGroupes ¶
func ScanRepasGroupes(rs *sql.Rows) (RepasGroupes, error)
func SelectAllRepasGroupes ¶
func SelectAllRepasGroupes(tx DB) (RepasGroupes, error)
func SelectRepasGroupesByIdGroupes ¶
func SelectRepasGroupesByIdGroupes(tx DB, idGroupes ...int64) (RepasGroupes, error)
func SelectRepasGroupesByIdRepass ¶
func SelectRepasGroupesByIdRepass(tx DB, idRepass ...int64) (RepasGroupes, error)
func (RepasGroupes) ByIdGroupe ¶
func (items RepasGroupes) ByIdGroupe() map[int64]RepasGroupes
ByIdGroupe returns a map with 'IdGroupe' as keys.
func (RepasGroupes) ByIdRepas ¶
func (items RepasGroupes) ByIdRepas() map[int64]RepasGroupes
ByIdRepas returns a map with 'IdRepas' as keys.
type RepasIngredient ¶
type RepasIngredient struct { IdRepas int64 `json:"id_repas" sql_on_delete:"CASCADE"` LienIngredient }
sql: ADD UNIQUE(id_repas, id_ingredient)
func ScanRepasIngredient ¶
func ScanRepasIngredient(row *sql.Row) (RepasIngredient, error)
func (RepasIngredient) Delete ¶
func (item RepasIngredient) Delete(tx DB) error
Delete the link RepasIngredient in the database. Only the 'IdRepas' 'IdIngredient' fields are used.
type RepasIngredients ¶
type RepasIngredients []RepasIngredient
func DeleteRepasIngredientsByIdIngredients ¶
func DeleteRepasIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RepasIngredients, error)
func DeleteRepasIngredientsByIdRepass ¶
func DeleteRepasIngredientsByIdRepass(tx DB, idRepass ...int64) (RepasIngredients, error)
func ScanRepasIngredients ¶
func ScanRepasIngredients(rs *sql.Rows) (RepasIngredients, error)
func SelectAllRepasIngredients ¶
func SelectAllRepasIngredients(tx DB) (RepasIngredients, error)
func SelectRepasIngredientsByIdIngredients ¶
func SelectRepasIngredientsByIdIngredients(tx DB, idIngredients ...int64) (RepasIngredients, error)
func SelectRepasIngredientsByIdRepass ¶
func SelectRepasIngredientsByIdRepass(tx DB, idRepass ...int64) (RepasIngredients, error)
func (RepasIngredients) ByIdIngredient ¶
func (items RepasIngredients) ByIdIngredient() map[int64]RepasIngredients
ByIdIngredient returns a map with 'IdIngredient' as keys.
func (RepasIngredients) ByIdRepas ¶
func (items RepasIngredients) ByIdRepas() map[int64]RepasIngredients
ByIdRepas returns a map with 'IdRepas' as keys.
type RepasRecette ¶
type RepasRecette struct { IdRepas int64 `json:"id_repas" sql_on_delete:"CASCADE"` IdRecette int64 `json:"id_recette"` }
sql: ADD UNIQUE(id_repas, id_recette)
func ScanRepasRecette ¶
func ScanRepasRecette(row *sql.Row) (RepasRecette, error)
func (RepasRecette) Delete ¶
func (item RepasRecette) Delete(tx DB) error
Delete the link RepasRecette in the database. Only the 'IdRepas' 'IdRecette' fields are used.
type RepasRecettes ¶
type RepasRecettes []RepasRecette
func DeleteRepasRecettesByIdRecettes ¶
func DeleteRepasRecettesByIdRecettes(tx DB, idRecettes ...int64) (RepasRecettes, error)
func DeleteRepasRecettesByIdRepass ¶
func DeleteRepasRecettesByIdRepass(tx DB, idRepass ...int64) (RepasRecettes, error)
func ScanRepasRecettes ¶
func ScanRepasRecettes(rs *sql.Rows) (RepasRecettes, error)
func SelectAllRepasRecettes ¶
func SelectAllRepasRecettes(tx DB) (RepasRecettes, error)
func SelectRepasRecettesByIdRecettes ¶
func SelectRepasRecettesByIdRecettes(tx DB, idRecettes ...int64) (RepasRecettes, error)
func SelectRepasRecettesByIdRepass ¶
func SelectRepasRecettesByIdRepass(tx DB, idRepass ...int64) (RepasRecettes, error)
func (RepasRecettes) ByIdRecette ¶
func (items RepasRecettes) ByIdRecette() map[int64]RepasRecettes
ByIdRecette returns a map with 'IdRecette' as keys.
func (RepasRecettes) ByIdRepas ¶
func (items RepasRecettes) ByIdRepas() map[int64]RepasRecettes
ByIdRepas returns a map with 'IdRepas' as keys.
type Repass ¶
func SelectAllRepass ¶
func SelectRepass ¶
SelectRepass returns the entry matching the given ids.
func SelectRepassByIdSejours ¶
type Sejour ¶
type Sejour struct { Id int64 `json:"id"` IdUtilisateur int64 `json:"id_utilisateur"` // Fixe l'origine du séjour. // Une journée est déterminé par un "offset" // relatif à cette date. DateDebut time.Time `json:"date_debut"` Nom string `json:"nom"` }
Les séjours sont _privés_, mais les journées formées peuvent être copiées. sql: ADD UNIQUE(id, id_utilisateur)
func DeleteSejourById ¶
Deletes the Sejour and returns the item
func SelectSejour ¶
SelectSejour returns the entry matching id.
type SejourFournisseur ¶
type SejourFournisseur struct { IdUtilisateur int64 `json:"id_utilisateur,omitempty"` IdSejour int64 `json:"id_sejour,omitempty"` IdFournisseur int64 `json:"id_fournisseur,omitempty"` }
Enregistre les fournisseurs associés à un séjour. Note: Le champ `IdUtilisateur` permet d'assurer par une contrainte que les fournisseurs soient associés à l'utilisateur du séjour.
sql: ADD UNIQUE(id_sejour,id_fournisseur) sql: ADD FOREIGN KEY (id_utilisateur, id_sejour) REFERENCES sejours (id_utilisateur, id) sql: ADD FOREIGN KEY (id_utilisateur, id_fournisseur) REFERENCES utilisateur_fournisseurs (id_utilisateur, id_fournisseur)
func ScanSejourFournisseur ¶
func ScanSejourFournisseur(row *sql.Row) (SejourFournisseur, error)
func (SejourFournisseur) Delete ¶
func (item SejourFournisseur) Delete(tx DB) error
Delete the link SejourFournisseur in the database. Only the 'IdUtilisateur' 'IdSejour' 'IdFournisseur' fields are used.
type SejourFournisseurs ¶
type SejourFournisseurs []SejourFournisseur
func DeleteSejourFournisseursByIdFournisseurs ¶
func DeleteSejourFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (SejourFournisseurs, error)
func DeleteSejourFournisseursByIdSejours ¶
func DeleteSejourFournisseursByIdSejours(tx DB, idSejours ...int64) (SejourFournisseurs, error)
func DeleteSejourFournisseursByIdUtilisateurs ¶
func DeleteSejourFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (SejourFournisseurs, error)
func ScanSejourFournisseurs ¶
func ScanSejourFournisseurs(rs *sql.Rows) (SejourFournisseurs, error)
func SelectAllSejourFournisseurs ¶
func SelectAllSejourFournisseurs(tx DB) (SejourFournisseurs, error)
func SelectSejourFournisseursByIdFournisseurs ¶
func SelectSejourFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (SejourFournisseurs, error)
func SelectSejourFournisseursByIdSejours ¶
func SelectSejourFournisseursByIdSejours(tx DB, idSejours ...int64) (SejourFournisseurs, error)
func SelectSejourFournisseursByIdUtilisateurs ¶
func SelectSejourFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (SejourFournisseurs, error)
func (SejourFournisseurs) ByIdFournisseur ¶
func (items SejourFournisseurs) ByIdFournisseur() map[int64]SejourFournisseurs
ByIdFournisseur returns a map with 'IdFournisseur' as keys.
func (SejourFournisseurs) ByIdSejour ¶
func (items SejourFournisseurs) ByIdSejour() map[int64]SejourFournisseurs
ByIdSejour returns a map with 'IdSejour' as keys.
func (SejourFournisseurs) ByIdUtilisateur ¶
func (items SejourFournisseurs) ByIdUtilisateur() map[int64]SejourFournisseurs
ByIdUtilisateur returns a map with 'IdUtilisateur' as keys.
type Sejours ¶
func SelectAllSejours ¶
func SelectSejours ¶
SelectSejours returns the entry matching the given ids.
type Set ¶
func NewSetFromSlice ¶
type Utilisateur ¶
type Utilisateur struct { Id int64 `json:"id"` Password string `json:"password"` Mail string `json:"mail"` PrenomNom string `json:"prenom_nom"` }
Le logiciel est disponible sous la forme d'une **application web** accessible par mail/password. sql: ADD UNIQUE(mail)
func DeleteUtilisateurById ¶
func DeleteUtilisateurById(tx DB, id int64) (Utilisateur, error)
Deletes the Utilisateur and returns the item
func ScanUtilisateur ¶
func ScanUtilisateur(row *sql.Row) (Utilisateur, error)
func SelectUtilisateur ¶
func SelectUtilisateur(tx DB, id int64) (Utilisateur, error)
SelectUtilisateur returns the entry matching id.
func (Utilisateur) Insert ¶
func (item Utilisateur) Insert(tx DB) (out Utilisateur, err error)
Insert Utilisateur in the database and returns the item with id filled.
func (Utilisateur) Update ¶
func (item Utilisateur) Update(tx DB) (out Utilisateur, err error)
Update Utilisateur in the database and returns the new version.
type UtilisateurFournisseur ¶
type UtilisateurFournisseur struct { IdUtilisateur int64 `json:"id_utilisateur"` IdFournisseur int64 `json:"id_fournisseur"` }
Enregistre les fournisseurs associés à chaque utilisateur sql: ADD UNIQUE(id_utilisateur,id_fournisseur)
func ScanUtilisateurFournisseur ¶
func ScanUtilisateurFournisseur(row *sql.Row) (UtilisateurFournisseur, error)
func (UtilisateurFournisseur) Delete ¶
func (item UtilisateurFournisseur) Delete(tx DB) error
Delete the link UtilisateurFournisseur in the database. Only the 'IdUtilisateur' 'IdFournisseur' fields are used.
type UtilisateurFournisseurs ¶
type UtilisateurFournisseurs []UtilisateurFournisseur
func DeleteUtilisateurFournisseursByIdFournisseurs ¶
func DeleteUtilisateurFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (UtilisateurFournisseurs, error)
func DeleteUtilisateurFournisseursByIdUtilisateurs ¶
func DeleteUtilisateurFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (UtilisateurFournisseurs, error)
func ScanUtilisateurFournisseurs ¶
func ScanUtilisateurFournisseurs(rs *sql.Rows) (UtilisateurFournisseurs, error)
func SelectAllUtilisateurFournisseurs ¶
func SelectAllUtilisateurFournisseurs(tx DB) (UtilisateurFournisseurs, error)
func SelectUtilisateurFournisseursByIdFournisseurs ¶
func SelectUtilisateurFournisseursByIdFournisseurs(tx DB, idFournisseurs ...int64) (UtilisateurFournisseurs, error)
func SelectUtilisateurFournisseursByIdUtilisateurs ¶
func SelectUtilisateurFournisseursByIdUtilisateurs(tx DB, idUtilisateurs ...int64) (UtilisateurFournisseurs, error)
func (UtilisateurFournisseurs) ByIdFournisseur ¶
func (items UtilisateurFournisseurs) ByIdFournisseur() map[int64]UtilisateurFournisseurs
ByIdFournisseur returns a map with 'IdFournisseur' as keys.
func (UtilisateurFournisseurs) ByIdUtilisateur ¶
func (items UtilisateurFournisseurs) ByIdUtilisateur() map[int64]UtilisateurFournisseurs
ByIdUtilisateur returns a map with 'IdUtilisateur' as keys.
type Utilisateurs ¶
type Utilisateurs map[int64]Utilisateur
func ScanUtilisateurs ¶
func ScanUtilisateurs(rs *sql.Rows) (Utilisateurs, error)
func SelectAllUtilisateurs ¶
func SelectAllUtilisateurs(tx DB) (Utilisateurs, error)
func SelectUtilisateurs ¶
func SelectUtilisateurs(tx DB, ids ...int64) (Utilisateurs, error)
SelectUtilisateurs returns the entry matching the given ids.
func (Utilisateurs) Ids ¶
func (m Utilisateurs) Ids() Ids