24 lines
809 B
Go
24 lines
809 B
Go
package otherperson
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
// Sentinel errors returned by the service so the transport layer can map them to the
|
|
// right HTTP status without depending on GORM internals.
|
|
var (
|
|
ErrNameRequired = errors.New("name is required")
|
|
ErrNotFound = errors.New("other person not found")
|
|
ErrDuplicate = errors.New("another other person with the same name, mobile phone and email already exists")
|
|
)
|
|
|
|
type Service interface {
|
|
Create(ctx context.Context, p *OtherPerson) error
|
|
Update(ctx context.Context, p *OtherPerson) error
|
|
Delete(ctx context.Context, id, actor []byte) error
|
|
GetByID(ctx context.Context, id []byte) (*OtherPerson, error)
|
|
Search(ctx context.Context, q string, limit, offset int) ([]OtherPerson, int64, error)
|
|
Upsert(ctx context.Context, p *OtherPerson) error
|
|
}
|