You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
615 B
Go

package database
import "time"
type Book struct {
ID uint `gorm:"primaryKey"`
Title string `gorm:"not null"`
Author string `gorm:"not null"`
PublishedAt time.Time `gorm:"not null" json:"published_at"`
Edition string
Description string
Genre string
CreatedAt time.Time
UpdatedAt time.Time
}
type Collection struct {
ID uint `gorm:"primaryKey"`
Name string `gorm:"not null"`
Books []Book `gorm:"many2many:collection_books;"`
CreatedAt time.Time
UpdatedAt time.Time
}
type CollectionBook struct {
CollectionID uint
BookID uint
}