biz

package
v0.0.0-...-066287a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 11 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID         int64     ` json:"id"`          // 账户ID
	Mobile     string    ` json:"mobile"`      // 手机号
	Email      string    ` json:"email"`       // 电子邮件
	Password   string    ` json:"password"`    // 密码
	Salt       string    ` json:"salt"`        // 密码盐
	Number     string    ` json:"number"`      // 号码
	IsDeleted  bool      ` json:"is_deleted"`  // 是否删除
	CreateTime time.Time ` json:"create_time"` // 创建时间
	UpdateTime time.Time ` json:"update_time"` // 更新时间
}

Account is a Account model.

type AccountRepo

type AccountRepo interface {
	Save(context.Context, *Account) error
	Update(context.Context, *Account) error
	FindByID(context.Context, int64) (*Account, error)
	FindByMobile(context.Context, string) (*Account, error)
	FindByEmail(context.Context, string) (*Account, error)
}

AccountRepo is a Greater repo.

type AccountUsecase

type AccountUsecase struct {
	// contains filtered or unexported fields
}

AccountUsecase is a Account usecase.

func NewAccountUsecase

func NewAccountUsecase(repo AccountRepo, logger log.Logger) *AccountUsecase

NewAccountUsecase new a Account usecase.

func (*AccountUsecase) CheckPasswordByEmail

func (uc *AccountUsecase) CheckPasswordByEmail(ctx context.Context, email, password string) (int64, error)

func (*AccountUsecase) CheckPasswordByID

func (uc *AccountUsecase) CheckPasswordByID(ctx context.Context, id int64, password string) (int64, error)

func (*AccountUsecase) CheckPasswordByMobile

func (uc *AccountUsecase) CheckPasswordByMobile(ctx context.Context, mobile, password string) (int64, error)

func (*AccountUsecase) CreateAccount

func (uc *AccountUsecase) CreateAccount(ctx context.Context, g *Account) error

CreateAccount creates a Account, and returns the new Account.

func (*AccountUsecase) ModifyPassword

func (uc *AccountUsecase) ModifyPassword(ctx context.Context, id int64, oldPassword, newPassword string) error

type File

type File struct {
	ID         int64     `json:"id"`          // 文件ID
	DomainName string    `json:"domain_name"` // 域名
	BizName    string    `json:"biz_name"`    // 业务名称
	Hash       string    `json:"hash"`        // 文件哈希
	FileSize   int64     `json:"file_size"`   // 文件大小
	FileType   string    `json:"file_type"`   // 文件类型
	Uploaded   int32     `json:"uploaded"`    // 是否上传
	IsDeleted  int32     `json:"is_deleted"`  // 是否删除
	CreateTime time.Time `json:"create_time"` // 创建时间
	UpdateTime time.Time `json:"update_time"` // 更新时间
}

File is a File model.

type FileRepo

type FileRepo interface {
	Save(c context.Context, file *File) error
	Update(c context.Context, file *File) error
	FindByID(c context.Context, id int64) (*File, error)
	FindUploadedByID(c context.Context, id int64) (*File, error)
	FindUploadedByHash(c context.Context, hash string) (*File, error)
	DeleteByID(c context.Context, id int64) error
}

FileRepo is a Greater repo.

type FileUsecase

type FileUsecase struct {
	// contains filtered or unexported fields
}

FileUsecase is a File usecase.

func NewFileUsecase

func NewFileUsecase(repo FileRepo, minio *minio.Minio, logger log.Logger) *FileUsecase

NewFileUsecase new a File usecase.

func (*FileUsecase) CheckFileExistedAndGetFile

func (uc *FileUsecase) CheckFileExistedAndGetFile(ctx context.Context, g *File) (int64, bool, error)

CheckFileExistedAndGetFile checks if the file exists and returns the file ID if it does

func (*FileUsecase) CreateFile

func (uc *FileUsecase) CreateFile(ctx context.Context, g *File) error

CreateFile creates a File, and returns the new File.

func (*FileUsecase) GetInfoById

func (uc *FileUsecase) GetInfoById(ctx context.Context, domainName, bizName string, fileId int64) (*File, error)

func (*FileUsecase) GetProgressRate4SlicingPut

func (uc *FileUsecase) GetProgressRate4SlicingPut(ctx context.Context, uploadId string, g *File) (map[string]bool, error)

GetProgressRate4SlicingPut returns the progress rate of the file upload in slices

func (*FileUsecase) MergeFileParts

func (uc *FileUsecase) MergeFileParts(ctx context.Context, uploadId string, g *File) error

MergeFileParts merges the file parts uploaded in slices

func (*FileUsecase) PreSignGet

func (uc *FileUsecase) PreSignGet(ctx context.Context, g *File) (string, error)

PreSignGet returns the pre-signed URL for downloading the file

func (*FileUsecase) PreSignPut

func (uc *FileUsecase) PreSignPut(ctx context.Context, g *File) (string, int64, error)

PreSignPut returns the pre-signed URL for uploading the file, and the file ID if the file already exists

func (*FileUsecase) PreSignSlicingPut

func (uc *FileUsecase) PreSignSlicingPut(ctx context.Context, g *File) (*SlicingFile, error)

PreSignSlicingPut returns the pre-signed URL for uploading the file in slices

func (*FileUsecase) RemoveFile

func (uc *FileUsecase) RemoveFile(ctx context.Context, g *File) error

RemoveFile removes the file

func (*FileUsecase) ReportUploaded

func (uc *FileUsecase) ReportUploaded(ctx context.Context, g *File) error

ReportUploaded reports that the file has been uploaded

type SlicingFile

type SlicingFile struct {
	File       *File
	TotalParts int64
	UploadId   string
	UploadUrl  []string
}

Jump to

Keyboard shortcuts

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