Documentation ¶
Index ¶
- Constants
- type EventLog
- type EventLogAsSelectOption
- type EventLogListFilter
- type EventLogListResult
- type EventLogPaginationListFilter
- type EventLogPaginationListResult
- type EventLogStorer
- type EventLogStorerImpl
- func (impl EventLogStorerImpl) CheckIfExistsByNameInOrgBranch(ctx context.Context, name string, orgID primitive.ObjectID, ...) (bool, error)
- func (impl EventLogStorerImpl) Create(ctx context.Context, u *EventLog) error
- func (impl EventLogStorerImpl) DeleteByID(ctx context.Context, id primitive.ObjectID) error
- func (impl EventLogStorerImpl) GetByID(ctx context.Context, id primitive.ObjectID) (*EventLog, error)
- func (impl EventLogStorerImpl) GetByName(ctx context.Context, name string) (*EventLog, error)
- func (impl EventLogStorerImpl) GetByPaymentProcessorEventLogID(ctx context.Context, paymentProcessorEventLogID string) (*EventLog, error)
- func (impl EventLogStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *EventLogListFilter) ([]*EventLogAsSelectOption, error)
- func (impl EventLogStorerImpl) ListByFilter(ctx context.Context, f *EventLogPaginationListFilter) (*EventLogPaginationListResult, error)
- func (impl EventLogStorerImpl) UpdateByID(ctx context.Context, m *EventLog) error
Constants ¶
View Source
const ( StatusPending = 1 StatusOK = 2 StatusError = 3 StatusArchived = 4 PrimaryTypeStripeWebhookEvent = 1 )
View Source
const ( SortOrderAscending = 1 SortOrderDescending = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventLog ¶
type EventLog struct { PrimaryType int8 `bson:"primary_type" json:"primary_type"` SecondaryType string `bson:"secondary_type" json:"secondary_type"` // Content field will store any datatype because we want the ability to // store complex data-structures from remote services (ex: Stripe, Inc.) and // be able to store simply stuff like plain ol' text. Content any `bson:"content" json:"content"` Error error `bson:"error" json:"error"` CreatedAt time.Time `bson:"created_at,omitempty" json:"created_at,omitempty"` ModifiedAt time.Time `bson:"modified_at,omitempty" json:"modified_at,omitempty"` Status int8 `bson:"status" json:"status"` // ExternalID represent the unique identifier provided by a remote system. ExternalID string `bson:"external_id" json:"external_id"` StoreID primitive.ObjectID `bson:"store_id" json:"store_id"` StoreName string `bson:"store_name" json:"store_name"` ID primitive.ObjectID `bson:"_id" json:"id"` }
type EventLogAsSelectOption ¶
type EventLogListFilter ¶
type EventLogListFilter struct { // Pagination related. Cursor primitive.ObjectID PageSize int64 SortField string SortOrder int8 // 1=ascending | -1=descending // Filter related. SearchText string StoreID primitive.ObjectID PrimaryType int8 `bson:"primary_type" json:"primary_type"` SecondaryType string `bson:"secondary_type" json:"secondary_type"` Status int8 `bson:"status" json:"status"` }
type EventLogListResult ¶
type EventLogPaginationListFilter ¶
type EventLogPaginationListFilter struct { // Pagination related. Cursor string PageSize int64 SortField string SortOrder int8 // 1=ascending | -1=descending // Filter related. SearchText string StoreID primitive.ObjectID PrimaryType int8 `bson:"primary_type" json:"primary_type"` SecondaryType string `bson:"secondary_type" json:"secondary_type"` Status int8 `bson:"status" json:"status"` }
type EventLogPaginationListResult ¶
type EventLogPaginationListResult struct { Results []*EventLog `json:"results"` NextCursor string `json:"next_cursor"` HasNextPage bool `json:"has_next_page"` }
EventLogPaginationListResult represents the paginated list results for the associate records.
type EventLogStorer ¶
type EventLogStorer interface { Create(ctx context.Context, m *EventLog) error GetByID(ctx context.Context, id primitive.ObjectID) (*EventLog, error) GetByName(ctx context.Context, name string) (*EventLog, error) GetByPaymentProcessorEventLogID(ctx context.Context, paymentProcessorEventLogID string) (*EventLog, error) UpdateByID(ctx context.Context, m *EventLog) error ListByFilter(ctx context.Context, m *EventLogPaginationListFilter) (*EventLogPaginationListResult, error) ListAsSelectOptionByFilter(ctx context.Context, f *EventLogListFilter) ([]*EventLogAsSelectOption, error) DeleteByID(ctx context.Context, id primitive.ObjectID) error CheckIfExistsByNameInOrgBranch(ctx context.Context, name string, orgID primitive.ObjectID, branchID primitive.ObjectID) (bool, error) }
EventLogStorer Interface for store.
func NewDatastore ¶
type EventLogStorerImpl ¶
type EventLogStorerImpl struct { Logger *slog.Logger DbClient *mongo.Client Collection *mongo.Collection }
func (EventLogStorerImpl) CheckIfExistsByNameInOrgBranch ¶
func (EventLogStorerImpl) Create ¶
func (impl EventLogStorerImpl) Create(ctx context.Context, u *EventLog) error
func (EventLogStorerImpl) DeleteByID ¶
func (EventLogStorerImpl) GetByPaymentProcessorEventLogID ¶
func (EventLogStorerImpl) ListAsSelectOptionByFilter ¶
func (impl EventLogStorerImpl) ListAsSelectOptionByFilter(ctx context.Context, f *EventLogListFilter) ([]*EventLogAsSelectOption, error)
func (EventLogStorerImpl) ListByFilter ¶
func (impl EventLogStorerImpl) ListByFilter(ctx context.Context, f *EventLogPaginationListFilter) (*EventLogPaginationListResult, error)
func (EventLogStorerImpl) UpdateByID ¶
func (impl EventLogStorerImpl) UpdateByID(ctx context.Context, m *EventLog) error
Click to show internal directories.
Click to hide internal directories.