-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
55 lines (49 loc) · 2.03 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
46
47
48
49
50
51
52
53
54
55
package domain
import (
"go.mongodb.org/mongo-driver/bson/primitive"
"time"
)
// TModel describes the object /*
type TModel struct {
// ID the identifier generated by db
ID interface{} `json:"id,omitempty"`
// Name is the name of the card
Name string `json:"name,omitempty"`
// Priority must be one of these: ['urgent', 'high', 'normal', 'medium', 'low']
Status string `json:"status,omitempty"`
// CreatedAt describes when the card has been created
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt describes when the card has been updated
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type MongoModel struct {
// ID the identifier generated by db
ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
// Name is the name of the card
Name string `json:"name,omitempty" bson:"name,omitempty"`
// Priority must be one of these: ['urgent', 'high', 'normal', 'medium', 'low']
Status string `json:"status,omitempty" bson:"status,omitempty"`
// CreatedAt describes when the card has been created
CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
// UpdatedAt describes when the card has been updated
UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}
type DynamoModel struct {
// ID the identifier generated by db
ID int `json:"id,omitempty" dynamodbav:"Id,omitempty"`
// Name is the name of the card
Name string `json:"name,omitempty" dynamodbav:"Name,omitempty"`
// Priority must be one of these: ['urgent', 'high', 'normal', 'medium', 'low']
Status string `json:"status,omitempty" dynamodbav:"Status,omitempty"`
// CreatedAt describes when the card has been created
CreatedAt time.Time `json:"created_at,omitempty" dynamodbav:"CreatedAt,omitempty"`
// UpdatedAt describes when the card has been updated
UpdatedAt time.Time `json:"updated_at,omitempty" dynamodbav:"UpdatedAt,omitempty"`
}
type ErrRes struct {
Code string `json:"code"`
Message string `json:"message"`
}
func NewErr(code, msg string) *ErrRes {
return &ErrRes{Code: code, Message: msg}
}