-
Notifications
You must be signed in to change notification settings - Fork 0
/
repository.go
47 lines (40 loc) · 1.63 KB
/
repository.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package hammer
import "context"
// TopicRepository interface
type TopicRepository interface {
Find(ctx context.Context, id string) (*Topic, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Topic, error)
Store(ctx context.Context, topic *Topic) error
Delete(ctx context.Context, id string) error
}
// SubscriptionRepository interface
type SubscriptionRepository interface {
Find(ctx context.Context, id string) (*Subscription, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Subscription, error)
Store(ctx context.Context, subscription *Subscription) error
Delete(ctx context.Context, id string) error
}
// MessageRepository interface
type MessageRepository interface {
Find(ctx context.Context, id string) (*Message, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Message, error)
Store(ctx context.Context, message *Message) error
Delete(ctx context.Context, id string) error
}
// DeliveryRepository interface
type DeliveryRepository interface {
Find(ctx context.Context, id string) (*Delivery, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Delivery, error)
Store(ctx context.Context, delivery *Delivery) error
Dispatch(ctx context.Context) (*DeliveryAttempt, error)
}
// DeliveryAttemptRepository interface
type DeliveryAttemptRepository interface {
Find(ctx context.Context, id string) (*DeliveryAttempt, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*DeliveryAttempt, error)
Store(ctx context.Context, deliveryAttempt *DeliveryAttempt) error
}
// MigrationRepository interface
type MigrationRepository interface {
Run(ctx context.Context) error
}