product

package
v1.0.43 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "product"

Variables

This section is empty.

Functions

func MakeBsonFilter

func MakeBsonFilter(options *FilterOptions) bson.M

Types

type EsMapper

type EsMapper struct {
	// contains filtered or unexported fields
}

func (*EsMapper) CountWithQuery

func (m *EsMapper) CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error)

func (*EsMapper) Search

func (m *EsMapper) Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Product, int64, error)

type FilterOptions

type FilterOptions struct {
	OnlyUserId      *string
	OnlyProductId   *string
	OnlyProductIds  []string
	OnlyTags        []string
	OnlySetRelation *int64
	OnlyStatus      *int64
	OnlyType        *int64
}

type IEsMapper

type IEsMapper interface {
	Search(ctx context.Context, query []types.Query, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter esp.EsCursor) ([]*Product, int64, error)
	CountWithQuery(ctx context.Context, query []types.Query, fopts *FilterOptions) (int64, error)
}

func NewEsMapper

func NewEsMapper(config *config.Config) IEsMapper

type IProductMongoMapper

type IProductMongoMapper interface {
	Insert(ctx context.Context, data *Product) (string, error)
	FindOne(ctx context.Context, id string) (*Product, error)
	Update(ctx context.Context, data *Product) error
	Delete(ctx context.Context, id string) error
	FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Product, error)
	Count(ctx context.Context, fopts *FilterOptions) (int64, error)
	FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Product, int64, error)
}

func NewMongoMapper

func NewMongoMapper(config *config.Config) IProductMongoMapper

type MongoFilter

type MongoFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

func (*MongoFilter) CheckOnlyProductId

func (f *MongoFilter) CheckOnlyProductId()

func (*MongoFilter) CheckOnlyProductIds

func (f *MongoFilter) CheckOnlyProductIds()

func (*MongoFilter) CheckOnlyStatus

func (f *MongoFilter) CheckOnlyStatus()

func (*MongoFilter) CheckOnlyTags

func (f *MongoFilter) CheckOnlyTags()

func (*MongoFilter) CheckOnlyTyee

func (f *MongoFilter) CheckOnlyTyee()

func (*MongoFilter) CheckOnlyUserId

func (f *MongoFilter) CheckOnlyUserId()

type MongoMapper

type MongoMapper struct {
	// contains filtered or unexported fields
}

func (*MongoMapper) Count

func (m *MongoMapper) Count(ctx context.Context, filter *FilterOptions) (int64, error)

func (*MongoMapper) Delete

func (m *MongoMapper) Delete(ctx context.Context, id string) error

func (*MongoMapper) FindMany

func (m *MongoMapper) FindMany(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Product, error)

func (*MongoMapper) FindManyAndCount

func (m *MongoMapper) FindManyAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Product, int64, error)

func (*MongoMapper) FindOne

func (m *MongoMapper) FindOne(ctx context.Context, id string) (*Product, error)

func (*MongoMapper) Insert

func (m *MongoMapper) Insert(ctx context.Context, data *Product) (string, error)

func (*MongoMapper) Update

func (m *MongoMapper) Update(ctx context.Context, data *Product) error

type Product

type Product struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	UserId      string             `json:"userId,omitempty" bson:"userId,omitempty"`
	Name        string             `bson:"name,omitempty" json:"name,omitempty"`
	Status      int64              `json:"status,omitempty" bson:"status,omitempty"`
	Description string             `bson:"description,omitempty" json:"description,omitempty"`
	Urls        []string           `bson:"urls,omitempty" json:"urls,omitempty"`
	Tags        []string           `bson:"tags,omitempty" json:"tags,omitempty"`
	Type        int64              `json:"type,omitempty" bson:"type,omitempty"`
	Price       int64              `json:"price,omitempty" bson:"price,omitempty"`
	ProductSize int64              `json:"productSize,omitempty" bson:"productSize,omitempty"`
	UpdateAt    time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt    time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
	Score_      float64            `bson:"_score,omitempty" json:"_score,omitempty"`
}

Jump to

Keyboard shortcuts

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