-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathusage.go
64 lines (57 loc) · 1.7 KB
/
usage.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package mahi
import (
"context"
"time"
)
type UsageService interface {
Update(ctx context.Context, u *UpdateUsage) error
Usages(ctx context.Context, startDate, endDate time.Time) ([]*TotalUsage, error)
ApplicationUsages(ctx context.Context, applicationID string, startTime, endTime time.Time) ([]*Usage, error)
}
type UsageStorage interface {
Update(ctx context.Context, u *UpdateUsage) (*Usage, error)
Usages(ctx context.Context, startDate, endDate time.Time) ([]*TotalUsage, error)
ApplicationUsages(ctx context.Context, applicationID string, startTime, endTime time.Time) ([]*Usage, error)
}
type Usage struct {
ID string
ApplicationID string
Transformations int64
UniqueTransformations int64
Bandwidth int64
Storage int64
FileCount int64
StartDate time.Time
EndDate time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
type TotalUsage struct {
Transformations int64
UniqueTransformations int64
Bandwidth int64
Storage int64
FileCount int64
StartDate time.Time
EndDate time.Time
}
type NewUsage struct {
ApplicationID string
Transformations int64
UniqueTransformations int64
Bandwidth int64
Storage int64
FileCount int64
StartDate time.Time
EndDate time.Time
}
type UpdateUsage struct {
ApplicationID string
Transformations int64
UniqueTransformations int64
Bandwidth int64
Storage int64
FileCount int64
StartDate time.Time
EndDate time.Time
}