Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyEntityOption(e mongodbr.IEntity, opts ...mongodbr.EntityOption)
- func EntityWithCreatorUserId(userId string) mongodbr.EntityOption
- type BatchRequestPayload
- type EntityExport
- type EntityExportService
- type EntityService
- func (s *EntityService[T]) Count(filter interface{}) (count int64, err error)
- func (s *EntityService[T]) Create(item interface{}) (*T, error)
- func (s *EntityService[T]) Delete(id primitive.ObjectID) error
- func (s *EntityService[T]) DeleteMany(filter interface{}) (*mongo.DeleteResult, error)
- func (service *EntityService[T]) DeleteManyByIdList(idList []primitive.ObjectID) (*mongo.DeleteResult, error)
- func (s *EntityService[T]) FindAll() (list []T, err error)
- func (s *EntityService[T]) FindById(id primitive.ObjectID) (*T, error)
- func (s *EntityService[T]) FindList(filter interface{}, opts ...mongodbr.FindOption) (list []T, err error)
- func (s *EntityService[T]) FindOne(filter interface{}) (*T, error)
- func (s *EntityService[T]) GetRepository() mongodbr.IRepository
- func (s *EntityService[T]) UpdateFields(id primitive.ObjectID, update map[string]interface{}) error
- type EntityWithTenant
- type EntityWithUser
- type ExportOptions
- type IEntityExportService
- type IEntityService
- type IEntityWithTenant
- type IEntityWithUser
- type Pagination
- type Sort
Constants ¶
View Source
const ( ExportStatus_Error = "error" ExportStatus_Running = "running" ExportStatus_Finished = "finished" )
Variables ¶
View Source
var PaginationDefaultPage = 1
View Source
var PaginationDefaultSize = 10
Functions ¶
func ApplyEntityOption ¶
func ApplyEntityOption(e mongodbr.IEntity, opts ...mongodbr.EntityOption)
func EntityWithCreatorUserId ¶
func EntityWithCreatorUserId(userId string) mongodbr.EntityOption
Types ¶
type BatchRequestPayload ¶
type EntityExport ¶
type EntityExportService ¶
func (*EntityExportService[T]) ExportToCSV ¶
func (s *EntityExportService[T]) ExportToCSV(options ExportOptions) (exportId string, err error)
func (*EntityExportService[T]) GetExport ¶
func (s *EntityExportService[T]) GetExport(exportId string) (*EntityExport, error)
func (*EntityExportService[T]) GetRepository ¶
func (s *EntityExportService[T]) GetRepository() mongodbr.IRepository
type EntityService ¶
func (*EntityService[T]) Count ¶
func (s *EntityService[T]) Count(filter interface{}) (count int64, err error)
func (*EntityService[T]) Create ¶
func (s *EntityService[T]) Create(item interface{}) (*T, error)
func (*EntityService[T]) DeleteMany ¶
func (s *EntityService[T]) DeleteMany(filter interface{}) (*mongo.DeleteResult, error)
func (*EntityService[T]) DeleteManyByIdList ¶
func (service *EntityService[T]) DeleteManyByIdList(idList []primitive.ObjectID) (*mongo.DeleteResult, error)
func (*EntityService[T]) FindAll ¶
func (s *EntityService[T]) FindAll() (list []T, err error)
func (*EntityService[T]) FindById ¶
func (s *EntityService[T]) FindById(id primitive.ObjectID) (*T, error)
func (*EntityService[T]) FindList ¶
func (s *EntityService[T]) FindList(filter interface{}, opts ...mongodbr.FindOption) (list []T, err error)
func (*EntityService[T]) FindOne ¶
func (s *EntityService[T]) FindOne(filter interface{}) (*T, error)
func (*EntityService[T]) GetRepository ¶
func (s *EntityService[T]) GetRepository() mongodbr.IRepository
func (*EntityService[T]) UpdateFields ¶
func (s *EntityService[T]) UpdateFields(id primitive.ObjectID, update map[string]interface{}) error
update fields value
type EntityWithTenant ¶
type EntityWithTenant struct {
TenantId string `json:"tenantId" bson:"tenantId"`
}
func (*EntityWithTenant) GetTenantId ¶
func (p *EntityWithTenant) GetTenantId() string
func (*EntityWithTenant) SetTenantId ¶
func (t *EntityWithTenant) SetTenantId(tenantId string)
type EntityWithUser ¶
type EntityWithUser struct {
mongodbr.AuditedEntity `bson:",inline"`
}
func (*EntityWithUser) GetCreatorId ¶
func (p *EntityWithUser) GetCreatorId() string
func (*EntityWithUser) SetUserCreator ¶
func (p *EntityWithUser) SetUserCreator(userId string)
type ExportOptions ¶
type ExportOptions struct { Type string `json:"type"` Target string `json:"target"` Filter interface{} `json:"filter"` Async bool `json:"async"` GetFieldNameFunc func(entity interface{}, name string) string `json:"-"` Skip int `json:"skip"` FieldNameList []string `json:"fieldNameList"` FieldNameTitleMap map[string]string `json:"fieldNameTitleMap"` }
type IEntityExportService ¶
type IEntityExportService[TEntity mongodbr.IEntity] interface { GetRepository() mongodbr.IRepository ExportToCSV(options ExportOptions) (exportId string, err error) GetExport(exportId string) (*EntityExport, error) }
func NewEntityExportService ¶
func NewEntityExportService[T mongodbr.IEntity](repository mongodbr.IRepository) IEntityExportService[T]
type IEntityService ¶
type IEntityService[T mongodbr.IEntity] interface { GetRepository() mongodbr.IRepository FindAll() ([]T, error) FindList(filter interface{}, opts ...mongodbr.FindOption) (list []T, err error) Count(filter interface{}) (count int64, err error) FindById(id primitive.ObjectID) (*T, error) FindOne(filter interface{}) (*T, error) Create(interface{}) (*T, error) Delete(primitive.ObjectID) error DeleteMany(interface{}) (*mongo.DeleteResult, error) DeleteManyByIdList(idList []primitive.ObjectID) (*mongo.DeleteResult, error) UpdateFields(id primitive.ObjectID, update map[string]interface{}) error }
func NewEntityService ¶
func NewEntityService[T mongodbr.IEntity](repository mongodbr.IRepository) IEntityService[T]
type IEntityWithTenant ¶
func CheckEntityIsIEntityWithTenant ¶
func CheckEntityIsIEntityWithTenant(entityValue interface{}) IEntityWithTenant
type IEntityWithUser ¶
func CheckEntityIsIEntityWithUser ¶
func CheckEntityIsIEntityWithUser(entityValue interface{}) IEntityWithUser
type Pagination ¶
func (*Pagination) IsDefault ¶
func (p *Pagination) IsDefault() (ok bool)
func (*Pagination) IsZero ¶
func (p *Pagination) IsZero() (ok bool)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.