db

package
v0.0.0-...-5447790 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUserFile

func DeleteUserFile(
	username string,
	filehash string) bool

DeleteUserFile: Delete User's File Record, marked as deleted

func IsFileUploaded

func IsFileUploaded(filehash string) bool

IsFileUploaded: File is uploaded or not

func OnFileRemoved

func OnFileRemoved(filehash string) bool

OnFileRemoved: Delete file in Database(only marked as deleted, not real deleted)

func OnFileUploadFinished

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

OnFileUploadFinished: File upload completed

func OnUserFileUploadFinished

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

OnUserFileUploadFinished: Update User File Table

func RenameFileName

func RenameFileName(
	username string,
	filehash string,
	filename string) bool

RenameFileName

func UpdateFileLocation

func UpdateFileLocation(
	filehash string,
	fileaddr string,
) bool

func UpdateToken

func UpdateToken(username string, token string) bool

UpdateToken: Refresh user sign in token

func UserExist

func UserExist(username string) (bool, error)

UserExist: Query User is existed or not

func UserSignin

func UserSignin(username string, encpwd string) bool

UserSignin: Check User's Password is valid

func UserSignup

func UserSignup(username string, passwd string) bool

UserSignup: User Sign Up

Types

type TableFile

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

func GetFileMeta

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

GetFileMeta: Query File Meta Data from Database

func GetFileMetaList

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

GetFileMetaList: Query Batch File Metas from DB

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: Query User Info

type UserFile

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

User File Model

func QueryUserFileMeta

func QueryUserFileMeta(username string, filehash string) (*UserFile, error)

QueryUserFileMetas: Query user's one file from Database

func QueryUserFileMetas

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

QueryUserFileMetas: Query user's file list of K number from Database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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