Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Author struct { ID uint64 `json:"id" gorm:"primaryKey;autoIncrement;->"` Firstname string `json:"firstname" gorm:"size:255" validate:"required,min=1,max=255"` Surname string `json:"surname" gorm:"size:255" validate:"required,min=1,max=255"` }
Author represents an author entity with ID, Firstname, and Surname.
type Book ¶ added in v0.8.0
type Book struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` BranchID uint `json:"branch_id"` Branch *Branch `json:"branch" gorm:"foreignKey:BranchID"` Added time.Time `json:"added"` Title string `json:"title" gorm:"type:varchar(255);not null" validate:"required"` ShortDescription string `json:"short_description"` Author []*Author `json:"authors" gorm:"many2many:book_author;"` GenreID uint `json:"genre_id" gorm:"index"` Genre *Genre `json:"genre" gorm:"foreignKey:GenreID"` Price float32 `json:"price" gorm:"default:0.00"` Sold bool `json:"sold" gorm:"default:false"` SoldOn time.Time `json:"sold_on,omitempty"` Removed bool `json:"removed" gorm:"default:false"` RemovedOn time.Time `json:"removed_on,omitempty"` Reserved bool `json:"reserved" gorm:"default:false"` ReservedAt time.Time `json:"reserved_at,omitempty"` ReleaseYear int `json:"published_date" validate:"release_year"` Condition *Condition `json:"condition" gorm:"foreignKey:ConditionID"` ConditionID uint `json:"condition_id"` Tags []*Tag `json:"tags" gorm:"many2many:book_tag;"` Recommendation bool `json:"recommendations" gorm:"foreignKey:BookID"` Inventory bool `json:"inventory" gorm:"default:false"` Format *Format `json:"format" gorm:"foreignKey:FormatID"` FormatID uint `json:"format_id" gorm:"not null"` Subtitle string `json:"subtitle" validate:"max=255"` Duplicate bool `gorm:"default:false"` ReservationID uuid.UUID `json:"reservation_id"` Reservation *Reservation `json:"reservation" gorm:"foreignKey:ReservationID"` }
Book represents a book entity.
type Branch ¶ added in v0.6.0
type Branch struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` Name string `json:"name" validate:"required,max=255"` Steps float32 `json:"steps" validate:"gte=0.00" gorm:"default:0.00"` Currency string `json:"currency" validate:"required,oneof=EUR USD" gorm:"default:'EUR'"` Ordering string `json:"ordering" gorm:"type:text"` Public bool `json:"public" gorm:"default:false"` Pricelist string `json:"pricelist" gorm:"type:text"` Cart bool `json:"cart" gorm:"default:false"` Content string `json:"content" gorm:"type:text"` }
Branch represents a branch entity with various attributes.
type Condition ¶ added in v0.7.0
type Condition struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` Name string `json:"name" gorm:"type:varchar(255);not null;unique" validate:"required,min=1,max=255"` BranchID uint `json:"branch_id" gorm:"index"` Branch Branch `json:"branch" gorm:"foreignKey:BranchID"` }
Condition model represents a book's condition.
type Format ¶ added in v0.11.0
type Format struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` Name string `json:"name" validate:"required,min=1,max=255"` BranchID uint `json:"branch_id" gorm:"index"` Branch Branch `json:"branch" gorm:"foreignKey:BranchID"` Books []Book `json:"-" gorm:"foreignKey:FormatID"` }
Format represents a book format entity.
type Genre ¶ added in v0.9.0
type Genre struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` Name string `json:"name" gorm:"type:varchar(255);not null" validate:"required,min=1,max=255"` BranchID uint `json:"branch_id" gorm:"index"` Branch Branch `json:"branch" gorm:"foreignKey:BranchID"` }
Genre represents a genre entity.
type Reservation ¶ added in v0.11.0
type Reservation struct { ID string `json:"id" gorm:"primaryKey"` BranchID uint `json:"branch_id" gorm:"index"` Branch Branch `json:"branch" gorm:"foreignKey:BranchID"` CreatedAt time.Time `json:"created_at"` Notes string `json:"notes"` Books []*Book `json:"books" gorm:"foreignKey:ReservationID"` Salutation string `json:"salutation" validate:"required,oneof=m f d"` Firstname string `json:"firstname" validate:"required,max=255"` Surname string `json:"surname" validate:"required,max=255"` Mail string `json:"mail" validate:"required,email,max=255"` Phone string `json:"phone" validate:"max=255"` Open bool `json:"open" gorm:"default:true"` }
Reservation represents a reservation.
func (*Reservation) BeforeCreate ¶ added in v0.11.0
func (r *Reservation) BeforeCreate(tx *gorm.DB) (err error)
BeforeCreate hook for Reservation model.
func (Reservation) TableName ¶ added in v0.11.0
func (Reservation) TableName() string
TableName overrides the default table name for the Reservation model.
type Tabler ¶ added in v0.6.0
type Tabler interface {
TableName() string
}
Tabler interface for table name.
type Tag ¶ added in v0.8.0
type Tag struct { ID uint `json:"id" gorm:"primaryKey;autoIncrement;->"` Name string `json:"name" validate:"required,max=255"` BranchID uint `json:"branch_id" gorm:"index"` Branch Branch `json:"branch" gorm:"foreignKey:BranchID"` Books []*Book `json:"books" gorm:"many2many:book_tag;"` }
Tag represents a tag model.
Click to show internal directories.
Click to hide internal directories.