service

package
v0.0.0-...-55babe7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Services

func Services() fx.Option

Types

type Method

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

func (*Method) Create

func (m *Method) Create(ctx context.Context, method model.Method) (result model.Method, err error)

Create a new method in the database and return it

func (*Method) Get

func (m *Method) Get(ctx context.Context, methodName string) (method model.Method, err error)

Get a method from the database

func (*Method) List

func (m *Method) List(ctx context.Context) (methods []model.Method, err error)

List all methods in the database

type MethodI

type MethodI interface {
	Create(ctx context.Context, method model.Method) (model.Method, error)
	Get(ctx context.Context, method string) (model.Method, error)
	List(ctx context.Context) ([]model.Method, error)
}

func NewMethod

func NewMethod(cfg *config.Config, log *logger.Logger, db *database.Database, validate *validate.Validate) MethodI

type Orquestrate

type Orquestrate interface {
	Request(ctx context.Context, userRef string, method string, params []any) (result model.Envelope, err error)
}

func NewOrquestrator

func NewOrquestrator(conf *config.Config, log *logger.Logger, db *database.Database, redis *redis.Client) Orquestrate

type Orquestrator

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

func (*Orquestrator) Request

func (o *Orquestrator) Request(ctx context.Context, userRef string, methodName string, params []any) (result model.Envelope, err error)

Request godoc @Summary Request a method @Description Request a method from a provider or a group of providers and return the first response received

type Proveder

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

func (*Proveder) Create

func (p *Proveder) Create(ctx context.Context, provider model.Provider) (result model.Provider, err error)

Create godoc @Summary Create a new provider @Description Create a new provider

func (*Proveder) Delete

func (p *Proveder) Delete(ctx context.Context, signature, slug string) (err error)

Delete godoc @Summary Delete a provider @Description Delete a provider by slug name

func (*Proveder) Get

func (p *Proveder) Get(ctx context.Context, slug string) (provider model.Provider, err error)

Get godoc @Summary Get a provider @Description Get a provider by slug name and return it

func (*Proveder) List

func (p *Proveder) List(ctx context.Context, method string) (list []model.Provider, err error)

List godoc @Summary List providers @Description List providers that implement a method

func (*Proveder) Update

func (p *Proveder) Update(ctx context.Context, signature, slug string, update model.Provider) (provider model.Provider, err error)

Update godoc @Summary Update a provider @Description Update a provider by slug name and return it

type ProviderI

type ProviderI interface {
	Create(ctx context.Context, provider model.Provider) (model.Provider, error)
	Get(ctx context.Context, slug string) (model.Provider, error)
	Update(ctx context.Context, signature, slug string, provider model.Provider) (model.Provider, error)
	Delete(ctx context.Context, signature, slug string) error
	List(ctx context.Context, method string) ([]model.Provider, error)
}

func NewProvider

func NewProvider(cfg *config.Config, log *logger.Logger, db *database.Database, validate *validate.Validate, redis *redis.Client) ProviderI

Jump to

Keyboard shortcuts

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