seller

package
v0.0.0-...-8fab053 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Collection = "sellers"
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")

	ErrInvalidID = errors.New("invalid id")
)

Functions

This section is empty.

Types

type Info

type Info struct {
	ID          primitive.ObjectID `bson:"_id"`
	Title       string             `bson:"title,omitempty" json:"title"`
	Slug        string             `bson:"slug,omitempty" json:"slug"`
	Description string             `bson:"description,omitempty" json:"description"`
	CreatedAt   time.Time          `bson:"created_at,omitempty" json:"created_at"`
}

Info represent a individual seller information.

type NewSeller

type NewSeller struct {
	Title       string `json:"title" validate:"required"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
}

NewSeller what we required for insert data into the database.

type Seller

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

Seller manage set of API's seller access.

func New

func New(log *logrus.Logger, db *mongo.Database) Seller

New constructs a seller for api access.

func (Seller) Create

func (s Seller) Create(ctx context.Context, ns NewSeller, date time.Time) (Info, error)

Create inserts a specific seller into the database.

func (Seller) QueryAllByPaginate

func (s Seller) QueryAllByPaginate(ctx context.Context, limit, offer int) ([]Info, error)

func (Seller) QueryByID

func (s Seller) QueryByID(ctx context.Context, id string) (Info, error)

QueryByID gets a specific seller information from the database.

func (Seller) QueryByIDs

func (s Seller) QueryByIDs(ctx context.Context, ids []string) ([]Info, error)

Jump to

Keyboard shortcuts

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