-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentity.go
More file actions
27 lines (18 loc) · 716 Bytes
/
entity.go
File metadata and controls
27 lines (18 loc) · 716 Bytes
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
package rip
import "context"
// start EntityProvider OMIT
// EntityProvider provides entities.
// An entity is an identifiable resource. Its id should be marshalable as string.
type EntityProvider[Ent any] interface {
// Create creates a resource that can be identified (an entity).
Create(ctx context.Context, ent Ent) (Ent, error)
// Get gets a entity with its id.
Get(ctx context.Context, id string) (Ent, error)
// Update updates an entity.
Update(ctx context.Context, ent Ent) error
// Delete deletes a entity with its id.
Delete(ctx context.Context, id string) error
// List lists a group of entities.
List(ctx context.Context, offset, limit int) ([]Ent, error)
}
// end EntityProvider OMIT