biz

package
v0.0.0-...-28c7c16 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

Biz

The Use Cases in biz are basically pass-through calls to the data layer.

The models in these packages are internal to inventory-api. If the system uses an ORM like gorm, they are the structs that are annotated to reflect database table mappings.

A user request initially creates objects from the public api layer. The service layer transforms them into models from biz. The reverse happens for responses: the service layer translates biz models to public api objects.

The eventing subsystem also has a relatively simple model in its api package, and the data subsystem translates biz models to it before sending events.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRepository

type DefaultRepository[T any, K Keys] interface {
	Save(context.Context, *T) (*T, error)
	Update(context.Context, *T, K) (*T, error)
	Delete(context.Context, K) error
	FindByID(context.Context, K) (*T, error)
	ListAll(context.Context) ([]*T, error)
}

type DefaultUsecase

type DefaultUsecase[T any, K Keys] struct {
	// contains filtered or unexported fields
}

func New

func New[T any, K Keys](repo DefaultRepository[T, K], logger log.Logger) *DefaultUsecase[T, K]

func (*DefaultUsecase[T, K]) Create

func (uc *DefaultUsecase[T, K]) Create(ctx context.Context, t *T) (*T, error)

func (*DefaultUsecase[T, K]) Delete

func (uc *DefaultUsecase[T, K]) Delete(ctx context.Context, id K) error

func (*DefaultUsecase[T, K]) Update

func (uc *DefaultUsecase[T, K]) Update(ctx context.Context, t *T, id K) (*T, error)

type Keys

type Keys interface {
	~string | ~int64
}

Directories

Path Synopsis
relationships
resources

Jump to

Keyboard shortcuts

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