models

package
v0.0.0-...-2b1565b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUsernameByID

func GetUsernameByID(id uint) (string, error)

Types

type Article

type Article struct {
	gorm.Model

	UserID uint
	Author string

	Title     string `gorm:"type:varchar(255)"`
	Content   string `gorm:"type:text"`
	Published bool

	Rank int
}

type ArticleResponse

type ArticleResponse struct {
	ID        uint
	Author    string
	Title     string `gorm:"type:varchar(255)"`
	Published bool
	Rank      int

	CreatedAgo string
}

type ArticleTag

type ArticleTag struct {
	gorm.Model

	ArticleID int64
	TagID     int64
}

type Tag

type Tag struct {
	gorm.Model

	Name string `gorm:"type:varchar(255);unique"`
}

type User

type User struct {
	gorm.Model

	Username          string `gorm:"type:varchar(255);unique"`
	Password          string `gorm:"type:varchar(255)"`
	ApiToken          string `gorm:"type:varchar(255)"`
	ApiTokenExpiresAt time.Time
	IsAdmin           bool
}

func (*User) Articles

func (u *User) Articles() []ArticleResponse

Jump to

Keyboard shortcuts

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