model

package
v0.0.0-...-bc73a09 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unaudited = "Unaudited"
	Online    = "Online"
	Offline   = "offline"
	Deleted   = "deleted"
)
View Source
const (
	Man     = "man"
	Woman   = "woman"
	Unknown = "unknown"
)
View Source
const (
	Unsign    = "unsign"
	Normal    = "normal"
	Forbidden = "forbidden"
	Freeze    = "freeze"
)

Variables

View Source
var (
	DB *sqlx.DB
)

Functions

func InsertArticleEx

func InsertArticleEx(ctx context.Context, cv cv) error

func InsertTag

func InsertTag(ctx context.Context, name string) error

func InsertUserCount

func InsertUserCount(ctx context.Context, uid int64) error

func InsertUserFollow

func InsertUserFollow(ctx context.Context, uid, fuid int64) error

func RemoveArticle

func RemoveArticle(ctx context.Context, id int64) error

func RemoveComment

func RemoveComment(ctx context.Context, id int64) error

func RemoveReply

func RemoveReply(ctx context.Context, id int64) error

func RemoveUserFollow

func RemoveUserFollow(ctx context.Context, uid, fuid int64) error

func UpdateArticle

func UpdateArticle(ctx context.Context, cv cv, id int64) error

func UpdateArticleEx

func UpdateArticleEx(ctx context.Context, aid int64, add bool, columns ...string) error

func UpdateComment

func UpdateComment(ctx context.Context, id int64, cv cv, add bool, columns ...string) error

func UpdateUser

func UpdateUser(ctx context.Context, cv cv, where where) error

func UpdateUserCount

func UpdateUserCount(ctx context.Context, uid int64, add bool, columns ...string) error

Types

type Article

type Article struct {
	Id        int64     `json:"id" db:"id"`
	Sn        string    `json:"sn" db:"sn"`
	Title     string    `json:"title" db:"title"`
	Uid       int64     `json:"uid" db:"uid"`
	Cover     string    `json:"cover" db:"cover"`
	Content   string    `json:"content" db:"content"`
	Tags      []string  `json:"tags" db:"tags"`
	State     string    `json:"state" db:"state"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetArticle

func GetArticle(ctx context.Context, where where, columns ...string) (Article, error)

func GetArticles

func GetArticles(ctx context.Context, where where, columns ...string) ([]Article, error)

func InsertArticle

func InsertArticle(ctx context.Context, cv cv) (Article, error)

type ArticleEx

type ArticleEx struct {
	Aid       int64     `json:"aid" db:"aid"`
	ViewNum   int       `json:"viewNum" db:"view_num"`
	CmtNum    int       `json:"cmtNum" db:"cmt_num"`
	ZanNum    int       `json:"zanNum" db:"zan_num"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetArticleEx

func GetArticleEx(ctx context.Context, aid int64) (ArticleEx, error)

type Comment

type Comment struct {
	Id        int64     `json:"id" db:"id"`
	Aid       int64     `json:"aid" db:"aid"`
	Uid       int64     `json:"uid" db:"uid"`
	Content   int64     `json:"content" db:"content"`
	ZanNum    int64     `json:"zanNum" db:"zan_num"`
	Floor     int64     `json:"floor" db:"floor"`
	State     string    `json:"state" db:"state"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetComments

func GetComments(ctx context.Context, aid int64) ([]Comment, error)

func InsertComment

func InsertComment(ctx context.Context, cv cv) (Comment, error)

type CommentReply

type CommentReply struct {
	Id        int64     `json:"id" db:"id"`
	Cid       int64     `json:"cid" db:"cid"`
	Uid       int64     `json:"uid" db:"uid"`
	Content   string    `json:"content" db:"content"`
	State     string    `json:"state" db:"state"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetReplies

func GetReplies(ctx context.Context, cid int64) ([]CommentReply, error)

func InsertReply

func InsertReply(ctx context.Context, cv cv) (CommentReply, error)

type Tag

type Tag struct {
	Id        int64     `json:"id" db:"id"`
	Name      string    `json:"name" db:"name"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetTags

func GetTags(ctx context.Context, name string) ([]Tag, error)

type User

type User struct {
	Id        int64     `json:"id" db:"id"`
	Username  string    `json:"username" db:"username"`
	Email     string    `json:"email" db:"email"`
	Password  string    `json:"password" db:"password"`
	Avatar    string    `json:"avatar" db:"avatar"`
	Gender    string    `json:"gender" db:"gender"`
	Introduce string    `json:"introduce" db:"introduce"`
	State     string    `json:"state" db:"state"`
	Root      bool      `json:"root" db:"root"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetUser

func GetUser(ctx context.Context, where where) (User, error)

func GetUsers

func GetUsers(ctx context.Context, where where) ([]User, error)

func InsertUser

func InsertUser(ctx context.Context, cv map[string]interface{}) (User, error)

type UserCount

type UserCount struct {
	Uid        int64     `json:"uid" db:"uid"`
	FansNum    int32     `json:"fansNum" db:"fans_num"`
	FollowNum  int32     `json:"followNum" db:"follow_num"`
	ArticleNum int32     `json:"articleNum" db:"article_num"`
	Words      int32     `json:"words" db:"words"`
	ZanNum     int32     `json:"zanNum" db:"zan_num"`
	CreatedAt  time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt  time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt  time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetUserCount

func GetUserCount(ctx context.Context, uid int64) (UserCount, error)

type UserFollow

type UserFollow struct {
	Id        int64     `json:"id" db:"id"`
	Uid       int64     `json:"uid" db:"uid"`
	Fuid      int64     `json:"fuid" db:"fuid"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
	DeletedAt time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetFollowUserList

func GetFollowUserList(ctx context.Context, uid int64) ([]UserFollow, error)

获取用户粉丝列表

func GetUserFollowList

func GetUserFollowList(ctx context.Context, fuid int64) ([]UserFollow, error)

获取用户关注列表

Jump to

Keyboard shortcuts

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