models

package
v0.0.0-...-6599ed9 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache = cache.New(1*time.Hour, 10*time.Minute)

Functions

func GetOptions

func GetOptions() (map[string]string, error)

func PostArchive

func PostArchive() ([]map[string]string, error)

func PostCommentNum

func PostCommentNum(postIds []int) (map[int]int, error)

Types

type CateArtivleCount

type CateArtivleCount struct {
	Cates
	Num int `db:"num"`
}

func CateArtivleCountGetList

func CateArtivleCountGetList(start int, num int) ([]*CateArtivleCount, error)

func GetAllCates

func GetAllCates() []*CateArtivleCount

type Cates

type Cates struct {
	Id        int       `form:"id" json:"id" db:"id"`
	Name      string    `form:"name" json:"name" db:"name"`
	Desc      string    `form:"desc" json:"desc" db:"desc"`
	Domain    string    `form:"domain" json:"domain" db:"domain"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
	UpdatedAt time.Time `form:"-" json:"updated_at" db:"updated_at"`
}

func (*Cates) AfterChange

func (c *Cates) AfterChange()

func (*Cates) DbName

func (c *Cates) DbName() string

func (*Cates) PK

func (c *Cates) PK() string

func (*Cates) TableName

func (c *Cates) TableName() string

type CommentNum

type CommentNum struct {
	CommentNum int `db:"comment_num"`
	PostId     int `db:"post_id"`
}

type Comments

type Comments struct {
	Id        int       `form:"id" json:"id" db:"id"`
	PostId    int       `form:"post_id" json:"post_id" db:"post_id"`
	Pid       int       `form:"pid" json:"pid" db:"pid"`
	Name      string    `form:"name" json:"name" db:"name"`
	Content   string    `form:"content" json:"content" db:"content"`
	IP        string    `form:"-" json:"ip" db:"ip"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
}

func PostComments

func PostComments(postId, start, num int) ([]*Comments, error)

func (*Comments) AfterChange

func (c *Comments) AfterChange()

func (*Comments) DbName

func (c *Comments) DbName() string

func (*Comments) PK

func (c *Comments) PK() string

func (*Comments) TableName

func (c *Comments) TableName() string
type Links struct {
	Id        int       `form:"id" json:"id" db:"id"`
	Name      string    `form:"name" json:"name" db:"name"`
	Url       string    `form:"url" json:"url" db:"url"`
	Desc      string    `form:"desc" json:"desc" db:"desc"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
}
func GetAllLinks() []*Links

func LinkGetList

func LinkGetList(start int, num int) ([]*Links, error)

func (*Links) AfterChange

func (p *Links) AfterChange()

func (*Links) DbName

func (l *Links) DbName() string

func (*Links) PK

func (l *Links) PK() string

func (*Links) TableName

func (l *Links) TableName() string

type Moods

type Moods struct {
	Id        int       `form:"id" json:"id" db:"id"`
	Content   string    `form:"content" json:"content" db:"content"`
	UserId    int       `form:"user_id" json:"user_id" db:"user_id"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
}

func (*Moods) AfterChange

func (m *Moods) AfterChange()

func (*Moods) DbName

func (m *Moods) DbName() string

func (*Moods) PK

func (m *Moods) PK() string

func (*Moods) TableName

func (m *Moods) TableName() string

type NewComment

type NewComment struct {
	Comments
	Type         int    `db:"type"`
	ArticleTitle string `db:"title"`
	Url          string `db:"url"`
}

func CommentList

func CommentList(start, num int) ([]*NewComment, error)

func NewComments

func NewComments() ([]*NewComment, error)

type Options

type Options struct {
	Id          int    `form:"id" json:"id" db:"id"`
	OptionKey   string `form:"option_key" json:"option_key" db:"option_key"`
	OptionValue string `form:"option_value" json:"option_value" db:"option_value"`
}

func (*Options) AfterChange

func (o *Options) AfterChange()

func (*Options) DbName

func (o *Options) DbName() string

func (*Options) PK

func (o *Options) PK() string

func (*Options) TableName

func (o *Options) TableName() string

type Posts

type Posts struct {
	Id        int       `form:"id" json:"id" db:"id"`
	CateId    int       `form:"cate_id" json:"cate_id" db:"cate_id"`
	Type      int       `form:"type" json:"type" db:"type"`
	UserId    int       `form:"user_id" json:"user_id" db:"user_id"`
	Title     string    `form:"title" json:"title" db:"title"`
	Url       string    `form:"url" json:"url" db:"url"`
	Content   string    `form:"content" json:"content" db:"content"`
	ViewNum   int       `form:"view_num" json:"view_num" db:"view_num"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
	UpdatedAt time.Time `form:"-" json:"updated_at" db:"updated_at"`
}

func PostNext

func PostNext(id int) (*Posts, error)

func PostPrev

func PostPrev(id int) (*Posts, error)

func (*Posts) AfterChange

func (p *Posts) AfterChange()

func (*Posts) DbName

func (p *Posts) DbName() string

func (*Posts) PK

func (p *Posts) PK() string

func (*Posts) TableName

func (p *Posts) TableName() string

type Reminds

type Reminds struct {
	Id         int       `form:"id" json:"id" db:"id"`
	Type       int       `form:"type" json:"type" db:"type"`
	At         string    `form:"at" json:"at" db:"at"`
	Content    string    `form:"content" json:"content" db:"content"`
	RemindDate time.Time `form:"remind_date" json:"remind_date" db:"remind_date" time_format:"2006-01-02 15:04:05"`
	CreatedAt  time.Time `form:"-" json:"created_at" db:"created_at"`
}

func RemindGetList

func RemindGetList(start int, num int) ([]*Reminds, error)

func (*Reminds) DbName

func (r *Reminds) DbName() string

func (*Reminds) PK

func (r *Reminds) PK() string

func (*Reminds) TableName

func (r *Reminds) TableName() string

type UserMoods

type UserMoods struct {
	Moods
	User *Users `db:"nick_name" relation:"user_id,id"`
}

func MoodGetList

func MoodGetList(start int, num int) ([]*UserMoods, error)

type UserPosts

type UserPosts struct {
	Posts
	Cate       *Cates `db:"-" relation:"cate_id,id"`
	User       *Users `db:"-" relation:"user_id,id"`
	CommentNum int    `db:"-"`
}

func PostGetList

func PostGetList(p *Posts, start int, num int, artdate, keyword string) ([]*UserPosts, error)

type Users

type Users struct {
	Id        int       `form:"id" json:"id" db:"id"`
	Name      string    `form:"name" json:"name" db:"name"`
	Password  string    `form:"password" json:"password" db:"password"`
	NickName  string    `form:"nick_name" json:"nick_name" db:"nick_name"`
	Email     string    `form:"email" json:"email" db:"email"`
	Status    int       `form:"status" json:"status" db:"status"`
	Type      int       `form:"type" json:"type" db:"type"`
	CreatedAt time.Time `form:"-" json:"created_at" db:"created_at"`
	UpdatedAt time.Time `form:"-" json:"updated_at" db:"updated_at"`
}

func GetUser

func GetUser(uid int) (*Users, error)

func UserGetList

func UserGetList(start int, num int) ([]*Users, error)

func (*Users) AfterChange

func (u *Users) AfterChange()

func (*Users) DbName

func (u *Users) DbName() string

func (*Users) PK

func (u *Users) PK() string

func (*Users) TableName

func (u *Users) TableName() string

Jump to

Keyboard shortcuts

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