models

package
v0.0.0-...-ed45f99 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	gorm.Model
	AuthorID uint64 `gorm:"primaryKey"`
	Name     string `json:"name"`
	Bio      string `json:"bio"`
	Username string `json:"username" gorm:"unique"`
	Blogs    []Blog `json:"blogs"`
}

type Blog

type Blog struct {
	gorm.Model
	BlogID    uint64    `gorm:"primaryKey"`
	Title     string    `json:"title"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	AuthorID  uint      `json:"-"`
	Author    Author    `json:"author"`
}

func (*Blog) BeforeCreate

func (b *Blog) BeforeCreate(tx *gorm.DB) (err error)

func (*Blog) BeforeUpdate

func (b *Blog) BeforeUpdate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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