model

package
v0.0.0-...-76e1f33 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapApiVehicleForSaleAmount_Custom

func MapApiVehicleForSaleAmount_Custom(amount decimal.Decimal) string

Custom API map function for VehicleForSale.Amount from model to API

func MapApiVehicleForSaleDuration

func MapApiVehicleForSaleDuration(duration time.Duration) int

Custom API map function for VehicleForSale.Duration from model to API

func MapVehicleForSaleAmount_Custom

func MapVehicleForSaleAmount_Custom(apiAmount string) decimal.Decimal

Custom map function for VehicleForSale.Amount from API to model

func MapVehicleForSaleDuration

func MapVehicleForSaleDuration(apiDuration int) time.Duration

Custom map function for VehicleForSale.Duration from API to model

Types

type Manufacturer

type Manufacturer struct {
	gorm.Model
	Name     string
	Vehicles []VehicleModel
}

A vehicle manufacturer, like Chevrolet

type Part

type Part struct {
	gorm.Model
	Name   string
	Cost   int
	Models []VehicleModel `gorm:"many2many:model_parts;"`
}

A vehicle part for one or more models, like a muffler for all Chevrolet pickups

type Person

type Person struct {
	gorm.Model
	Name string
}

A person, who may drive a vehicle

type Vehicle

type Vehicle struct {
	gorm.Model
	Vin            string `gorm:"uniqueIndex"`
	VehicleModelID uint
	VehicleModel   VehicleModel
	PersonID       uint
	Person         Person
}

An individual of a model, like Joe's Chevrolet Silverado

type VehicleForSale

type VehicleForSale struct {
	gorm.Model
	VehicleID uint
	Vehicle   Vehicle
	Amount    decimal.Decimal `` /* 134-byte string literal not displayed */
	Duration  time.Duration   `goalesce:"openapi_type:integer;"`
}

A vehicle for sale

type VehicleModel

type VehicleModel struct {
	gorm.Model
	Name           string
	ManufacturerID uint
	Manufacturer   Manufacturer
	Parts          []Part `gorm:"many2many:vehicle_parts;"`
}

A vehicle model, like a Chevrolet Silverado

Jump to

Keyboard shortcuts

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