sharefile

package
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "shareFile"

Variables

This section is empty.

Functions

func RandomString

func RandomString(length int) string

Types

type IMongoMapper

type IMongoMapper interface {
	Count(ctx context.Context, filter *ShareCodeOptions) (int64, error)
	Insert(ctx context.Context, data *ShareFile) (string, string, error)
	FindOne(ctx context.Context, id string) (*ShareFile, error)
	FindMany(ctx context.Context, fopts *ShareCodeOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*ShareFile, error)
	FindManyAndCount(ctx context.Context, fopts *ShareCodeOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*ShareFile, int64, error)
	Update(ctx context.Context, data *ShareFile) (*mongo.UpdateResult, error)
	Delete(ctx context.Context, id, userId string) (int64, error)
	GetConn() *monc.Model
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) IMongoMapper

type MongoMapper

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

func (*MongoMapper) Count

func (m *MongoMapper) Count(ctx context.Context, fopts *ShareCodeOptions) (int64, error)

func (*MongoMapper) Delete

func (m *MongoMapper) Delete(ctx context.Context, id, userId string) (int64, error)

func (*MongoMapper) FindMany

func (*MongoMapper) FindManyAndCount

func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *ShareCodeOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*ShareFile, int64, error)

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (*ShareFile, error)

func (*MongoMapper) GetConn

func (m *MongoMapper) GetConn() *monc.Model

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, data *ShareFile) (string, string, error)

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, data *ShareFile) (*mongo.UpdateResult, error)

type MongoShareCodeFilter

type MongoShareCodeFilter struct {
	*ShareCodeOptions
	// contains filtered or unexported fields
}

func (*MongoShareCodeFilter) CheckOnlyCode

func (f *MongoShareCodeFilter) CheckOnlyCode()

func (*MongoShareCodeFilter) CheckOnlyUserId

func (f *MongoShareCodeFilter) CheckOnlyUserId()

type ShareCodeOptions

type ShareCodeOptions struct {
	OnlyCode   *string
	OnlyUserId *string
}

type ShareFile

type ShareFile struct {
	ID            primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	UserId        string             `bson:"userId,omitempty" json:"userId,omitempty"`
	Name          string             `bson:"name,omitempty" json:"name,omitempty"`
	Key           string             `bson:"key,omitempty" json:"key,omitempty"`
	FileList      []string           `bson:"fileList,omitempty" json:"fileList,omitempty"`
	EffectiveTime int64              `bson:"effectiveTime,omitempty" json:"effectiveTime,omitempty"` // 有效期
	BrowseNumber  *int64             `bson:"browseNumber,omitempty" json:"browseNumber,omitempty"`   // 浏览次数
	CreateAt      time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`           // 创建时间
	DeletedAt     time.Time          `bson:"deletedAt,omitempty" json:"deletedAt,omitempty"`
}

Jump to

Keyboard shortcuts

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