20 lines
657 B
Go
20 lines
657 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Media struct {
|
|
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
ProductID int `gorm:"column:product_id" json:"product_id"`
|
|
Type string `gorm:"column:type" json:"type"`
|
|
URL string `gorm:"column:url" json:"url"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
}
|
|
|
|
func (Media) TableName() string { return "media" }
|
|
|
|
// Méthodes pour l'interface Database
|
|
func (m *Media) GetProductID() int { return m.ProductID }
|
|
func (m *Media) GetType() string { return m.Type }
|
|
func (m *Media) GetURL() string { return m.URL }
|
|
func (m *Media) SetID(id int) { m.ID = id }
|