model

package
v0.0.0-...-81a73e7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB

Functions

This section is empty.

Types

type Article

type Article struct {
	Id      int       `json:"id"`
	Content string    `sql:"not null" json:"content"`
	UserId  int       `sql:"index" json:"user_id"`
	Ctime   time.Time `json:"ctime"`
}

func GetAllArticles

func GetAllArticles() (arts []Article, err error)

func (*Article) Add

func (a *Article) Add() (err error)

func (*Article) Delete

func (a *Article) Delete() (err error)

func (*Article) Get

func (a *Article) Get() (err error)

func (*Article) Update

func (a *Article) Update() (err error)

type Comment

type Comment struct {
	Id      int
	Content string `sql:"not null"`
	UserId  int    `sql:"index"`
	ArtId   int    `sql:"index"`
	Ctime   time.Time
}

func GetCommentsByArtId

func GetCommentsByArtId(artId int) (cmts []Comment, err error)

func (*Comment) Add

func (c *Comment) Add()

type User

type User struct {
	Id       int
	Name     string `sql:"not null"`
	Password string `sql:"not null"`
	Ctime    time.Time
}

func CheckLogin

func CheckLogin(uname string, pwd string) (u User, ok bool)

func (*User) CheckPassword

func (u *User) CheckPassword(pwd string) bool

func (*User) Get

func (u *User) Get()

func (*User) GetByName

func (u *User) GetByName()

func (*User) String

func (u *User) String() string

Jump to

Keyboard shortcuts

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