blog

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	UUIDModel
	Title     string
	Content   string
	CreatorID uuid.UUID
	Creator   *User     `gorm:"ForeignKey:CreatorID"`
	Comments  []Comment `gorm:"many2many:comments;"`
}

Blog blog model

type Comment

type Comment struct {
	UUIDModel
	Content   string
	CreatorID uuid.UUID
	Creator   *User `gorm:"ForeignKey:CreatorID"`
}

Comment comment model

type UUIDModel

type UUIDModel struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4();column:id"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

UUIDModel corresponds to gorm.Model with ID replaced by uuid

func (*UUIDModel) BeforeCreate

func (u *UUIDModel) BeforeCreate(scope *gorm.Scope) error

BeforeCreate callback for gorm model create hook

type User

type User struct {
	UUIDModel
	Name    string
	Email   string
	Enabled bool
}

User user

Directories

Path Synopsis
api
v1
Package v1 is a reverse proxy.
Package v1 is a reverse proxy.
protocol
service
v1

Jump to

Keyboard shortcuts

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