Documentation
¶
Index ¶
- Constants
- Variables
- type AggregateSizeResult
- type CreateAtAscCursor
- type CreateAtDescCursor
- type EsFilter
- type EsMapper
- type File
- type FilterOptions
- type IFileEsMapper
- type IMongoMapper
- type MongoFileFilter
- func (f *MongoFileFilter) CheckOnlyDocumentType()
- func (f *MongoFileFilter) CheckOnlyFatherId()
- func (f *MongoFileFilter) CheckOnlyFileId()
- func (f *MongoFileFilter) CheckOnlyFileIds()
- func (f *MongoFileFilter) CheckOnlyIsDel()
- func (f *MongoFileFilter) CheckOnlyLabelId()
- func (f *MongoFileFilter) CheckOnlyType()
- func (f *MongoFileFilter) CheckOnlyUserId()
- type MongoMapper
- func (m *MongoMapper) Count(ctx context.Context, fopts *FilterOptions) (int64, error)
- func (m *MongoMapper) Delete(ctx context.Context, id, userId string) (int64, error)
- func (m *MongoMapper) FindAndInsert(ctx context.Context, data *File) (string, error)
- func (m *MongoMapper) FindAndInsertMany(ctx context.Context, data []*File) ([]string, error)
- func (m *MongoMapper) FindFileIsExist(ctx context.Context, md5 string) (bool, error)
- func (m *MongoMapper) FindFolderSize(ctx context.Context, path string) (int64, error)
- func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*File, error)
- func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, ...) ([]*File, int64, error)
- func (m *MongoMapper) FindManyByIds(ctx context.Context, ids []string) ([]*File, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*File, error)
- func (m *MongoMapper) GetConn() *monc.Model
- func (m *MongoMapper) Insert(ctx context.Context, data *File) (string, error)
- func (m *MongoMapper) StartClient() *mongo.Client
- func (m *MongoMapper) Update(ctx context.Context, data *File) (*mongo.UpdateResult, error)
- func (m *MongoMapper) UpdateMany(ctx context.Context, ids []string, userId string, update bson.M) (*mongo.UpdateResult, error)
- type UpdateAtAscCursor
- type UpdateAtDescCursor
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 ¶
type CreateAtDescCursor ¶
type CreateAtDescCursor struct {
ID string `json:"_id"`
}
func (*CreateAtDescCursor) MakeSortOptions ¶
降序
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 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) FindAndInsert ¶
func (*MongoMapper) FindAndInsertMany ¶
func (*MongoMapper) FindFileIsExist ¶
func (*MongoMapper) FindFolderSize ¶
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 (*MongoMapper) GetConn ¶
func (m *MongoMapper) GetConn() *monc.Model
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 ¶
func (*UpdateAtAscCursor) MakeSortOptions ¶
type UpdateAtDescCursor ¶
func (*UpdateAtDescCursor) MakeSortOptions ¶
Click to show internal directories.
Click to hide internal directories.