/
tax.go
31 lines (25 loc) · 902 Bytes
/
tax.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
package db
import (
"context"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"github.com/nam-truong-le/lambda-utils-go/v3/pkg/aws/ssm"
"github.com/nam-truong-le/lambda-utils-go/v3/pkg/mongodb"
)
const colTax = "taxes"
func CollectionTaxes(ctx context.Context) (*mongo.Collection, error) {
database, err := ssm.GetParameter(ctx, "/shop/mongo/database", false)
if err != nil {
return nil, err
}
return mongodb.Collection(ctx, database, colTax)
}
type Tax struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
Name string `bson:"name" json:"name"`
DisplayName string `bson:"displayName" json:"displayName"`
Rate string `bson:"rate" json:"rate"`
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
}