db

package
v0.0.0-...-b124a9c Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnFileUploadFinished

func OnFileUploadFinished(filehash string, filename string,
	filesize int64, fileaddr string) bool

OnFileUploadFinished : 文件上传完成,保存meta

func OnUserFileUploadFinished

func OnUserFileUploadFinished(username, filehash, filename string, filesize int64) bool

OnUserFileUploadFinished : 更新用户文件表

func UpdateFileLocation

func UpdateFileLocation(filehash string, fileaddr string) bool

UpdateFileLocation : 更新文件的存储地址(如文件被转移了)

func UpdateToken

func UpdateToken(username string, token string) bool

UpdateToken : 刷新用户登录的token

func UserSignin

func UserSignin(username string, encpwd string) bool

UserSignin : 判断密码是否一致

func UserSignup

func UserSignup(username string, passwd string) bool

UserSignup : 通过用户名及密码完成user表的注册操作

Types

type TableFile

type TableFile struct {
	FileHash string
	FileName sql.NullString
	FileSize sql.NullInt64
	FileAddr sql.NullString
}

TableFile : 文件表结构体

func GetFileMeta

func GetFileMeta(filehash string) (*TableFile, error)

GetFileMeta : 从mysql获取文件元信息

func GetFileMetaList

func GetFileMetaList(limit int) ([]TableFile, error)

GetFileMetaList : 从mysql批量获取文件元信息

type User

type User struct {
	Username     string
	Email        string
	Phone        string
	SignupAt     string
	LastActiveAt string
	Status       int
}

User : 用户表model

func GetUserInfo

func GetUserInfo(username string) (User, error)

GetUserInfo : 查询用户信息

type UserFile

type UserFile struct {
	UserName    string
	FileHash    string
	FileName    string
	FileSize    int64
	UploadAt    string
	LastUpdated string
}

UserFile : 用户文件表结构体

func QueryUserFileMetas

func QueryUserFileMetas(username string, limit int) ([]UserFile, error)

QueryUserFileMetas : 批量获取用户文件信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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