20 lines
693 B
Go
20 lines
693 B
Go
package currency
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
// ErrDuplicate is returned by Repository.Create/Update when the
|
|
// currency_from/currency_to pair already exists among active (non-deleted)
|
|
// rows, so the handler can respond with a clean 409 instead of a raw 500.
|
|
var ErrDuplicate = errors.New("currency pair already exists")
|
|
|
|
type Repository interface {
|
|
List(ctx context.Context, filter ListFilter) (ListCurrencyDTO, error)
|
|
GetByID(ctx context.Context, id int64) (CurrencyDTO, error)
|
|
Create(ctx context.Context, dto CreateCurrencyDTO) (CurrencyDTO, error)
|
|
Update(ctx context.Context, id int64, dto UpdateCurrencyDTO) (CurrencyDTO, error)
|
|
Delete(ctx context.Context, id int64) error
|
|
}
|