38 lines
897 B
Go
Executable File
38 lines
897 B
Go
Executable File
package test
|
|
|
|
import (
|
|
generated "Sipro-Marketplaces/internal/test/db/generated"
|
|
"context"
|
|
)
|
|
|
|
type Service interface {
|
|
Create(ctx context.Context, data string) (int32, error)
|
|
Get(ctx context.Context, id int32) (generated.Test, error)
|
|
Update(ctx context.Context, id int32, data string) error
|
|
Delete(ctx context.Context, id int32) error
|
|
}
|
|
|
|
type service struct {
|
|
repo Repository
|
|
}
|
|
|
|
func NewService(repo Repository) Service {
|
|
return &service{repo: repo}
|
|
}
|
|
|
|
func (s *service) Create(ctx context.Context, data string) (int32, error) {
|
|
return s.repo.Create(ctx, data)
|
|
}
|
|
|
|
func (s *service) Get(ctx context.Context, id int32) (generated.Test, error) {
|
|
return s.repo.Get(ctx, id)
|
|
}
|
|
|
|
func (s *service) Update(ctx context.Context, id int32, data string) error {
|
|
return s.repo.Update(ctx, id, data)
|
|
}
|
|
|
|
func (s *service) Delete(ctx context.Context, id int32) error {
|
|
return s.repo.Delete(ctx, id)
|
|
}
|