file

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: 31 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "file"

Variables

View Source
var (
	CreateAtDescCursorType = (*CreateAtDescCursor)(nil)
	CreateAtAscCursorType  = (*CreateAtAscCursor)(nil)
	UpdateAtDescCursorType = (*UpdateAtDescCursor)(nil)
	UpdateAtAscCursorType  = (*UpdateAtAscCursor)(nil)
)

Functions

This section is empty.

Types

type AggregateSizeResult

type AggregateSizeResult struct {
	Size int64 `bson:"size,omitempty"`
}

type CreateAtAscCursor

type CreateAtAscCursor struct {
	ID string `json:"_id"`
}

func (*CreateAtAscCursor) MakeSortOptions

func (s *CreateAtAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type CreateAtDescCursor

type CreateAtDescCursor struct {
	ID string `json:"_id"`
}

func (*CreateAtDescCursor) MakeSortOptions

func (s *CreateAtDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

降序

type EsFilter

type EsFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

type EsMapper

type EsMapper struct {
	IndexName string
	// contains filtered or unexported fields
}

func (*EsMapper) Search

func (e *EsMapper) Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*File, int64, error)

type File

type File 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"`
	Type        string             `bson:"type,omitempty" json:"type,omitempty"`
	Path        string             `bson:"path,omitempty" json:"path,omitempty"`
	FatherId    string             `bson:"fatherId,omitempty" json:"fatherId,omitempty"`
	Size        *int64             `bson:"size,omitempty" json:"size,omitempty"`
	FileMd5     string             `bson:"fileMd5,omitempty" json:"fileMd5,omitempty"`
	IsDel       int64              `bson:"isDel,omitempty" json:"isDel,omitempty"`
	Zone        string             `bson:"zone,omitempty" json:"zone,omitempty"`
	SubZone     string             `bson:"subZone,omitempty" json:"subZone,omitempty"`
	Description string             `bson:"description,omitempty" json:"description,omitempty"`
	Labels      []string           `bson:"labels,omitempty" json:"labels,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	DeletedAt   time.Time          `bson:"deletedAt,omitempty" json:"deletedAt,omitempty"`
	Score_      float64            `bson:"score_,omitempty" json:"score_,omitempty"`
}

type FilterOptions

type FilterOptions struct {
	OnlyUserId       *string
	OnlyFileId       *string
	OnlyFileIds      []string
	OnlyFatherId     *string
	OnlyZone         *string
	OnlySubZone      *string
	OnlyIsDel        *int64
	OnlyDocumentType *int64
	OnlyType         []string
	OnlyLabelId      *string
}

type IFileEsMapper

type IFileEsMapper interface {
	Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*File, int64, error)
}

func NewEsMapper

func NewEsMapper(config *config.Config) IFileEsMapper

type IMongoMapper

type IMongoMapper interface {
	FindFileIsExist(ctx context.Context, md5 string) (bool, error)
	Count(ctx context.Context, filter *FilterOptions) (int64, error)
	Insert(ctx context.Context, data *File) (string, error)
	FindAndInsert(ctx context.Context, data *File) (string, error)
	FindAndInsertMany(ctx context.Context, data []*File) ([]string, error)
	FindOne(ctx context.Context, id string) (*File, error)
	FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*File, error)
	FindManyByIds(ctx context.Context, ids []string) ([]*File, error)
	FindFolderSize(ctx context.Context, path string) (int64, error)
	FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*File, int64, error)
	Update(ctx context.Context, data *File) (*mongo.UpdateResult, error)
	UpdateMany(ctx context.Context, ids []string, userId string, update bson.M) (*mongo.UpdateResult, error)
	Delete(ctx context.Context, id, userId string) (int64, error)
	GetConn() *monc.Model
	StartClient() *mongo.Client
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) IMongoMapper

type MongoFileFilter

type MongoFileFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

func (*MongoFileFilter) CheckOnlyDocumentType

func (f *MongoFileFilter) CheckOnlyDocumentType()

func (*MongoFileFilter) CheckOnlyFatherId

func (f *MongoFileFilter) CheckOnlyFatherId()

func (*MongoFileFilter) CheckOnlyFileId

func (f *MongoFileFilter) CheckOnlyFileId()

func (*MongoFileFilter) CheckOnlyFileIds

func (f *MongoFileFilter) CheckOnlyFileIds()

func (*MongoFileFilter) CheckOnlyIsDel

func (f *MongoFileFilter) CheckOnlyIsDel()

func (*MongoFileFilter) CheckOnlyLabelId added in v1.0.46

func (f *MongoFileFilter) CheckOnlyLabelId()

func (*MongoFileFilter) CheckOnlyType

func (f *MongoFileFilter) CheckOnlyType()

func (*MongoFileFilter) CheckOnlyUserId

func (f *MongoFileFilter) CheckOnlyUserId()

type MongoMapper

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

func (*MongoMapper) Count

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

func (*MongoMapper) Delete

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

func (*MongoMapper) FindAndInsert

func (m *MongoMapper) FindAndInsert(ctx context.Context, data *File) (string, error)

func (*MongoMapper) FindAndInsertMany

func (m *MongoMapper) FindAndInsertMany(ctx context.Context, data []*File) ([]string, error)

func (*MongoMapper) FindFileIsExist

func (m *MongoMapper) FindFileIsExist(ctx context.Context, md5 string) (bool, error)

func (*MongoMapper) FindFolderSize

func (m *MongoMapper) FindFolderSize(ctx context.Context, path string) (int64, error)

func (*MongoMapper) FindMany

func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*File, error)

func (*MongoMapper) FindManyAndCount

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

func (*MongoMapper) FindManyByIds

func (m *MongoMapper) FindManyByIds(ctx context.Context, ids []string) ([]*File, error)

func (*MongoMapper) FindOne

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

func (*MongoMapper) GetConn

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

func (*MongoMapper) Insert

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

func (*MongoMapper) StartClient

func (m *MongoMapper) StartClient() *mongo.Client

func (*MongoMapper) Update

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

func (*MongoMapper) UpdateMany

func (m *MongoMapper) UpdateMany(ctx context.Context, ids []string, userId string, update bson.M) (*mongo.UpdateResult, error)

type UpdateAtAscCursor

type UpdateAtAscCursor struct {
	UpdateAt time.Time `json:"updateAt"`
}

func (*UpdateAtAscCursor) MakeSortOptions

func (s *UpdateAtAscCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

type UpdateAtDescCursor

type UpdateAtDescCursor struct {
	UpdateAt time.Time `json:"updateAt"`
}

func (*UpdateAtDescCursor) MakeSortOptions

func (s *UpdateAtDescCursor) MakeSortOptions(filter bson.M, backward bool) (bson.M, error)

Jump to

Keyboard shortcuts

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