Fixes
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package basket
|
||||
|
||||
import (
|
||||
"github.com/jackc/pgtype"
|
||||
)
|
||||
import "time"
|
||||
|
||||
type BasketEntity struct {
|
||||
ID string `db:"id" json:"id"`
|
||||
State string `db:"state" json:"state"`
|
||||
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type BasketItemEntity struct {
|
||||
@@ -17,6 +15,6 @@ type BasketItemEntity struct {
|
||||
ProductID string `db:"product_id" json:"product_id"`
|
||||
Quantity int `db:"quantity" json:"quantity"`
|
||||
Price float64 `db:"price" json:"price"`
|
||||
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
type Basket struct {
|
||||
State string `db:"state" json:"state"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type BasketItem struct {
|
||||
@@ -16,5 +16,5 @@ type BasketItem struct {
|
||||
Quantity int `db:"quantity" json:"quantity"`
|
||||
Price float64 `db:"price" json:"price"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ package catalog
|
||||
import "time"
|
||||
|
||||
type Product struct {
|
||||
ID string `json:"id", db:"id"`
|
||||
Slug string `json:"slug", db:"slug"`
|
||||
Name string `json:"name", db:"name"`
|
||||
Price float64 `json:"price", db:"price"`
|
||||
CreatedAt time.Time `json:"created_at", db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at", db:"updated_at, omitempty"`
|
||||
ID string `json:"id" db:"id"`
|
||||
Slug string `json:"slug" db:"slug"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Price float64 `json:"price" db:"price"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at" db:"updated_at, omitempty"`
|
||||
}
|
||||
|
||||
@@ -8,12 +8,5 @@ type User struct {
|
||||
Username string `db:"username" json:"username"`
|
||||
Password string `db:"password" json:"password"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt *time.Time `db:"updated_at,omitempty" json:"updated_at,omitempty"` // FIXME: zero-value issue
|
||||
UpdatedAt *time.Time `db:"updated_at,omitempty" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
// var TestUser = &User{
|
||||
// ID: 1,
|
||||
// Username: "test",
|
||||
// Password: "test",
|
||||
// CreateDate: time.Now(),
|
||||
// }
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package order
|
||||
|
||||
import "github.com/jackc/pgtype"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type OrderEntity struct {
|
||||
ID string `db:"id" json:"id"`
|
||||
State string `db:"state" json:"state"`
|
||||
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type OrderItemEntity struct {
|
||||
@@ -15,6 +17,6 @@ type OrderItemEntity struct {
|
||||
ProductID int `db:"product_id" json:"product_id"`
|
||||
Quantity int `db:"quantity" json:"quantity"`
|
||||
Price float64 `db:"price" json:"price"`
|
||||
CreatedAt pgtype.Timestamp `db:"created_at" json:"created_at"`
|
||||
UpdatedAt pgtype.Timestamp `db:"updated_at" json:"updated_at,omitempty"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import "time"
|
||||
type Order struct {
|
||||
State string `db:"state" json:"state"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type OrderItem struct {
|
||||
@@ -14,5 +14,5 @@ type OrderItem struct {
|
||||
Quantity int `db:"quantity" json:"quantity"`
|
||||
Price float64 `db:"price" json:"price"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user