vehicle.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package gofakeit
  2. // VehicleInfo is a struct dataset of all vehicle information
  3. type VehicleInfo struct {
  4. // Vehicle type
  5. VehicleType string
  6. // Fuel type
  7. Fuel string
  8. // Transmission type
  9. TransmissionGear string
  10. // Brand name
  11. Brand string
  12. // Vehicle model
  13. Model string
  14. // Vehicle model year
  15. Year int
  16. }
  17. // Vehicle will generate a struct with vehicle information
  18. func Vehicle() *VehicleInfo {
  19. return &VehicleInfo{
  20. VehicleType: VehicleType(),
  21. Fuel: FuelType(),
  22. TransmissionGear: TransmissionGearType(),
  23. Brand: CarMaker(),
  24. Model: CarModel(),
  25. Year: Year(),
  26. }
  27. }
  28. // VehicleType will generate a random vehicle type string
  29. func VehicleType() string {
  30. return getRandValue([]string{"vehicle", "vehicle_type"})
  31. }
  32. // FuelType will return a random fuel type
  33. func FuelType() string {
  34. return getRandValue([]string{"vehicle", "fuel_type"})
  35. }
  36. // TransmissionGearType will return a random transmission gear type
  37. func TransmissionGearType() string {
  38. return getRandValue([]string{"vehicle", "transmission_type"})
  39. }
  40. // CarMaker will return a random car maker
  41. func CarMaker() string {
  42. return getRandValue([]string{"vehicle", "maker"})
  43. }
  44. // CarModel will return a random car model
  45. func CarModel() string {
  46. return getRandValue([]string{"vehicle", "model"})
  47. }