transaction

package
v0.0.0-...-76ff143 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(r *routing.RouteGroup, service Service, logger log.Logger)

RegisterHandlers sets up the routing of the HTTP handlers.

Types

type Repository

type Repository interface {
	// Get returns the album with the specified album ID.
	Get(ctx context.Context, id string) (entity.TransactionResponse, error)
	// Count returns the number of albums.
	Count(ctx context.Context) (int, error)
	// Query returns the list of albums with the given offset and limit.
	Query(ctx context.Context, offset, limit int) ([]entity.TransactionResponse, error)
	// Create saves a new album in the storage.
	Create(ctx context.Context, album entity.TransactionRequest) error
}

Repository encapsulates the logic to access albums from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new album repository

type Service

type Service interface {
	Get(ctx context.Context, id string) (Transaction, error)
	Query(ctx context.Context, offset, limit int) ([]Transaction, error)
	Count(ctx context.Context) (int, error)
	Create(ctx context.Context, input entity.TransactionRequest) (Transaction, error)
}

Service encapsulates usecase logic for transactions.

func NewService

func NewService(repo Repository, logger log.Logger) Service

NewService creates a new transaction service.

type Transaction

type Transaction struct {
	entity.TransactionResponse
}

Transaction represents the data about an transaction.

Jump to

Keyboard shortcuts

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