datastore

package
v0.0.0-...-53e80a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HowHearAboutUsItemStatusActive   = 1
	HowHearAboutUsItemStatusArchived = 2
)
View Source
const (
	OrderAscending  = 1
	OrderDescending = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HowHearAboutUsItem

type HowHearAboutUsItem struct {
	ID                    primitive.ObjectID `bson:"_id" json:"id"`
	TenantID              primitive.ObjectID `bson:"tenant_id" json:"tenant_id"`
	Text                  string             `bson:"text" json:"text"`
	SortNumber            int8               `bson:"sort_number" json:"sort_number"`
	IsForAssociate        bool               `bson:"is_for_associate" json:"is_for_associate"`
	IsForCustomer         bool               `bson:"is_for_customer" json:"is_for_customer"`
	IsForStaff            bool               `bson:"is_for_staff" json:"is_for_staff"`
	Status                int8               `bson:"status" json:"status"`
	PublicID              uint64             `bson:"public_id" json:"public_id"`
	CreatedAt             time.Time          `bson:"created_at" json:"created_at"`
	CreatedByUserID       primitive.ObjectID `bson:"created_by_user_id" json:"created_by_user_id,omitempty"`
	CreatedByUserName     string             `bson:"created_by_user_name" json:"created_by_user_name"`
	CreatedFromIPAddress  string             `bson:"created_from_ip_address" json:"created_from_ip_address"`
	ModifiedAt            time.Time          `bson:"modified_at" json:"modified_at"`
	ModifiedByUserID      primitive.ObjectID `bson:"modified_by_user_id" json:"modified_by_user_id,omitempty"`
	ModifiedByUserName    string             `bson:"modified_by_user_name" json:"modified_by_user_name"`
	ModifiedFromIPAddress string             `bson:"modified_from_ip_address" json:"modified_from_ip_address"`
}

type HowHearAboutUsItemAsSelectOption

type HowHearAboutUsItemAsSelectOption struct {
	Value primitive.ObjectID `bson:"_id" json:"value"` // Extract from the database `_id` field and output through API as `value`.
	Label string             `bson:"text" json:"label"`
}

type HowHearAboutUsItemListResult

type HowHearAboutUsItemListResult struct {
	Results     []*HowHearAboutUsItem `json:"results"`
	NextCursor  primitive.ObjectID    `json:"next_cursor"`
	HasNextPage bool                  `json:"has_next_page"`
}

type HowHearAboutUsItemPaginationListFilter

type HowHearAboutUsItemPaginationListFilter struct {
	// Pagination related.
	Cursor    string
	PageSize  int64
	SortField string
	SortOrder int8 // 1=ascending | -1=descending

	// Filter related.
	TenantID   primitive.ObjectID
	Status     int8
	SearchText string
}

type HowHearAboutUsItemPaginationListResult

type HowHearAboutUsItemPaginationListResult struct {
	Results     []*HowHearAboutUsItem `json:"results"`
	NextCursor  string                `json:"next_cursor"`
	HasNextPage bool                  `json:"has_next_page"`
}

HowHearAboutUsItemPaginationListResult represents the paginated list results for the associate records.

type HowHearAboutUsItemStorer

type HowHearAboutUsItemStorer interface {
	Create(ctx context.Context, m *HowHearAboutUsItem) error
	GetByID(ctx context.Context, id primitive.ObjectID) (*HowHearAboutUsItem, error)
	GetByPublicID(ctx context.Context, oldID uint64) (*HowHearAboutUsItem, error)
	GetByText(ctx context.Context, text string) (*HowHearAboutUsItem, error)
	GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*HowHearAboutUsItem, error)
	CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
	UpdateByID(ctx context.Context, m *HowHearAboutUsItem) error
	ListByFilter(ctx context.Context, f *HowHearAboutUsItemPaginationListFilter) (*HowHearAboutUsItemPaginationListResult, error)
	ListAsSelectOptionByFilter(ctx context.Context, f *HowHearAboutUsItemPaginationListFilter) ([]*HowHearAboutUsItemAsSelectOption, error)
	ListByTenantID(ctx context.Context, tid primitive.ObjectID) (*HowHearAboutUsItemPaginationListResult, error)
	DeleteByID(ctx context.Context, id primitive.ObjectID) error
}

HowHearAboutUsItemStorer Interface for user.

func NewDatastore

func NewDatastore(appCfg *c.Conf, loggerp *slog.Logger, client *mongo.Client) HowHearAboutUsItemStorer

type HowHearAboutUsItemStorerImpl

type HowHearAboutUsItemStorerImpl struct {
	Logger     *slog.Logger
	DbClient   *mongo.Client
	Collection *mongo.Collection
}

func (HowHearAboutUsItemStorerImpl) CheckIfExistsByEmail

func (impl HowHearAboutUsItemStorerImpl) CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)

func (HowHearAboutUsItemStorerImpl) Create

func (HowHearAboutUsItemStorerImpl) DeleteByID

func (HowHearAboutUsItemStorerImpl) GetByID

func (HowHearAboutUsItemStorerImpl) GetByPublicID

func (impl HowHearAboutUsItemStorerImpl) GetByPublicID(ctx context.Context, oldID uint64) (*HowHearAboutUsItem, error)

func (HowHearAboutUsItemStorerImpl) GetByText

func (HowHearAboutUsItemStorerImpl) GetLatestByTenantID

func (impl HowHearAboutUsItemStorerImpl) GetLatestByTenantID(ctx context.Context, tenantID primitive.ObjectID) (*HowHearAboutUsItem, error)

func (HowHearAboutUsItemStorerImpl) ListAsSelectOptionByFilter

func (HowHearAboutUsItemStorerImpl) ListByTenantID

func (HowHearAboutUsItemStorerImpl) UpdateByID

Jump to

Keyboard shortcuts

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