Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllBikes ¶
GetAllBikes will return all the bikes with the pagination asked
Types ¶
type Bike ¶
type Bike struct {
// add basic ID/Created@/Updated@/Delete@ through Gorm
gorm.Model
Name string `gorm:"uniqueIndex:bike_uniqueness"`
Brand Brand
BrandID int `json:"-" gorm:"uniqueIndex:bike_uniqueness"`
Year string `gorm:"uniqueIndex:bike_uniqueness"`
Description string
Image []Image `gorm:"many2many:bike_images"`
Components []Component `gorm:"many2many:bike_components;"`
SupportedStandard []standards.Standard `gorm:"-"`
PutNotSupported
}
Bike contains the defintion of the bike and all its attached components
type Brand ¶
type Brand struct {
gorm.Model
Name string
Description string
Image int
CreationYear int
EndYear int
Country string
PutNotSupported
DeleteNotSupported
}
Brand hold the brand defintion
type Component ¶
type Component struct {
// add basic ID/Created@/Updated@/Delete@ through Gorm
gorm.Model
Name string `gorm:"uniqueIndex:component_uniqueness"`
Brand Brand
BrandID int `json:"-" gorm:"uniqueIndex:component_uniqueness"`
Type ComponentType
TypeID int `json:"-"`
Description string
Standards []standards.Standard `gorm:"many2many:component_standards"`
Images []Image `gorm:"many2many:component_images"`
Year string `gorm:"uniqueIndex:component_uniqueness"`
PutNotSupported
DeleteNotSupported
}
Component : Generic struct to regroup most common properties
type ComponentInt ¶
type ComponentInt interface {
GetName() string
GetBrand() Brand
GetType() ComponentType
GetDescription() string
GetStandards() []standards.StandardInt
GetImages() []Image
}
ComponentInt : the standard COmponent interface that needs to complies to in order to be a component
type ComponentType ¶
ComponentType is the defintion of the type of bike component
type DeleteNotSupported ¶
type DeleteNotSupported struct{}
DeleteNotSupported default response when you cannot Get the resource
type GetNotSupported ¶
type GetNotSupported struct{}
GetNotSupported default response when you cannot Get the resource
type Image ¶
type Image struct {
gorm.Model
Name string `gorm:"uniqueIndex:image_uniqueness"`
Path string `gorm:"uniqueIndex:image_uniqueness"`
Type string
ContentType string
ContentLength int64
Content []byte `sql:"-"`
PutNotSupported
DeleteNotSupported
}
Image is the description and the pointer to the image
type PostNotSupported ¶
type PostNotSupported struct{}
PostNotSupported default response when you cannot Post the resource
type PutNotSupported ¶
type PutNotSupported struct{}
PutNotSupported default response when you cannot Get the resource
func (PutNotSupported) Put ¶
func (PutNotSupported) Put(db *gorm.DB, values url.Values, body io.ReadCloser) (int, interface{})
Put returns a 405