-
Notifications
You must be signed in to change notification settings - Fork 3
/
model.go
45 lines (39 loc) · 1.8 KB
/
model.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
package outbox
import "time"
const (
// PublishedTableName ...
PublishedTableName = "outbox_published"
// ReceivedTableName ...
ReceivedTableName = "outbox_received"
)
// Published ...
type Published struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;type:BIGINT(20)"`
Version string `json:"version" gorm:"column:version;type:VARCHAR(20)"`
Topic string `json:"topic" gorm:"column:topic;type:VARCHAR(200);not null"`
Value string `json:"value" gorm:"column:value;type:LONGTEXT"`
Retries int `json:"retries" gorm:"column:retries;type:INT(11)"`
CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:DATETIME;not null"`
ExpiresAt *time.Time `json:"expires_at" gorm:"column:expires_at;type:DATETIME"`
StatusName string `json:"status_name" gorm:"index;column:status_name;type:VARCHAR(40);not null"`
}
// TableName ...
func (Published) TableName() string {
return PublishedTableName
}
// Received ...
type Received struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;type:BIGINT(20)"`
Version string `json:"version" gorm:"column:version;type:VARCHAR(20)"`
Topic string `json:"name" gorm:"column:name;type:VARCHAR(200);not null"`
Group string `json:"group" gorm:"column:group;type:VARCHAR(200);not null"`
Value string `json:"value" gorm:"column:value;type:LONGTEXT"`
Retries int `json:"retries" gorm:"column:retries;type:INT(11)"`
CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:DATETIME;not null"`
ExpiresAt *time.Time `json:"expires_at" gorm:"column:expires_at;type:DATETIME"`
StatusName string `json:"status_name" gorm:"index;column:status_name;type:VARCHAR(40);not null"`
}
// TableName ...
func (Received) TableName() string {
return ReceivedTableName
}