Documentation
¶
Index ¶
- Constants
- func AuditShareFile(username, filehash string) bool
- func CancelAuditShareFile(username, filehash string) bool
- func CancelShareFile(username, filehash string) bool
- func CheckFileExist(filehash string) bool
- func CheckUserFileExist(username, filename, filehash string) bool
- func CloseDB()
- func CommitFileInfo(file File) (int, error)
- func CreateInviteCode(code string) error
- func DeleteFile(filehash, filename string) error
- func DeleteUser(username string) error
- func DeleteUserFile(username, filehash, filename string) error
- func DeleteUserFileByUsername(username string) error
- func FileTransaction(uid int, toUid int, transactionFileId int, privateKey string) (bool, error)
- func IsValid(code string) (bool, error)
- func LikeFile(uid, fileID, likeNum int) (int, string)
- func OnFileUploadFinished(filehash string, filename string, filesize int64, fileaddr string) error
- func OnUserFileUploadFinished(username, filehash, filename string, filesize int64) error
- func PublicFile(uid, fileID int) error
- func RenameFileName(filehash, oldfilename, filename string) bool
- func RenameUserFileName(username, filehash, oldfilename, filename string) bool
- func Setup()
- func ShareFile(username, filehash string) bool
- func UpdateUserPassword(username string, passwd string) (bool, error)
- func UserExist(username string) (bool, error)
- func UserSignin(username string, encpwd string) bool
- func UserSignup(username string, passwd string, inviteCode string, phone string, ...) bool
- type File
- type FileRead
- type InviteCode
- type SecretType
- type User
- type UserFile
- func QueryShareFileMetas(shareStatus int, usernameFilter, filenameFilter string, reverse bool, ...) ([]UserFile, error)
- func QueryUserFileMeta(username, filehash, filename string) (*UserFile, error)
- func QueryUserFileMetas(username, filenameFilter string, reverse bool, offset, limit int) ([]UserFile, error)
- type UserOrder
- type UserSecretFile
Constants ¶
View Source
const SecretType_Private = 2
View Source
const SecretType_Public = 1
Variables ¶
This section is empty.
Functions ¶
func CancelAuditShareFile ¶
CancelAuditShareFile: 取消审核文件
func CheckUserFileExist ¶
CheckFileExist : 检查全局文件表中文件元信息是否存在
func CommitFileInfo ¶
func CreateInviteCode ¶
func DeleteUserFile ¶
DeleteUserFile : 删除文件
func FileTransaction ¶
func OnFileUploadFinished ¶
OnFileUploadFinished : 文件上传完成,保存meta
func OnUserFileUploadFinished ¶
OnUserFileUploadFinished : 更新用户文件表
func PublicFile ¶
func RenameFileName ¶
RenameFileName : 文件重命名
func RenameUserFileName ¶
RenameUserFileName : 文件重命名
func UpdateUserPassword ¶
UpdateUserPassword : 修改用户密码
Types ¶
type File ¶
type File struct { ID int `gorm:"primary_key" json:"file_id"` FileSHA1 string `gorm:"column:file_sha1;not null" json:"file_sha1,omitempty"` FileName string `gorm:"column:file_name;not null" json:"file_name"` FileSize int64 `gorm:"column:file_size;not null" json:"file_size,omitempty"` FileAddr string `gorm:"column:file_addr;not null" json:"file_addr"` ImgAddr string `gorm:"column:img_addr;not null" json:"img_addr"` OwnerUID int `gorm:"column:owner_uid;not null" json:"owner_uid,omitempty"` CreatorUID int `gorm:"column:creator_uid;not null" json:"creator_uid,omitempty"` CreateAt string `gorm:"column:create_at;" json:"create_at,omitempty"` UpdateAt string `gorm:"column:update_at;" json:"update_at,omitempty"` Status int64 `gorm:"column:status;" json:"status,omitempty"` TransactionId string `gorm:"column:transaction_id;" json:"TransactionId"` }
File : 文件表结构体
func GetFileMeta ¶
GetFileMeta : 从mysql获取文件元信息
func GetFileMetaList ¶
GetFileMetaList : 从mysql批量获取文件元信息
type FileRead ¶
type FileRead struct { ID int `gorm:"primary_key" json:"file_id"` FileSHA1 string `gorm:"column:file_sha1;not null" json:"file_sha1,omitempty"` FileName string `gorm:"column:file_name;not null" json:"file_name"` FileSize int64 `gorm:"column:file_size;not null" json:"file_size,omitempty"` FileAddr string `gorm:"column:file_addr;not null" json:"file_addr"` ImgAddr string `gorm:"column:img_addr;not null" json:"img_addr"` OwnerUID int `gorm:"column:owner_uid;not null" json:"owner_uid,omitempty"` CreatorUID int `gorm:"column:creator_uid;not null" json:"creator_uid,omitempty"` Username string `gorm:"column:username;not null" json:"username,omitempty"` AvatarUrl string `gorm:"column:avatar_url;" json:"avatar_url,omitempty"` LikeCnt int `gorm:"column:like_cnt;not null" json:"like_cnt"` ArTag bool `gorm:"column:ar_tag;not null" json:"ar_tag"` CreateAt string `gorm:"column:create_at;" json:"create_at,omitempty"` UpdateAt string `gorm:"column:update_at;" json:"update_at,omitempty"` Status int64 `gorm:"column:status;" json:"status,omitempty"` TransactionId string `gorm:"column:transaction_id;" json:"TransactionId"` }
func ListPublicFileInfo ¶
type InviteCode ¶
type InviteCode struct { ID int `gorm:"primary_key" json:"-"` Code string `gorm:"column:code;not null"` Status int `gorm:"column:status;not null"` CreateTime string `gorm:"column:create_time;not null"` LastUpdate string `gorm:"column:last_update;not null"` }
func QueryInviteCode ¶
func QueryInviteCode(code string) (*InviteCode, error)
type SecretType ¶
type SecretType int
type User ¶
type User struct { ID int `gorm:"primary_key" json:"id"` Username string `gorm:"column:user_name;not null" json:"Username"` Userpwd string `gorm:"column:user_pwd;not null" json:"-"` SignupAt string `gorm:"column:signup_at;" json:"SignupAt"` LastActiveAt string `gorm:"column:last_active;" json:"LastActive"` Status int `gorm:"column:status;" json:"-"` InviteCode string `gorm:"column:invite_code;" json:"InviteCode"` Phone string `gorm:"column:phone;" json:"Phone"` AvatarUrl string `gorm:"column:avatar_url;" json:"AvatarUrl"` Balance int `gorm:"column:balance;" json:"Balance"` }
User : 用户表model
func BatchQueryUserInfoList ¶
func QueryUserInfoList ¶
QueryUserInfoList : 批量获取用户信息
type UserFile ¶
type UserFile struct { ID int `gorm:"primary_key" json:"-"` UserName string `gorm:"column:user_name;not null" json:"Username"` FileHash string `gorm:"column:file_sha1;not null" json:"FileHash"` FileName string `gorm:"column:file_name;not null" json:"FileName"` FileSize int64 `gorm:"column:file_size;not null" json:"FileSize"` UploadAt string `gorm:"column:upload_at;" json:"UploadAt"` LastUpdate string `gorm:"column:last_update;" json:"LastUpdate"` Status int64 `gorm:"column:status;not null" json:"-"` ShareStatus int64 `gorm:"column:share_status;not null" json:"ShareStatus"` }
UserFile : 用户文件表结构体
func QueryShareFileMetas ¶
func QueryShareFileMetas(shareStatus int, usernameFilter, filenameFilter string, reverse bool, offset, limit int) ([]UserFile, error)
文件共享部分 QueryShareFileMetas : 批量获取共享文件信息
func QueryUserFileMeta ¶
QueryUserFileMeta : 获取用户单个文件信息
type UserOrder ¶
type UserOrder struct { ID int `gorm:"primary_key" json:"id"` Type int `gorm:"column:type;not null" json:"type"` OrderSN string `gorm:"column:order_sn;not null" json:"order_sn"` Content string `gorm:"column:content;not null" json:"content"` CreateTime string `gorm:"column:create_time;not null" json:"create_time"` Uid int `gorm:"column:uid;not null" json:"uid"` ToId int `gorm:"column:to_id;not null" json:"to_id"` TransactionId string `gorm:"column:transaction_id;not null" json:"TransactionId"` }
type UserSecretFile ¶
type UserSecretFile struct { ID int `gorm:"primary_key" json:"-"` UserName string `gorm:"column:user_name;not null" json:"Username"` FileHash string `gorm:"column:file_sha1;not null" json:"FileHash"` FileName string `gorm:"column:file_name;not null" json:"FileName"` FileSize int64 `gorm:"column:file_size;not null" json:"FileSize"` CreateTime string `gorm:"column:create_time;" json:"CreateTime"` LastUpdate string `gorm:"column:last_update;" json:"LastUpdate"` Status int64 `gorm:"column:status;not null" json:"status"` Type SecretType `gorm:"column:type;not null" json:"type"` Data string `gorm:"column:data;not null" json:"data"` }
UserFile : 用户文件表结构体
func GenerateUserSecretFile ¶
func GenerateUserSecretFile(username string) ([]*UserSecretFile, error)
func QuerySecretFile ¶
func QuerySecretFile(username string, secretType SecretType) (*UserSecretFile, error)
Click to show internal directories.
Click to hide internal directories.