client

package
v0.0.0-...-eda81a1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func New

func New(storage Storage, tm Manager) *Controller

func (*Controller) Create

func (c *Controller) Create(ctx context.Context, obj model.Client) (string, error)

func (*Controller) Delete

func (c *Controller) Delete(ctx context.Context, ObjId string) error

func (*Controller) Get

func (c *Controller) Get(ctx context.Context, ObjId string) (model.Client, error)

func (*Controller) List

func (c *Controller) List(ctx context.Context) ([]model.Client, error)

func (*Controller) Update

func (c *Controller) Update(ctx context.Context, obj model.Client) (string, error)

type Manager

type Manager interface {
	// Do processes a transaction inside a closure.
	Do(context.Context, func(ctx context.Context) error) error
	// DoWithSettings processes a transaction inside a closure with custom trm.Settings.
	DoWithSettings(context.Context, trm.Settings, func(ctx context.Context) error) error
}

type Storage

type Storage interface {
	Create(ctx context.Context, dto repository.ClientDTO) (pgtype.UUID, error)
	GetByID(ctx context.Context, id pgtype.UUID) (repository.ClientDTO, error)
	Update(ctx context.Context, dto repository.ClientDTO) (pgtype.UUID, error)
	List(ctx context.Context) ([]repository.ClientDTO, error)
	Delete(ctx context.Context, client pgtype.UUID) error
}

Jump to

Keyboard shortcuts

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