Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOrderRequest ¶
CreateOrderRequest 创建订单请求
type CreateOrderResponse ¶
type CreateOrderResponse struct {
Order *Order `json:"order,omitempty"`
Error string `json:"error,omitempty"`
}
CreateOrderResponse 创建订单响应
type CreateUserRequest ¶
CreateUserRequest 创建用户请求
type CreateUserResponse ¶
type CreateUserResponse struct {
User *User `json:"user,omitempty"`
Error string `json:"error,omitempty"`
}
CreateUserResponse 创建用户响应
type GetOrderRequest ¶
type GetOrderRequest struct {
OrderID uint `json:"order_id"`
}
GetOrderRequest 获取订单请求
type GetOrderResponse ¶
type GetOrderResponse struct {
Order *Order `json:"order,omitempty"`
Error string `json:"error,omitempty"`
}
GetOrderResponse 获取订单响应
type GetUserResponse ¶
type GetUserResponse struct {
User *User `json:"user,omitempty"`
Error string `json:"error,omitempty"`
}
GetUserResponse 获取用户响应
type Order ¶ added in v1.2.0
type Order struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
UserID uint `json:"user_id" gorm:"column:user_id;not null;index"`
Item string `json:"item" gorm:"column:item;type:varchar(256);not null"`
}
Order 订单数据库模型
type OrderService ¶
type OrderService interface {
// CreateOrder 创建订单
CreateOrder(ctx context.Context, req CreateOrderRequest) (CreateOrderResponse, error)
// GetOrder 获取订单
GetOrder(ctx context.Context, req GetOrderRequest) (GetOrderResponse, error)
}
OrderService 订单服务
type User ¶ added in v1.2.0
type User struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Username string `json:"username" gorm:"column:username;type:varchar(64);not null;uniqueIndex"`
Email string `json:"email" gorm:"column:email;type:varchar(128);not null;uniqueIndex"`
}
User 用户数据库模型
type UserService ¶
type UserService interface {
// CreateUser 创建用户
CreateUser(ctx context.Context, req CreateUserRequest) (CreateUserResponse, error)
// GetUser 获取用户
GetUser(ctx context.Context, req GetUserRequest) (GetUserResponse, error)
}
UserService 用户服务
Click to show internal directories.
Click to hide internal directories.