Documentation
¶
Index ¶
- Constants
- type Attachment
- type AttachmentAsSelectOption
- type AttachmentPaginationListFilter
- type AttachmentPaginationListResult
- type AttachmentStorer
- type AttachmentStorerImpl
- func (impl AttachmentStorerImpl) Create(ctx context.Context, u *Attachment) error
- func (impl AttachmentStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error
- func (impl AttachmentStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error)
- func (impl AttachmentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentPaginationListFilter) ([]*AttachmentAsSelectOption, error)
- func (impl AttachmentStorerImpl) ListByFilter(ctx context.Context, f *AttachmentPaginationListFilter) (*AttachmentPaginationListResult, error)
- func (impl AttachmentStorerImpl) UpdateByID(ctx context.Context, m *Attachment) error
Constants ¶
View Source
const ( StatusActive = 1 StatusError = 2 StatusArchived = 3 OwnershipTypeUser = 1 OwnershipTypeSubmission = 2 OwnershipTypeStore = 3 ContentTypeFile = 1 ContentTypeImage = 2 )
View Source
const ( SortOrderAscending = 1 SortOrderDescending = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct { StoreID primitive.ObjectID `bson:"store_id,omitempty" json:"store_id,omitempty"` StoreName string `bson:"store_name" json:"store_name"` StoreTimezone string `bson:"store_timezone" json:"store_timezone"` ID primitive.ObjectID `bson:"_id" json:"id"` CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at,omitempty"` CreatedByUserName string `bson:"created_by_user_name" json:"created_by_user_name"` CreatedByUserID primitive.ObjectID `bson:"created_by_user_id" json:"created_by_user_id"` ModifiedAt time.Time `bson:"modified_at,omitempty" json:"modified_at,omitempty"` ModifiedByUserName string `bson:"modified_by_user_name" json:"modified_by_user_name"` ModifiedByUserID primitive.ObjectID `bson:"modified_by_user_id" json:"modified_by_user_id"` Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Filename string `bson:"filename" json:"filename"` ObjectKey string `bson:"object_key" json:"object_key"` ObjectURL string `bson:"object_url" json:"object_url"` OwnershipID primitive.ObjectID `bson:"ownership_id" json:"ownership_id"` OwnershipType int8 `bson:"ownership_type" json:"ownership_type"` Status int8 `bson:"status" json:"status"` ContentType int8 `bson:"content_type" json:"content_type"` }
type AttachmentPaginationListFilter ¶
type AttachmentPaginationListFilter struct { // Pagination related. Cursor string PageSize int64 SortField string SortOrder int8 // 1=ascending | -1=descending // Filter related. StoreID primitive.ObjectID OwnershipID primitive.ObjectID CreatedByUserID primitive.ObjectID ModifiedByUserID primitive.ObjectID UserRole int8 ExcludeArchived bool }
type AttachmentPaginationListResult ¶
type AttachmentPaginationListResult struct { Results []*Attachment `json:"results"` NextCursor string `json:"next_cursor"` HasNextPage bool `json:"has_next_page"` }
AttachmentPaginationListResult represents the paginated list results for the associate records.
type AttachmentStorer ¶
type AttachmentStorer interface { Create(ctx context.Context, m *Attachment) error GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error) UpdateByID(ctx context.Context, m *Attachment) error ListByFilter(ctx context.Context, m *AttachmentPaginationListFilter) (*AttachmentPaginationListResult, error) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentPaginationListFilter) ([]*AttachmentAsSelectOption, error) DeleteByID(ctx context.Context, id primitive.ObjectID) error }
AttachmentStorer Interface for attachment.
func NewDatastore ¶
type AttachmentStorerImpl ¶
type AttachmentStorerImpl struct { Logger *slog.Logger DbClient *mongo.Client Collection *mongo.Collection }
func (AttachmentStorerImpl) Create ¶
func (impl AttachmentStorerImpl) Create(ctx context.Context, u *Attachment) error
func (AttachmentStorerImpl) DeleteByID ¶
func (AttachmentStorerImpl) GetByID ¶
func (impl AttachmentStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*Attachment, error)
func (AttachmentStorerImpl) ListAsSelectOptionByFilter ¶
func (impl AttachmentStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *AttachmentPaginationListFilter) ([]*AttachmentAsSelectOption, error)
func (AttachmentStorerImpl) ListByFilter ¶
func (impl AttachmentStorerImpl) ListByFilter(ctx context.Context, f *AttachmentPaginationListFilter) (*AttachmentPaginationListResult, error)
func (AttachmentStorerImpl) UpdateByID ¶
func (impl AttachmentStorerImpl) UpdateByID(ctx context.Context, m *Attachment) error
Click to show internal directories.
Click to hide internal directories.