model

package
v0.0.0-...-b3a75bd Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUserFile

func AppendUserFile(nickname string, fileSha1 string) bool

AppendUserFile is to append user file to database

func CheckFileRecord

func CheckFileRecord(fileSha1 string) bool

CheckFileRecord is to check whether a database record of file exists

func CheckUserToken

func CheckUserToken(nickname string, token string) bool

CheckUserToken is to check whether the user token is valid

func DeleteFileRecord

func DeleteFileRecord(fileSha1 string) bool

DeleteFileRecord is to delete a database record of a file

func DeleteUserFile

func DeleteUserFile(nickname string, fileSha1 string) bool

DeleteUserFile is to delete user file in database

func InsertFileRecord

func InsertFileRecord(fileSha1 string, fileName string, fileSize int64, filePath string,
	enableTimes int64, enableDays int64, createAt string, updateAt string) bool

InsertFileRecord is to insert a database record of a file

func UpdateFileRecord

func UpdateFileRecord(fileSha1 string, fileName string, filePath string) bool

UpdateFileRecord is to update a database record of a file

func UpdateUserToken

func UpdateUserToken(nickname string, token string) bool

UpdateUserToken is to update user token once trying to sign in

func UserSignIn

func UserSignIn(nickname string, password string) bool

UserSignIn is to select a database record of a user and compare it with params

func UserSignUp

func UserSignUp(nickname string, password string) bool

UserSignUp is to insert a database record of a user

Types

type FileRecord

type FileRecord struct {
	FileSha1    string
	FileName    sql.NullString
	FileSize    sql.NullInt64
	FilePath    sql.NullString
	EnableTimes sql.NullInt64
	EnableDays  sql.NullInt64
	CreateAt    sql.NullString
	UpdateAt    sql.NullString
}

FileRecord is a database record of a file

func SelectFileRecord

func SelectFileRecord(fileSha1 string) (*FileRecord, bool)

SelectFileRecord is to select a database record of a file by fileSha1

func SelectFileRecords

func SelectFileRecords(limitCount int) ([]FileRecord, bool)

SelectFileRecords is to select database records of files by limitCount

type UserFileRecord

type UserFileRecord struct {
	Nickname string
	FileSha1 string
}

UserFileRecord is a database record of a user file

func GetUserFiles

func GetUserFiles(nickname string, limitCount int) ([]UserFileRecord, bool)

GetUserFiles is to retrieve user files from database

type UserRecord

type UserRecord struct {
	Nickname string

	Realname   string
	Gender     int
	Birthday   string
	Campus     string
	School     string
	Major      string
	Grade      string
	Class      string
	Dormitory  string
	Department string

	Email  string
	Phone  string
	Wechat string
	QQ     string

	SignUpAt string
	SignInAt string

	Status int
}

UserRecord is a database record of a user

func GetUserInfo

func GetUserInfo(nickname string) (*UserRecord, bool)

GetUserInfo is to retrieve user information from the database

type UserTokenRecord

type UserTokenRecord struct {
	Nickname string
	Token    string
}

UserTokenRecord is a database record of a user token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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