producer

package
v0.0.0-...-37076da Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package producer is a domain package wich contains the producer features and behavior.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmailAlreadyExists = errors.New("email already exists")
View Source
var ErrEmptyPropertyValue = errors.New("empty property value")
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrInvalidProducerProp = errors.New("invalid producer property")
View Source
var ErrMissingProducerID = errors.New("missing producer id")

GetMeOptions validations

View Source
var ErrNoDataToSync = errors.New("no data to sync")
View Source
var ErrNoProducersFound = errors.New("no producers found")
View Source
var ErrProducerIDInvalid = errors.New("producer id invalid")

Functions

func WithEmail

func WithEmail(email string) baseuser.Option

WithEmail returns a baseuser.Option that sets the Email of a producer.

It receives a string and sets the Email of the producer. If the string is empty, it will return an error.

func WithID

func WithID(id string) baseuser.Option

WithID returns a baseuser.Option that sets the ID of a producer.

It receives a string and sets the ID of the producer. If the string is empty, it will return an error.

func WithPassword

func WithPassword(password string) baseuser.Option

WithPassword returns a baseuser.Option that sets the Password of a producer.

func WithScope

func WithScope(scope string) baseuser.Option

WithScope will add scope to usr

Types

type GetMe

type GetMe func(GetMeOptions) (Producer, error)

GetMe is the usecase to get the current producer It will use the session token

type GetMeOptions

type GetMeOptions struct {
	ProducerID string   `json:"producer_id" example:"1" format:"uuid" validate:"required,uuid"`
	Fields     []string `query:"fields" example:"id,email"`
}

GetMeOptions is the options for the GetMe usecase

func (*GetMeOptions) GetErrorMap

func (g *GetMeOptions) GetErrorMap() map[string]map[string]error

GetErrorMap implements ModuleErrorMap to GetMeOptions

type Producer

type Producer interface {
	baseuser.BaseUser
}

Producer has the baseUser interface implemented

func NewProducer

func NewProducer(usrOptions ...baseuser.Option) Producer

NewProducer returns a new producer instance.

It receive an array of options and applies them to the producer instance. If has no options, the instance will be empty.

type ProducerUpdater

type ProducerUpdater func(Producer) (Producer, error)

ProducerUpdater is a interface who defines the UpdateProducerRepository method

type RegisterProducer

type RegisterProducer func(Producer) (Producer, error)

RegisterProducer is the usecase to register a new producer

type RegisterProducerRepository

type RegisterProducerRepository interface {
	// Run executes the Register Producer query.
	//
	// Example:
	//
	//      newProducer, err := repo.Run(context.Backround(), producer)
	//
	Run(ctx context.Context, p Producer) (Producer, error)
}

RegisterProducerRepository is the repository implementation for Register Producer.

type UpdateProducerRepository

type UpdateProducerRepository interface {
	// Run executes the update in producer
	Run(ctx context.Context, usrID string, u ProducerUpdater) (Producer, error)
}

UpdateProducerRepository is repository implementation for Update Producer.

Jump to

Keyboard shortcuts

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