github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/core/rawdata/data_test.go (about) 1 package rawdata 2 3 import ( 4 "math/rand" 5 "time" 6 7 "github.com/lib/pq" 8 ) 9 10 func randint64() int64 { 11 return int64(rand.Intn(1000000)) 12 } 13 14 func randfloat64() float64 { 15 return rand.Float64() * float64(rand.Int31()) 16 } 17 18 func randEuros() Euros { 19 return Euros(randfloat64()) 20 } 21 22 func randbool() bool { 23 i := rand.Int31n(2) 24 return i == 1 25 } 26 27 func randBool() Bool { 28 return Bool(randbool()) 29 } 30 31 func randint() int { 32 return int(rand.Intn(1000000)) 33 } 34 35 func randInt() Int { 36 return Int(randint()) 37 } 38 39 func randAide() Aide { 40 return Aide{ 41 Id: randint64(), 42 IdStructureaide: randint64(), 43 IdParticipant: randint64(), 44 Valeur: randEuros(), 45 Valide: randBool(), 46 ParJour: randBool(), 47 NbJoursMax: randInt(), 48 } 49 } 50 51 var letterRunes2 = []rune("azertyuiopqsdfghjklmwxcvbn123456789é@!?&èïab ") 52 53 func randstring() string { 54 b := make([]rune, 50) 55 maxLength := len(letterRunes2) 56 for i := range b { 57 b[i] = letterRunes2[rand.Intn(maxLength)] 58 } 59 return string(b) 60 } 61 62 func randString() String { 63 return String(randstring()) 64 } 65 66 func randTrajetBus() TrajetBus { 67 return TrajetBus{ 68 RendezVous: randString(), 69 Prix: randEuros(), 70 } 71 } 72 73 func randBusCamp() BusCamp { 74 return BusCamp{ 75 Actif: randbool(), 76 Commentaire: randString(), 77 Aller: randTrajetBus(), 78 Retour: randTrajetBus(), 79 } 80 } 81 82 func randMaterielSkiCamp() MaterielSkiCamp { 83 return MaterielSkiCamp{ 84 Actif: randbool(), 85 PrixAcve: randEuros(), 86 PrixLoueur: randEuros(), 87 } 88 } 89 90 func randOptionsCamp() OptionsCamp { 91 return OptionsCamp{ 92 Bus: randBusCamp(), 93 MaterielSki: randMaterielSkiCamp(), 94 } 95 } 96 97 func randtTime() time.Time { 98 return time.Unix(int64(rand.Int31()), 5) 99 } 100 101 func randDate() Date { 102 return Date(randtTime()) 103 } 104 105 func randVetement() Vetement { 106 return Vetement{ 107 Quantite: randint(), 108 Description: randstring(), 109 Obligatoire: randbool(), 110 } 111 } 112 113 func randSliceVetement() []Vetement { 114 l := rand.Intn(10) 115 out := make([]Vetement, l) 116 for i := range out { 117 out[i] = randVetement() 118 } 119 return out 120 } 121 122 func randListeVetements() ListeVetements { 123 return ListeVetements{ 124 Liste: randSliceVetement(), 125 Complement: randstring(), 126 } 127 } 128 129 func randSchemaPaiement() SchemaPaiement { 130 choix := [...]SchemaPaiement{SPAcompte, SPTotal} 131 i := rand.Intn(len(choix)) 132 return choix[i] 133 } 134 135 func randEnvois() Envois { 136 return Envois{ 137 Locked: randbool(), 138 LettreDirecteur: randbool(), 139 ListeVetements: randbool(), 140 ListeParticipants: randbool(), 141 } 142 } 143 144 func randPlage() Plage { 145 return Plage{ 146 From: randDate(), 147 To: randDate(), 148 } 149 } 150 151 func randOptionSemaineCamp() OptionSemaineCamp { 152 return OptionSemaineCamp{ 153 Plage1: randPlage(), 154 Plage2: randPlage(), 155 Prix1: randEuros(), 156 Prix2: randEuros(), 157 } 158 } 159 160 func randPrixParStatut() PrixParStatut { 161 return PrixParStatut{ 162 Id: randint64(), 163 Prix: randEuros(), 164 Statut: randString(), 165 Description: randString(), 166 } 167 } 168 169 func randSlicePrixParStatut() []PrixParStatut { 170 l := rand.Intn(10) 171 out := make([]PrixParStatut, l) 172 for i := range out { 173 out[i] = randPrixParStatut() 174 } 175 return out 176 } 177 178 func randSliceEuros() []Euros { 179 l := rand.Intn(10) 180 out := make([]Euros, l) 181 for i := range out { 182 out[i] = randEuros() 183 } 184 return out 185 } 186 187 func randArray4Euros() [4]Euros { 188 var out [4]Euros 189 for i := range out { 190 out[i] = randEuros() 191 } 192 return out 193 } 194 195 func randOptionPrixCamp() OptionPrixCamp { 196 return OptionPrixCamp{ 197 Active: randstring(), 198 Semaine: randOptionSemaineCamp(), 199 Statut: randSlicePrixParStatut(), 200 Jour: randSliceEuros(), 201 QuotientFamilial: randArray4Euros(), 202 } 203 } 204 205 func randCamp() Camp { 206 return Camp{ 207 Id: randint64(), 208 Lieu: randString(), 209 Nom: randString(), 210 Prix: randEuros(), 211 NbPlaces: randInt(), 212 Password: randString(), 213 Ouvert: randBool(), 214 NbPlacesReservees: randInt(), 215 NumeroJS: randString(), 216 NeedEquilibreGf: randBool(), 217 AgeMin: randInt(), 218 AgeMax: randInt(), 219 Options: randOptionsCamp(), 220 DateDebut: randDate(), 221 DateFin: randDate(), 222 ListeVetements: randListeVetements(), 223 SchemaPaiement: randSchemaPaiement(), 224 JoomeoAlbumId: randString(), 225 Envois: randEnvois(), 226 LienCompta: randString(), 227 OptionPrix: randOptionPrixCamp(), 228 InscriptionSimple: randBool(), 229 Infos: randString(), 230 } 231 } 232 233 func randCampContrainte() CampContrainte { 234 return CampContrainte{ 235 IdCamp: randint64(), 236 IdContrainte: randint64(), 237 } 238 } 239 240 func randuint8() uint8 { 241 return uint8(rand.Intn(1000000)) 242 } 243 244 func randSliceuint8() []byte { 245 l := rand.Intn(10) 246 out := make([]byte, l) 247 for i := range out { 248 out[i] = randuint8() 249 } 250 return out 251 } 252 253 func randContenuDocument() ContenuDocument { 254 return ContenuDocument{ 255 IdDocument: randint64(), 256 Contenu: randSliceuint8(), 257 Miniature: randSliceuint8(), 258 } 259 } 260 261 func randOptionnalId() OptionnalId { 262 return OptionnalId{ 263 Int64: randint64(), 264 Valid: randbool(), 265 } 266 } 267 268 func randBuiltinContrainte() BuiltinContrainte { 269 choix := [...]BuiltinContrainte{CAutre, CBafa, CBafaEquiv, CBafd, CBafdEquiv, CCarteId, CCarteVitale, CCertMedCuisine, CHaccp, CInvalide, CPermis, CSb, CScolarite, CSecour, CTestNautique, CVaccin} 270 i := rand.Intn(len(choix)) 271 return choix[i] 272 } 273 274 func randContrainte() Contrainte { 275 return Contrainte{ 276 Id: randint64(), 277 IdPersonne: randOptionnalId(), 278 IdDocument: randOptionnalId(), 279 Builtin: randBuiltinContrainte(), 280 Nom: randString(), 281 Description: randString(), 282 MaxDocs: randint(), 283 JoursValide: randint(), 284 } 285 } 286 287 func randTaille() Taille { 288 return Taille(randint()) 289 } 290 291 func randTime() Time { 292 return Time(randtTime()) 293 } 294 295 func randDocument() Document { 296 return Document{ 297 Id: randint64(), 298 Taille: randTaille(), 299 NomClient: randString(), 300 Description: randString(), 301 DateHeureModif: randTime(), 302 } 303 } 304 305 func randDocumentAide() DocumentAide { 306 return DocumentAide{ 307 IdDocument: randint64(), 308 IdAide: randint64(), 309 } 310 } 311 312 func randDocumentCamp() DocumentCamp { 313 return DocumentCamp{ 314 IdDocument: randint64(), 315 IdCamp: randint64(), 316 IsLettre: randbool(), 317 } 318 } 319 320 func randDocumentPersonne() DocumentPersonne { 321 return DocumentPersonne{ 322 IdDocument: randint64(), 323 IdPersonne: randint64(), 324 IdContrainte: randint64(), 325 } 326 } 327 328 func randModePaiment() ModePaiment { 329 choix := [...]ModePaiment{MPAncv, MPAucun, MPCarte, MPCheque, MPEspece, MPHelloasso, MPVirement} 330 i := rand.Intn(len(choix)) 331 return choix[i] 332 } 333 334 func randInfoDon() InfoDon { 335 return InfoDon{ 336 IdPaiementHelloAsso: randstring(), 337 } 338 } 339 340 func randDon() Don { 341 return Don{ 342 Id: randint64(), 343 Valeur: randEuros(), 344 ModePaiement: randModePaiment(), 345 DateReception: randDate(), 346 RecuEmis: randDate(), 347 Infos: randInfoDon(), 348 Remercie: randBool(), 349 Details: randString(), 350 Affectation: randString(), 351 } 352 } 353 354 func randDonDonateur() DonDonateur { 355 return DonDonateur{ 356 IdDon: randint64(), 357 IdPersonne: randOptionnalId(), 358 IdOrganisme: randOptionnalId(), 359 } 360 } 361 362 func randRole() Role { 363 choix := [...]Role{RAdjoint, RAideAnimation, RAnimation, RAutre, RBabysiter, RChauffeur, RCuis, RDirecteur, RFactotum, RInfirm, RIntend, RLing, RMen} 364 i := rand.Intn(len(choix)) 365 return choix[i] 366 } 367 368 func randSliceRole() []Role { 369 l := rand.Intn(10) 370 out := make([]Role, l) 371 for i := range out { 372 out[i] = randRole() 373 } 374 return out 375 } 376 377 func randRoles() Roles { 378 return Roles(randSliceRole()) 379 } 380 381 func randDiplome() Diplome { 382 choix := [...]Diplome{DAgreg, DAssSociale, DAucun, DBafa, DBafaStag, DBafd, DBafdStag, DBapaat, DBeatep, DBjeps, DCap, DDeug, DDut, DEducSpe, DEje, DInstit, DMonEduc, DProf, DStaps, DZzautre} 383 i := rand.Intn(len(choix)) 384 return choix[i] 385 } 386 387 func randApprofondissement() Approfondissement { 388 choix := [...]Approfondissement{AAucun, AAutre, ACanoe, AMoto, ASb, AVoile} 389 i := rand.Intn(len(choix)) 390 return choix[i] 391 } 392 393 func randOptionnalPlage() OptionnalPlage { 394 return OptionnalPlage{ 395 Plage: randPlage(), 396 Active: randbool(), 397 } 398 } 399 400 func randInvitationEquipier() InvitationEquipier { 401 return InvitationEquipier(randint()) 402 } 403 404 func randOptionnalBool() OptionnalBool { 405 choix := [...]OptionnalBool{OBNon, OBOui, OBPeutEtre} 406 i := rand.Intn(len(choix)) 407 return choix[i] 408 } 409 410 func randEquipier() Equipier { 411 return Equipier{ 412 Id: randint64(), 413 IdCamp: randint64(), 414 IdPersonne: randint64(), 415 Roles: randRoles(), 416 Diplome: randDiplome(), 417 Appro: randApprofondissement(), 418 Presence: randOptionnalPlage(), 419 InvitationEquipier: randInvitationEquipier(), 420 Charte: randOptionnalBool(), 421 } 422 } 423 424 func randEquipierContrainte() EquipierContrainte { 425 return EquipierContrainte{ 426 IdEquipier: randint64(), 427 IdContrainte: randint64(), 428 Optionnel: randbool(), 429 } 430 } 431 432 func randSexe() Sexe { 433 choix := [...]Sexe{SAucun, SFemme, SHomme} 434 i := rand.Intn(len(choix)) 435 return choix[i] 436 } 437 438 func randDestinataire() Destinataire { 439 return Destinataire{ 440 NomPrenom: randString(), 441 Sexe: randSexe(), 442 Adresse: randString(), 443 CodePostal: randString(), 444 Ville: randString(), 445 } 446 } 447 448 func randSliceDestinataire() []Destinataire { 449 l := rand.Intn(10) 450 out := make([]Destinataire, l) 451 for i := range out { 452 out[i] = randDestinataire() 453 } 454 return out 455 } 456 457 func randDestinatairesOptionnels() DestinatairesOptionnels { 458 return DestinatairesOptionnels(randSliceDestinataire()) 459 } 460 461 func randSlicestring() []string { 462 l := rand.Intn(10) 463 out := make([]string, l) 464 for i := range out { 465 out[i] = randstring() 466 } 467 return out 468 } 469 470 func randStringArray() pq.StringArray { 471 return pq.StringArray(randSlicestring()) 472 } 473 474 func randFacture() Facture { 475 return Facture{ 476 Id: randint64(), 477 IdPersonne: randint64(), 478 DestinatairesOptionnels: randDestinatairesOptionnels(), 479 Key: randString(), 480 CopiesMails: randStringArray(), 481 LastConnection: randtTime(), 482 IsConfirmed: randbool(), 483 IsValidated: randbool(), 484 PartageAdressesOK: randbool(), 485 } 486 } 487 488 func randGroupe() Groupe { 489 return Groupe{ 490 Id: randint64(), 491 IdCamp: randint64(), 492 Nom: randString(), 493 Plage: randPlage(), 494 Couleur: randstring(), 495 isSimple: randbool(), 496 } 497 } 498 499 func randGroupeContrainte() GroupeContrainte { 500 return GroupeContrainte{ 501 IdGroupe: randint64(), 502 IdContrainte: randint64(), 503 } 504 } 505 506 func randGroupeEquipier() GroupeEquipier { 507 return GroupeEquipier{ 508 IdGroupe: randint64(), 509 IdEquipier: randint64(), 510 IdCamp: randint64(), 511 } 512 } 513 514 func randGroupeParticipant() GroupeParticipant { 515 return GroupeParticipant{ 516 IdParticipant: randint64(), 517 IdGroupe: randint64(), 518 IdCamp: randint64(), 519 Manuel: randbool(), 520 } 521 } 522 523 func randImageuploaded() Imageuploaded { 524 return Imageuploaded{ 525 IdCamp: randint64(), 526 Filename: randstring(), 527 Lien: randstring(), 528 Content: randSliceuint8(), 529 } 530 } 531 532 func randIdentificationId() IdentificationId { 533 return IdentificationId{ 534 Valid: randbool(), 535 Id: randint64(), 536 Crypted: randstring(), 537 } 538 } 539 540 func randTels() Tels { 541 return Tels(randSlicestring()) 542 } 543 544 func randResponsableLegal() ResponsableLegal { 545 return ResponsableLegal{ 546 Lienid: randIdentificationId(), 547 Nom: randString(), 548 Prenom: randString(), 549 Sexe: randSexe(), 550 Mail: randString(), 551 Adresse: randString(), 552 CodePostal: randString(), 553 Ville: randString(), 554 Tels: randTels(), 555 DateNaissance: randDate(), 556 Pays: randString(), 557 } 558 } 559 560 func randBus() Bus { 561 choix := [...]Bus{BAller, BAllerRetour, BAucun, BRetour} 562 i := rand.Intn(len(choix)) 563 return choix[i] 564 } 565 566 func randMaterielSki() MaterielSki { 567 return MaterielSki{ 568 Need: randstring(), 569 Mode: randstring(), 570 Casque: randbool(), 571 Poids: randint(), 572 Taille: randint(), 573 Pointure: randint(), 574 } 575 } 576 577 func randOptionsParticipant() OptionsParticipant { 578 return OptionsParticipant{ 579 Bus: randBus(), 580 MaterielSki: randMaterielSki(), 581 } 582 } 583 584 func randSemaine() Semaine { 585 choix := [...]Semaine{SComplet, SSe1, SSe2} 586 i := rand.Intn(len(choix)) 587 return choix[i] 588 } 589 590 func randSliceint() []int { 591 l := rand.Intn(10) 592 out := make([]int, l) 593 for i := range out { 594 out[i] = randint() 595 } 596 return out 597 } 598 599 func randJours() Jours { 600 return Jours(randSliceint()) 601 } 602 603 func randOptionPrixParticipant() OptionPrixParticipant { 604 return OptionPrixParticipant{ 605 Semaine: randSemaine(), 606 Statut: randint64(), 607 QuotientFamilial: randInt(), 608 Jour: randJours(), 609 } 610 } 611 612 func randParticipantInscription() ParticipantInscription { 613 return ParticipantInscription{ 614 Lienid: randIdentificationId(), 615 Nom: randString(), 616 Prenom: randString(), 617 DateNaissance: randDate(), 618 Sexe: randSexe(), 619 IdCamp: randint64(), 620 Options: randOptionsParticipant(), 621 OptionsPrix: randOptionPrixParticipant(), 622 } 623 } 624 625 func randSliceParticipantInscription() []ParticipantInscription { 626 l := rand.Intn(10) 627 out := make([]ParticipantInscription, l) 628 for i := range out { 629 out[i] = randParticipantInscription() 630 } 631 return out 632 } 633 634 func randParticipantInscriptions() ParticipantInscriptions { 635 return ParticipantInscriptions(randSliceParticipantInscription()) 636 } 637 638 func randInscription() Inscription { 639 return Inscription{ 640 Id: randint64(), 641 Info: randString(), 642 DateHeure: randTime(), 643 CopiesMails: randStringArray(), 644 Responsable: randResponsableLegal(), 645 Participants: randParticipantInscriptions(), 646 PartageAdressesOK: randbool(), 647 } 648 } 649 650 func randLettredirecteur() Lettredirecteur { 651 return Lettredirecteur{ 652 IdCamp: randint64(), 653 Html: randstring(), 654 UseCoordCentre: randbool(), 655 ShowAdressePostale: randbool(), 656 ColorCoord: randstring(), 657 } 658 } 659 660 func randMessageKind() MessageKind { 661 choix := [...]MessageKind{MAccuseReception, MAttestationPresence, MCentre, MDocuments, MFacture, MFactureAcquittee, MInscription, MPaiement, MPlaceLiberee, MResponsable, MSondage, MSupprime} 662 i := rand.Intn(len(choix)) 663 return choix[i] 664 } 665 666 func randMessage() Message { 667 return Message{ 668 Id: randint64(), 669 IdFacture: randint64(), 670 Kind: randMessageKind(), 671 Created: randTime(), 672 Modified: randTime(), 673 Vu: randbool(), 674 } 675 } 676 677 func randDistribution() Distribution { 678 choix := [...]Distribution{DEspacePerso, DMail, DMailAndDownload} 679 i := rand.Intn(len(choix)) 680 return choix[i] 681 } 682 683 func randMessageAttestation() MessageAttestation { 684 return MessageAttestation{ 685 IdMessage: randint64(), 686 Distribution: randDistribution(), 687 GuardKind: randMessageKind(), 688 } 689 } 690 691 func randMessageDocument() MessageDocument { 692 return MessageDocument{ 693 IdMessage: randint64(), 694 IdCamp: randint64(), 695 guardKind: randMessageKind(), 696 } 697 } 698 699 func randMessageMessage() MessageMessage { 700 return MessageMessage{ 701 IdMessage: randint64(), 702 Contenu: randString(), 703 GuardKind: randMessageKind(), 704 } 705 } 706 707 func randMessagePlacelibere() MessagePlacelibere { 708 return MessagePlacelibere{ 709 IdMessage: randint64(), 710 IdParticipant: randint64(), 711 guardKind: randMessageKind(), 712 } 713 } 714 715 func randMessageSondage() MessageSondage { 716 return MessageSondage{ 717 IdMessage: randint64(), 718 IdCamp: randint64(), 719 guardKind: randMessageKind(), 720 isSimple: randbool(), 721 } 722 } 723 724 func randCoordonnees() Coordonnees { 725 return Coordonnees{ 726 Tels: randTels(), 727 Mail: randString(), 728 Adresse: randString(), 729 CodePostal: randString(), 730 Ville: randString(), 731 Pays: randString(), 732 } 733 } 734 735 func randExemplaires() Exemplaires { 736 return Exemplaires{ 737 PubEte: randint(), 738 PubHiver: randint(), 739 EchoRocher: randint(), 740 } 741 } 742 743 func randOrganisme() Organisme { 744 return Organisme{ 745 Id: randint64(), 746 Nom: randString(), 747 ContactPropre: randBool(), 748 Contact: randCoordonnees(), 749 IdContact: randOptionnalId(), 750 IdContactDon: randOptionnalId(), 751 Exemplaires: randExemplaires(), 752 } 753 } 754 755 func randPaiement() Paiement { 756 return Paiement{ 757 Id: randint64(), 758 IdFacture: randint64(), 759 IsAcompte: randBool(), 760 IsRemboursement: randBool(), 761 InBordereau: randTime(), 762 LabelPayeur: randString(), 763 NomBanque: randString(), 764 ModePaiement: randModePaiment(), 765 Numero: randString(), 766 Valeur: randEuros(), 767 IsInvalide: randBool(), 768 DateReglement: randTime(), 769 Details: randString(), 770 } 771 } 772 773 func randStatutAttente() StatutAttente { 774 choix := [...]StatutAttente{Attente, AttenteReponse, Inscrit, Refuse} 775 i := rand.Intn(len(choix)) 776 return choix[i] 777 } 778 779 func randListeAttente() ListeAttente { 780 return ListeAttente{ 781 Statut: randStatutAttente(), 782 Raison: randstring(), 783 } 784 } 785 786 func randPourcent() Pourcent { 787 return Pourcent(randint()) 788 } 789 790 func randRemises() Remises { 791 return Remises{ 792 ReducEquipiers: randPourcent(), 793 ReducEnfants: randPourcent(), 794 ReducSpeciale: randEuros(), 795 } 796 } 797 798 func randParticipant() Participant { 799 return Participant{ 800 Id: randint64(), 801 IdCamp: randint64(), 802 IdPersonne: randint64(), 803 IdFacture: randOptionnalId(), 804 ListeAttente: randListeAttente(), 805 Remises: randRemises(), 806 OptionPrix: randOptionPrixParticipant(), 807 Options: randOptionsParticipant(), 808 DateHeure: randTime(), 809 isSimple: randbool(), 810 } 811 } 812 813 func randParticipantEquipier() ParticipantEquipier { 814 return ParticipantEquipier{ 815 IdParticipant: randint64(), 816 IdEquipier: randint64(), 817 IdGroupe: randint64(), 818 } 819 } 820 821 func randParticipantsimple() Participantsimple { 822 return Participantsimple{ 823 Id: randint64(), 824 IdPersonne: randint64(), 825 IdCamp: randint64(), 826 DateHeure: randTime(), 827 Info: randString(), 828 isSimple: randbool(), 829 } 830 } 831 832 func randDepartement() Departement { 833 return Departement(randstring()) 834 } 835 836 func randBasePersonne() BasePersonne { 837 return BasePersonne{ 838 Nom: randString(), 839 NomJeuneFille: randString(), 840 Prenom: randString(), 841 DateNaissance: randDate(), 842 VilleNaissance: randString(), 843 DepartementNaissance: randDepartement(), 844 Sexe: randSexe(), 845 Tels: randTels(), 846 Mail: randString(), 847 Adresse: randString(), 848 CodePostal: randString(), 849 Ville: randString(), 850 Pays: randString(), 851 SecuriteSociale: randString(), 852 Profession: randString(), 853 Etudiant: randBool(), 854 Fonctionnaire: randBool(), 855 } 856 } 857 858 func randRangMembreAsso() RangMembreAsso { 859 choix := [...]RangMembreAsso{RMABureau, RMACA, RMAMembre, RMANonMembre} 860 i := rand.Intn(len(choix)) 861 return choix[i] 862 } 863 864 func randSliceint64() []int64 { 865 l := rand.Intn(10) 866 out := make([]int64, l) 867 for i := range out { 868 out[i] = randint64() 869 } 870 return out 871 } 872 873 func randCotisation() Cotisation { 874 return Cotisation(randSliceint64()) 875 } 876 877 func randMaladies() Maladies { 878 return Maladies{ 879 Rubeole: randbool(), 880 Varicelle: randbool(), 881 Angine: randbool(), 882 Oreillons: randbool(), 883 Scarlatine: randbool(), 884 Coqueluche: randbool(), 885 Otite: randbool(), 886 Rougeole: randbool(), 887 Rhumatisme: randbool(), 888 } 889 } 890 891 func randAllergies() Allergies { 892 return Allergies{ 893 Asthme: randbool(), 894 Alimentaires: randbool(), 895 Medicamenteuses: randbool(), 896 Autres: randstring(), 897 ConduiteATenir: randstring(), 898 } 899 } 900 901 func randMedecin() Medecin { 902 return Medecin{ 903 Nom: randstring(), 904 Tel: randstring(), 905 } 906 } 907 908 func randFicheSanitaire() FicheSanitaire { 909 return FicheSanitaire{ 910 TraitementMedical: randbool(), 911 Maladies: randMaladies(), 912 Allergies: randAllergies(), 913 DifficultesSante: randstring(), 914 Recommandations: randstring(), 915 Handicap: randbool(), 916 Tel: randstring(), 917 Medecin: randMedecin(), 918 LastModif: randTime(), 919 Mails: randSlicestring(), 920 } 921 } 922 923 func randPersonne() Personne { 924 return Personne{ 925 Id: randint64(), 926 BasePersonne: randBasePersonne(), 927 VersionPapier: randBool(), 928 PubHiver: randBool(), 929 PubEte: randBool(), 930 EchoRocher: randBool(), 931 RangMembreAsso: randRangMembreAsso(), 932 QuotientFamilial: randInt(), 933 Cotisation: randCotisation(), 934 Eonews: randBool(), 935 FicheSanitaire: randFicheSanitaire(), 936 IsTemporaire: randBool(), 937 } 938 } 939 940 func randSatisfaction() Satisfaction { 941 choix := [...]Satisfaction{SDécevant, SMoyen, SSatisfaisant, STressatisfaisant, SVide} 942 i := rand.Intn(len(choix)) 943 return choix[i] 944 } 945 946 func randRepSondage() RepSondage { 947 return RepSondage{ 948 InfosAvantSejour: randSatisfaction(), 949 InfosPendantSejour: randSatisfaction(), 950 Hebergement: randSatisfaction(), 951 Activites: randSatisfaction(), 952 Theme: randSatisfaction(), 953 Nourriture: randSatisfaction(), 954 Hygiene: randSatisfaction(), 955 Ambiance: randSatisfaction(), 956 Ressenti: randSatisfaction(), 957 MessageEnfant: randString(), 958 MessageResponsable: randString(), 959 } 960 } 961 962 func randSondage() Sondage { 963 return Sondage{ 964 Id: randint64(), 965 IdCamp: randint64(), 966 IdFacture: randint64(), 967 Modified: randtTime(), 968 RepSondage: randRepSondage(), 969 } 970 } 971 972 func randStructureaide() Structureaide { 973 return Structureaide{ 974 Id: randint64(), 975 Nom: randString(), 976 Immatriculation: randString(), 977 Adresse: randString(), 978 CodePostal: randString(), 979 Ville: randString(), 980 Telephone: randString(), 981 Info: randString(), 982 } 983 } 984 985 func randModules() Modules { 986 return Modules{ 987 Personnes: randint(), 988 Camps: randint(), 989 Inscriptions: randint(), 990 SuiviCamps: randint(), 991 SuiviDossiers: randint(), 992 Paiements: randint(), 993 Aides: randint(), 994 Equipiers: randint(), 995 Dons: randint(), 996 } 997 } 998 999 func randUser() User { 1000 return User{ 1001 Id: randint64(), 1002 Label: randString(), 1003 Mdp: randString(), 1004 IsAdmin: randBool(), 1005 Modules: randModules(), 1006 } 1007 }