Documentation ¶
Overview ¶
Package producer is a domain package wich contains the producer features and behavior.
Index ¶
- Variables
- func WithEmail(email string) baseuser.Option
- func WithID(id string) baseuser.Option
- func WithPassword(password string) baseuser.Option
- func WithScope(scope string) baseuser.Option
- type GetMe
- type GetMeOptions
- type Producer
- type ProducerUpdater
- type RegisterProducer
- type RegisterProducerRepository
- type UpdateProducerRepository
Constants ¶
This section is empty.
Variables ¶
var ErrEmailAlreadyExists = errors.New("email already exists")
var ErrEmptyPropertyValue = errors.New("empty property value")
var ErrInvalidCredentials = errors.New("invalid credentials")
var ErrInvalidProducerProp = errors.New("invalid producer property")
var ErrMissingProducerID = errors.New("missing producer id")
GetMeOptions validations
var ErrNoDataToSync = errors.New("no data to sync")
var ErrNoProducersFound = errors.New("no producers found")
var ErrProducerIDInvalid = errors.New("producer id invalid")
Functions ¶
func WithEmail ¶
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 ¶
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 ¶
WithPassword returns a baseuser.Option that sets the Password of a producer.
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 ¶
Producer has the baseUser interface implemented
func NewProducer ¶
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 ¶
ProducerUpdater is a interface who defines the UpdateProducerRepository method
type RegisterProducer ¶
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.