blob: 9cce1aab72c05b67bc93e6ac0f35d36fa948dcab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package domain
import (
"errors"
)
type Entity interface {
Identifiable
Validate() error
}
type entity struct {
ID ID `json:"id" jsonapi:"primary,entities"`
}
func (s *entity) GetID() ID {
return s.ID
}
func (s *entity) SetID(id ID) error {
s.ID = id
return nil
}
func (s *entity) Validate() error {
return errors.New("method Validate not implemented")
}
func (s *entity) ToGID() GlobalID {
return GlobalID("gid://sparkle/Entity/" + s.ID.String())
}
|