db

package
v0.0.0-...-76f8149 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordSalt = "HBZciU2SiSDr4uPeJ1e7qlIlMbyusQ0v"
)

Variables

View Source
var (
	ErrUserExists        = errors.New("username is exist")
	ErrUserNotExists     = errors.New("username not exist")
	ErrUserPasswordWrong = errors.New("username or password not right")
	ErrRecordExists      = errors.New("record exist")
)
View Source
var (
	DB *sqlx.DB
)

Functions

func CreateFavorite

func CreateFavorite(favorite *common.Favorite) (err error)

func CreateFavoriteDir

func CreateFavoriteDir(favoriteDir *common.FavoriteDir) (err error)

func CreatePostComment

func CreatePostComment(comment *common.Comment) (err error)

func CreateQuestion

func CreateQuestion(question *common.Question) (err error)

func CreateReplyComment

func CreateReplyComment(comment *common.Comment) (err error)

func GetAnswerCount

func GetAnswerCount(questionId int64) (answerCount int64, err error)

func GetAnswerIdList

func GetAnswerIdList(questionId int64, offset, limit int64) (answerIdList []int64, err error)

func GetCategoryList

func GetCategoryList() (categoryList []*common.Category, err error)

func GetCommentList

func GetCommentList(answerId int64, offset, limit int64) (commentList []*common.Comment, count int64, err error)

func GetFavoriteDirList

func GetFavoriteDirList(userId int64) (favoriteDirList []*common.FavoriteDir, err error)

func GetFavoriteList

func GetFavoriteList(userId, dirId, offset, limit int64) (favoriteList []*common.Favorite, err error)

func GetQuestion

func GetQuestion(questionId int64) (question *common.Question, err error)

func GetQuestionList

func GetQuestionList(categoryId int64) (questionList []*common.Question, err error)

func GetReplyList

func GetReplyList(commentId int64, offset, limit int64) (commentList []*common.Comment, count int64, err error)

func GetUserInfoList

func GetUserInfoList(userIdList []int64) (userInfoList []*common.UserInfo, err error)

func Init

func Init(dns string) error

func Login

func Login(user *common.UserInfo) (err error)

func MGetAnswer

func MGetAnswer(answerIds []int64) (answerList []*common.Answer, err error)

func MGetCategory

func MGetCategory(categoryIds []int64) (categoryMap map[int64]*common.Category, err error)

func Register

func Register(user *common.UserInfo) (err error)

func UpdateAnswerLikeCount

func UpdateAnswerLikeCount(answerId int64) (err error)

func UpdateCommentLikeCount

func UpdateCommentLikeCount(commentId int64) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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