...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package core
17
18 import (
19 "context"
20 "time"
21 )
22
23
24 type EventStore interface {
25
26 List(context.Context) ([]*Event, error)
27
28
29 ListByUID(context.Context, string) ([]*Event, error)
30
31
32 ListByUIDs(context.Context, []string) ([]*Event, error)
33
34
35 ListByExperiment(context context.Context, namespace string, name string, kind string) ([]*Event, error)
36
37 ListByFilter(context.Context, Filter) ([]*Event, error)
38
39
40 Find(context.Context, uint) (*Event, error)
41
42
43 Create(context.Context, *Event) error
44
45
46 DeleteByUID(context.Context, string) error
47
48
49 DeleteByUIDs(context.Context, []string) error
50
51
52 DeleteByTime(context.Context, string, string) error
53
54
55 DeleteByDuration(context.Context, time.Duration) error
56 }
57
58 type Event struct {
59 ID uint `gorm:"primary_key" json:"id"`
60 ObjectID string `gorm:"index:object_id" json:"object_id"`
61 CreatedAt time.Time `json:"created_at"`
62 Namespace string `json:"namespace"`
63 Name string `json:"name"`
64 Kind string `json:"kind"`
65 Type string `json:"type"`
66 Reason string `json:"reason"`
67 Message string `gorm:"type:text;size:32768" json:"message"`
68 }
69