mysql

package
v0.0.0-...-27cccc6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

@Title mysql @Description 定义在多个模块用到的错误信息 @Author CaptainLee1024 2020-10-07 @Update CaptainLee1024 2020-10-07

Package mysql provides ...

Package mysql provides ...

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUserExist       = errors.New("用户已存在")
	ErrorUserNotExist    = errors.New("用户不存在")
	ErrorInvalidPassword = errors.New("用户名或密码错误")
	ErrorInvalidID       = errors.New("无效的ID")
)

Functions

func CheckUserExist

func CheckUserExist(username string) (err error)

CheckUserExist 检查制定用户名的用户是否存在

func Close

func Close()

Close 关闭 MySQL 连接

func CreatePost

func CreatePost(p *models.Post) (err error)

func GetCommunityDetailByID

func GetCommunityDetailByID(id int64) (communityDetail *models.CommunityDetail, err error)

func GetCommunityList

func GetCommunityList() (communityList []*models.Community, err error)

func GetPostById

func GetPostById(pid int64) (post *models.Post, err error)

func GetPostList

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

func GetPostListByIDs

func GetPostListByIDs(ids []string) (postList []*models.Post, err error)

GetPostListByIDs 根据给定的id列表查询帖子数据

func GetUserById

func GetUserById(uid int64) (user *models.User, err error)

func Init

func Init(cfg *settings.MySQLConfig) (err error)

Init 初始化 MySQL 连接

func InsertUser

func InsertUser(user *models.User) (err error)

InsertUser 插入一条新的用户记录

func Login

func Login(u *models.User) (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