models

package
v0.0.0-...-41b6ebc Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCategoryData

func ValidateCategoryData(category *Category) error

func ValidateVideoData

func ValidateVideoData(video *Video) error

Types

type Category

type Category struct {
	gorm.Model
	Title  string  `json:"title" validate:"nonzero,nonnil"`
	Color  string  `json:"color" validate:"nonzero,nonnil"`
	Videos []Video `json:"videos"`
}

func (*Category) BeforeDelete

func (c *Category) BeforeDelete(tx *gorm.DB) (err error)

type Video

type Video struct {
	gorm.Model
	Title       string `json:"title" validate:"nonzero,nonnil"`
	Description string `json:"description" validate:"nonzero,nonnil"`
	URL         string `json:"url" validate:"nonzero,nonnil"`
	CategoryID  uint   `json:"category_id" validate:"nonzero,nonnil" gorm:"index;default:1"`
}

Jump to

Keyboard shortcuts

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