mysql

package
v0.0.0-...-228285a Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidPassword = ehandle.MySQLInvalidPassword
	ErrorUserExist       = ehandle.MySQLUserExist
	ErrorUserNotExist    = errors.New("用户不存在")
)

Functions

func CheckLogin

func CheckLogin(user *model.User) error

CheckLogin 检查用户名和密码

func CheckUserExist

func CheckUserExist(username string) error

CheckUserExist 判断用户名是否存在

func Close

func Close()

func CreateComment

func CreateComment(p *model.CommentDetail) error

CreateComment 插入数据库

func CreatePost

func CreatePost(p *model.Post) error

CreatePost 插入帖子数据

func GetAuthorNameById

func GetAuthorNameById(id int64) (name string, err error)

func GetCommunityDetailById

func GetCommunityDetailById(id int64) (*model.CommunityDetail, error)

GetCommunityDetailById 通过对应的社区id返回社区详情

func GetCommunityList

func GetCommunityList() (data []*model.Community, err error)

GetCommunityList 返回所有社区名和对应的社区id

func GetCommunityNameById

func GetCommunityNameById(id int64) (data *model.Community, err error)

GetCommunityNameById 通过id 返回对应的社区名称

func GetFatherById

func GetFatherById(id int64) (data []*model.CommentDetail, ids []int64, err error)

GetFatherById 查找指定帖子id的所有父级评论

func GetPostDetailById

func GetPostDetailById(id int64) (data *model.Post, err error)

func GetPostList

func GetPostList(page, size int64) (posts []*model.Post, err error)

func GetPostOrder

func GetPostOrder(ids []string) (data []*model.Post, err error)

func GetReplayList

func GetReplayList(id int64) (data []*model.CommentDetail, err error)

GetReplayList 查找对应评论id的子评论,is_top=-1表示是子级评论

func GetUserName

func GetUserName(id int64) (name string, err error)

func Init

func Init()

func InsertUser

func InsertUser(user *model.User) error

InsertUser 往user表中插入数据

Types

This section is empty.

Jump to

Keyboard shortcuts

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