feat: add category api
This commit is contained in:
parent
44152bf93a
commit
8d042000f5
|
@ -1,3 +1,3 @@
|
||||||
.idea/
|
.idea/
|
||||||
etc/gateway.yaml
|
etc/product.yaml
|
||||||
.DS_Store
|
.DS_Store
|
|
@ -14,9 +14,7 @@ linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
# Specifically enable linters we want to use.
|
# Specifically enable linters we want to use.
|
||||||
enable:
|
enable:
|
||||||
# - depguard
|
|
||||||
- errcheck
|
- errcheck
|
||||||
# - godot
|
|
||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
- gosimple
|
- gosimple
|
||||||
|
@ -24,22 +22,15 @@ linters:
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- misspell
|
- misspell
|
||||||
- revive
|
- revive
|
||||||
# - staticcheck
|
|
||||||
- typecheck
|
- typecheck
|
||||||
- unused
|
- unused
|
||||||
# - wsl
|
|
||||||
- asasalint
|
- asasalint
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- bidichk
|
- bidichk
|
||||||
- bodyclose
|
- bodyclose
|
||||||
# - containedctx
|
|
||||||
- contextcheck
|
- contextcheck
|
||||||
# - cyclop
|
|
||||||
# - varnamelen
|
|
||||||
# - gci
|
|
||||||
- wastedassign
|
- wastedassign
|
||||||
- whitespace
|
- whitespace
|
||||||
# - wrapcheck
|
|
||||||
- thelper
|
- thelper
|
||||||
- tparallel
|
- tparallel
|
||||||
- unconvert
|
- unconvert
|
||||||
|
@ -66,34 +57,26 @@ linters:
|
||||||
- nonamedreturns
|
- nonamedreturns
|
||||||
- decorder
|
- decorder
|
||||||
- dogsled
|
- dogsled
|
||||||
# - dupl
|
|
||||||
- dupword
|
- dupword
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- errchkjson
|
- errchkjson
|
||||||
- errname
|
- errname
|
||||||
- errorlint
|
- errorlint
|
||||||
# - execinquery
|
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- forbidigo
|
- forbidigo
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
# - gochecknoglobals
|
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- gocognit
|
- gocognit
|
||||||
- goconst
|
- goconst
|
||||||
- gocritic
|
- gocritic
|
||||||
- gocyclo
|
- gocyclo
|
||||||
# - godox
|
|
||||||
# - goerr113
|
|
||||||
# - gofumpt
|
|
||||||
- goheader
|
- goheader
|
||||||
- gomoddirectives
|
- gomoddirectives
|
||||||
# - gomodguard always failed
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- grouper
|
- grouper
|
||||||
- importas
|
- importas
|
||||||
- interfacebloat
|
- interfacebloat
|
||||||
# - ireturn
|
|
||||||
- lll
|
- lll
|
||||||
- loggercheck
|
- loggercheck
|
||||||
- maintidx
|
- maintidx
|
||||||
|
|
|
@ -14,13 +14,26 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
Category = product.Category
|
||||||
|
CategoryReq = product.CategoryReq
|
||||||
CreateCategoryReq = product.CreateCategoryReq
|
CreateCategoryReq = product.CreateCategoryReq
|
||||||
|
ListCategoryReq = product.ListCategoryReq
|
||||||
|
ListCategoryResp = product.ListCategoryResp
|
||||||
|
ModifyCategoryReq = product.ModifyCategoryReq
|
||||||
NoneReq = product.NoneReq
|
NoneReq = product.NoneReq
|
||||||
OKResp = product.OKResp
|
OKResp = product.OKResp
|
||||||
|
|
||||||
Product interface {
|
Product interface {
|
||||||
// CreateCategory 建立 product 分類
|
// ====================== Category Service Start ======================
|
||||||
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error)
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultProduct struct {
|
defaultProduct struct {
|
||||||
|
@ -34,8 +47,32 @@ func NewProduct(cli zrpc.Client) Product {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateCategory 建立 product 分類
|
// ====================== Category Service Start ======================
|
||||||
func (m *defaultProduct) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
func (m *defaultProduct) CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
||||||
client := product.NewProductClient(m.cli.Conn())
|
client := product.NewProductClient(m.cli.Conn())
|
||||||
return client.CreateCategory(ctx, in, opts...)
|
return client.CreateCategory(ctx, in, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
func (m *defaultProduct) ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
||||||
|
client := product.NewProductClient(m.cli.Conn())
|
||||||
|
return client.ModifyCategory(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
func (m *defaultProduct) DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
||||||
|
client := product.NewProductClient(m.cli.Conn())
|
||||||
|
return client.DeleteCategory(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
func (m *defaultProduct) GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error) {
|
||||||
|
client := product.NewProductClient(m.cli.Conn())
|
||||||
|
return client.GetCategory(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
func (m *defaultProduct) ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error) {
|
||||||
|
client := product.NewProductClient(m.cli.Conn())
|
||||||
|
return client.ListCategory(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ Mongo:
|
||||||
User: "service"
|
User: "service"
|
||||||
Password: "lReiYk7GRjH4RUqH"
|
Password: "lReiYk7GRjH4RUqH"
|
||||||
Port: "27017"
|
Port: "27017"
|
||||||
Database: digimon_member
|
Database: play_product
|
||||||
ReplicaName: "rs0"
|
ReplicaName: "rs0"
|
||||||
MaxStaleness: 30m
|
MaxStaleness: 30m
|
||||||
MaxPoolSize: 30
|
MaxPoolSize: 30
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.36.1
|
// protoc-gen-go v1.36.5
|
||||||
// protoc v3.19.4
|
// protoc v3.19.4
|
||||||
// source: generate/protobuf/product.proto
|
// source: generate/protobuf/product.proto
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import (
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -94,6 +95,7 @@ func (*NoneReq) Descriptor() ([]byte, []int) {
|
||||||
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{1}
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ====================== Category Param ======================
|
||||||
type CreateCategoryReq struct {
|
type CreateCategoryReq struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
@ -138,50 +140,379 @@ func (x *CreateCategoryReq) GetName() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ModifyCategoryReq struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ModifyCategoryReq) Reset() {
|
||||||
|
*x = ModifyCategoryReq{}
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ModifyCategoryReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ModifyCategoryReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ModifyCategoryReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ModifyCategoryReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ModifyCategoryReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ModifyCategoryReq) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ModifyCategoryReq) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CategoryReq struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CategoryReq) Reset() {
|
||||||
|
*x = CategoryReq{}
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CategoryReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CategoryReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CategoryReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CategoryReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CategoryReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CategoryReq) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type Category struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
CreateTime int64 `protobuf:"varint,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||||
|
UpdateTime int64 `protobuf:"varint,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) Reset() {
|
||||||
|
*x = Category{}
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Category) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Category) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Category.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Category) Descriptor() ([]byte, []int) {
|
||||||
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) GetCreateTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreateTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Category) GetUpdateTime() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UpdateTime
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListCategoryReq struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
PageIndex int64 `protobuf:"varint,1,opt,name=page_index,json=pageIndex,proto3" json:"page_index,omitempty"`
|
||||||
|
PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||||
|
Ids []string `protobuf:"bytes,3,rep,name=ids,proto3" json:"ids,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) Reset() {
|
||||||
|
*x = ListCategoryReq{}
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListCategoryReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[6]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ListCategoryReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ListCategoryReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) GetPageIndex() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PageIndex
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) GetPageSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PageSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryReq) GetIds() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Ids
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListCategoryResp struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
|
||||||
|
Data []*Category `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryResp) Reset() {
|
||||||
|
*x = ListCategoryResp{}
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryResp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ListCategoryResp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ListCategoryResp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_generate_protobuf_product_proto_msgTypes[7]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ListCategoryResp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ListCategoryResp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_generate_protobuf_product_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryResp) GetTotal() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Total
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListCategoryResp) GetData() []*Category {
|
||||||
|
if x != nil {
|
||||||
|
return x.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_generate_protobuf_product_proto protoreflect.FileDescriptor
|
var File_generate_protobuf_product_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_generate_protobuf_product_proto_rawDesc = []byte{
|
var file_generate_protobuf_product_proto_rawDesc = string([]byte{
|
||||||
0x0a, 0x1f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x0a, 0x1f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x62, 0x75, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x12, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, 0x08, 0x0a, 0x06, 0x4f, 0x4b,
|
0x6f, 0x12, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, 0x08, 0x0a, 0x06, 0x4f, 0x4b,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x22, 0x09, 0x0a, 0x07, 0x4e, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x22,
|
0x52, 0x65, 0x73, 0x70, 0x22, 0x09, 0x0a, 0x07, 0x4e, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x22,
|
||||||
0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
||||||
0x79, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
|
0x79, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x48, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64,
|
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x37, 0x0a, 0x11, 0x4d, 0x6f, 0x64, 0x69,
|
||||||
0x75, 0x63, 0x74, 0x12, 0x3d, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x74,
|
0x66, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a,
|
||||||
0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e,
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
||||||
0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x4f, 0x4b, 0x52, 0x65,
|
0x65, 0x22, 0x1d, 0x0a, 0x0b, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71,
|
||||||
0x73, 0x70, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x62,
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x22, 0x70, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02,
|
||||||
}
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04,
|
||||||
|
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
|
0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
||||||
|
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
|
||||||
|
0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
||||||
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||||
|
0x6d, 0x65, 0x22, 0x5f, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||||
|
0x72, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e,
|
||||||
|
0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x49,
|
||||||
|
0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a,
|
||||||
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a,
|
||||||
|
0x65, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03,
|
||||||
|
0x69, 0x64, 0x73, 0x22, 0x4f, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67,
|
||||||
|
0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x25, 0x0a,
|
||||||
|
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72,
|
||||||
|
0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x04,
|
||||||
|
0x64, 0x61, 0x74, 0x61, 0x32, 0xbd, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
|
||||||
|
0x12, 0x3d, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||||
|
0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x43, 0x72, 0x65,
|
||||||
|
0x61, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x0f,
|
||||||
|
0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||||
|
0x3d, 0x0a, 0x0e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
||||||
|
0x79, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x4d, 0x6f, 0x64, 0x69,
|
||||||
|
0x66, 0x79, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
|
||||||
|
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x37,
|
||||||
|
0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
|
||||||
|
0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67,
|
||||||
|
0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
|
||||||
|
0x2e, 0x4f, 0x4b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x61,
|
||||||
|
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
|
||||||
|
0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12,
|
||||||
|
0x43, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12,
|
||||||
|
0x18, 0x2e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61,
|
||||||
|
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x64,
|
||||||
|
0x75, 0x63, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
|
||||||
|
0x52, 0x65, 0x73, 0x70, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
|
||||||
|
0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_generate_protobuf_product_proto_rawDescOnce sync.Once
|
file_generate_protobuf_product_proto_rawDescOnce sync.Once
|
||||||
file_generate_protobuf_product_proto_rawDescData = file_generate_protobuf_product_proto_rawDesc
|
file_generate_protobuf_product_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_generate_protobuf_product_proto_rawDescGZIP() []byte {
|
func file_generate_protobuf_product_proto_rawDescGZIP() []byte {
|
||||||
file_generate_protobuf_product_proto_rawDescOnce.Do(func() {
|
file_generate_protobuf_product_proto_rawDescOnce.Do(func() {
|
||||||
file_generate_protobuf_product_proto_rawDescData = protoimpl.X.CompressGZIP(file_generate_protobuf_product_proto_rawDescData)
|
file_generate_protobuf_product_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_generate_protobuf_product_proto_rawDesc), len(file_generate_protobuf_product_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_generate_protobuf_product_proto_rawDescData
|
return file_generate_protobuf_product_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_generate_protobuf_product_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
var file_generate_protobuf_product_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||||
var file_generate_protobuf_product_proto_goTypes = []any{
|
var file_generate_protobuf_product_proto_goTypes = []any{
|
||||||
(*OKResp)(nil), // 0: product.OKResp
|
(*OKResp)(nil), // 0: product.OKResp
|
||||||
(*NoneReq)(nil), // 1: product.NoneReq
|
(*NoneReq)(nil), // 1: product.NoneReq
|
||||||
(*CreateCategoryReq)(nil), // 2: product.CreateCategoryReq
|
(*CreateCategoryReq)(nil), // 2: product.CreateCategoryReq
|
||||||
|
(*ModifyCategoryReq)(nil), // 3: product.ModifyCategoryReq
|
||||||
|
(*CategoryReq)(nil), // 4: product.CategoryReq
|
||||||
|
(*Category)(nil), // 5: product.Category
|
||||||
|
(*ListCategoryReq)(nil), // 6: product.ListCategoryReq
|
||||||
|
(*ListCategoryResp)(nil), // 7: product.ListCategoryResp
|
||||||
}
|
}
|
||||||
var file_generate_protobuf_product_proto_depIdxs = []int32{
|
var file_generate_protobuf_product_proto_depIdxs = []int32{
|
||||||
2, // 0: product.Product.CreateCategory:input_type -> product.CreateCategoryReq
|
5, // 0: product.ListCategoryResp.data:type_name -> product.Category
|
||||||
0, // 1: product.Product.CreateCategory:output_type -> product.OKResp
|
2, // 1: product.Product.CreateCategory:input_type -> product.CreateCategoryReq
|
||||||
1, // [1:2] is the sub-list for method output_type
|
3, // 2: product.Product.ModifyCategory:input_type -> product.ModifyCategoryReq
|
||||||
0, // [0:1] is the sub-list for method input_type
|
4, // 3: product.Product.DeleteCategory:input_type -> product.CategoryReq
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
4, // 4: product.Product.GetCategory:input_type -> product.CategoryReq
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
6, // 5: product.Product.ListCategory:input_type -> product.ListCategoryReq
|
||||||
0, // [0:0] is the sub-list for field type_name
|
0, // 6: product.Product.CreateCategory:output_type -> product.OKResp
|
||||||
|
0, // 7: product.Product.ModifyCategory:output_type -> product.OKResp
|
||||||
|
0, // 8: product.Product.DeleteCategory:output_type -> product.OKResp
|
||||||
|
5, // 9: product.Product.GetCategory:output_type -> product.Category
|
||||||
|
7, // 10: product.Product.ListCategory:output_type -> product.ListCategoryResp
|
||||||
|
6, // [6:11] is the sub-list for method output_type
|
||||||
|
1, // [1:6] is the sub-list for method input_type
|
||||||
|
1, // [1:1] is the sub-list for extension type_name
|
||||||
|
1, // [1:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:1] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_generate_protobuf_product_proto_init() }
|
func init() { file_generate_protobuf_product_proto_init() }
|
||||||
|
@ -193,9 +524,9 @@ func file_generate_protobuf_product_proto_init() {
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_generate_protobuf_product_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_generate_protobuf_product_proto_rawDesc), len(file_generate_protobuf_product_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 8,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
@ -204,7 +535,6 @@ func file_generate_protobuf_product_proto_init() {
|
||||||
MessageInfos: file_generate_protobuf_product_proto_msgTypes,
|
MessageInfos: file_generate_protobuf_product_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_generate_protobuf_product_proto = out.File
|
File_generate_protobuf_product_proto = out.File
|
||||||
file_generate_protobuf_product_proto_rawDesc = nil
|
|
||||||
file_generate_protobuf_product_proto_goTypes = nil
|
file_generate_protobuf_product_proto_goTypes = nil
|
||||||
file_generate_protobuf_product_proto_depIdxs = nil
|
file_generate_protobuf_product_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,27 @@ const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Product_CreateCategory_FullMethodName = "/product.Product/CreateCategory"
|
Product_CreateCategory_FullMethodName = "/product.Product/CreateCategory"
|
||||||
|
Product_ModifyCategory_FullMethodName = "/product.Product/ModifyCategory"
|
||||||
|
Product_DeleteCategory_FullMethodName = "/product.Product/DeleteCategory"
|
||||||
|
Product_GetCategory_FullMethodName = "/product.Product/GetCategory"
|
||||||
|
Product_ListCategory_FullMethodName = "/product.Product/ListCategory"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProductClient is the client API for Product service.
|
// ProductClient is the client API for Product service.
|
||||||
//
|
//
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type ProductClient interface {
|
type ProductClient interface {
|
||||||
|
// ====================== Category Service Start ======================
|
||||||
// CreateCategory 建立 product 分類
|
// CreateCategory 建立 product 分類
|
||||||
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
CreateCategory(ctx context.Context, in *CreateCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error)
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error)
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type productClient struct {
|
type productClient struct {
|
||||||
|
@ -48,12 +61,61 @@ func (c *productClient) CreateCategory(ctx context.Context, in *CreateCategoryRe
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *productClient) ModifyCategory(ctx context.Context, in *ModifyCategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(OKResp)
|
||||||
|
err := c.cc.Invoke(ctx, Product_ModifyCategory_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *productClient) DeleteCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*OKResp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(OKResp)
|
||||||
|
err := c.cc.Invoke(ctx, Product_DeleteCategory_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *productClient) GetCategory(ctx context.Context, in *CategoryReq, opts ...grpc.CallOption) (*Category, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(Category)
|
||||||
|
err := c.cc.Invoke(ctx, Product_GetCategory_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *productClient) ListCategory(ctx context.Context, in *ListCategoryReq, opts ...grpc.CallOption) (*ListCategoryResp, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(ListCategoryResp)
|
||||||
|
err := c.cc.Invoke(ctx, Product_ListCategory_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ProductServer is the server API for Product service.
|
// ProductServer is the server API for Product service.
|
||||||
// All implementations must embed UnimplementedProductServer
|
// All implementations must embed UnimplementedProductServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
type ProductServer interface {
|
type ProductServer interface {
|
||||||
|
// ====================== Category Service Start ======================
|
||||||
// CreateCategory 建立 product 分類
|
// CreateCategory 建立 product 分類
|
||||||
CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error)
|
CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error)
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
ModifyCategory(context.Context, *ModifyCategoryReq) (*OKResp, error)
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
DeleteCategory(context.Context, *CategoryReq) (*OKResp, error)
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
GetCategory(context.Context, *CategoryReq) (*Category, error)
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
ListCategory(context.Context, *ListCategoryReq) (*ListCategoryResp, error)
|
||||||
mustEmbedUnimplementedProductServer()
|
mustEmbedUnimplementedProductServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +129,18 @@ type UnimplementedProductServer struct{}
|
||||||
func (UnimplementedProductServer) CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error) {
|
func (UnimplementedProductServer) CreateCategory(context.Context, *CreateCategoryReq) (*OKResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateCategory not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateCategory not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedProductServer) ModifyCategory(context.Context, *ModifyCategoryReq) (*OKResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ModifyCategory not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedProductServer) DeleteCategory(context.Context, *CategoryReq) (*OKResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method DeleteCategory not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedProductServer) GetCategory(context.Context, *CategoryReq) (*Category, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetCategory not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedProductServer) ListCategory(context.Context, *ListCategoryReq) (*ListCategoryResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ListCategory not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
|
func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
|
||||||
func (UnimplementedProductServer) testEmbeddedByValue() {}
|
func (UnimplementedProductServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
@ -106,6 +180,78 @@ func _Product_CreateCategory_Handler(srv interface{}, ctx context.Context, dec f
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Product_ModifyCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ModifyCategoryReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ProductServer).ModifyCategory(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Product_ModifyCategory_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ProductServer).ModifyCategory(ctx, req.(*ModifyCategoryReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Product_DeleteCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CategoryReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ProductServer).DeleteCategory(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Product_DeleteCategory_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ProductServer).DeleteCategory(ctx, req.(*CategoryReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Product_GetCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CategoryReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ProductServer).GetCategory(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Product_GetCategory_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ProductServer).GetCategory(ctx, req.(*CategoryReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Product_ListCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ListCategoryReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(ProductServer).ListCategory(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: Product_ListCategory_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(ProductServer).ListCategory(ctx, req.(*ListCategoryReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
|
// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -117,6 +263,22 @@ var Product_ServiceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "CreateCategory",
|
MethodName: "CreateCategory",
|
||||||
Handler: _Product_CreateCategory_Handler,
|
Handler: _Product_CreateCategory_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ModifyCategory",
|
||||||
|
Handler: _Product_ModifyCategory_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "DeleteCategory",
|
||||||
|
Handler: _Product_DeleteCategory_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetCategory",
|
||||||
|
Handler: _Product_GetCategory_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ListCategory",
|
||||||
|
Handler: _Product_ListCategory_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "generate/protobuf/product.proto",
|
Metadata: "generate/protobuf/product.proto",
|
||||||
|
|
|
@ -9,12 +9,54 @@ message OKResp {}
|
||||||
// NoneReq
|
// NoneReq
|
||||||
message NoneReq {}
|
message NoneReq {}
|
||||||
|
|
||||||
|
// ====================== Category Param ======================
|
||||||
message CreateCategoryReq {
|
message CreateCategoryReq {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ModifyCategoryReq {
|
||||||
|
string id =1;
|
||||||
|
string name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CategoryReq {
|
||||||
|
string id =1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Category {
|
||||||
|
string id =1;
|
||||||
|
string name =2;
|
||||||
|
int64 create_time=3;
|
||||||
|
int64 update_time=4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListCategoryReq {
|
||||||
|
int64 page_index =1;
|
||||||
|
int64 page_size =2;
|
||||||
|
repeated string ids=3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListCategoryResp {
|
||||||
|
int64 total =1;
|
||||||
|
repeated Category data=3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ====================== Category Param ======================
|
||||||
|
|
||||||
|
|
||||||
service Product {
|
service Product {
|
||||||
|
// ====================== Category Service Start ======================
|
||||||
// CreateCategory 建立 product 分類
|
// CreateCategory 建立 product 分類
|
||||||
rpc CreateCategory(CreateCategoryReq) returns(OKResp);
|
rpc CreateCategory(CreateCategoryReq) returns(OKResp);
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
rpc ModifyCategory(ModifyCategoryReq) returns(OKResp);
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
rpc DeleteCategory(CategoryReq) returns(OKResp);
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
rpc GetCategory(CategoryReq) returns(Category);
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
rpc ListCategory(ListCategoryReq) returns(ListCategoryResp);
|
||||||
|
// ====================== Category Service End ======================
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package productlogic
|
package productlogic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/entity"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
||||||
|
@ -25,6 +26,12 @@ func NewCreateCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cr
|
||||||
|
|
||||||
// CreateCategory 建立 product 分類
|
// CreateCategory 建立 product 分類
|
||||||
func (l *CreateCategoryLogic) CreateCategory(in *product.CreateCategoryReq) (*product.OKResp, error) {
|
func (l *CreateCategoryLogic) CreateCategory(in *product.CreateCategoryReq) (*product.OKResp, error) {
|
||||||
|
err := l.svcCtx.CategoryUseCase.Insert(l.ctx, &entity.Category{
|
||||||
|
Name: in.GetName(),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &product.OKResp{}, nil
|
return &product.OKResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package productlogic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteCategoryLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCategoryLogic {
|
||||||
|
return &DeleteCategoryLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
func (l *DeleteCategoryLogic) DeleteCategory(in *product.CategoryReq) (*product.OKResp, error) {
|
||||||
|
err := l.svcCtx.CategoryUseCase.Delete(l.ctx, in.GetId())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &product.OKResp{}, nil
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package productlogic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetCategoryLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCategoryLogic {
|
||||||
|
return &GetCategoryLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
func (l *GetCategoryLogic) GetCategory(in *product.CategoryReq) (*product.Category, error) {
|
||||||
|
category, err := l.svcCtx.CategoryUseCase.FindOneByID(l.ctx, in.GetId())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &product.Category{
|
||||||
|
Id: category.ID.Hex(),
|
||||||
|
Name: category.Name,
|
||||||
|
CreateTime: category.CreatedAt,
|
||||||
|
UpdateTime: category.UpdatedAt,
|
||||||
|
}, nil
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package productlogic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/usecase"
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ListCategoryLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewListCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListCategoryLogic {
|
||||||
|
return &ListCategoryLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListCategory 建立 product 分類
|
||||||
|
func (l *ListCategoryLogic) ListCategory(in *product.ListCategoryReq) (*product.ListCategoryResp, error) {
|
||||||
|
q := usecase.CategoryQueryParams{
|
||||||
|
PageSize: in.GetPageSize(),
|
||||||
|
PageIndex: in.GetPageIndex(),
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(in.GetIds()) > 0 {
|
||||||
|
q.ID = in.GetIds()
|
||||||
|
}
|
||||||
|
|
||||||
|
categorys, total, err := l.svcCtx.CategoryUseCase.ListCategory(l.ctx, q)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
res := make([]*product.Category, 0, len(categorys))
|
||||||
|
for _, category := range categorys {
|
||||||
|
res = append(res, &product.Category{
|
||||||
|
Id: category.ID.Hex(),
|
||||||
|
Name: category.Name,
|
||||||
|
CreateTime: category.CreatedAt,
|
||||||
|
UpdateTime: category.UpdatedAt,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return &product.ListCategoryResp{
|
||||||
|
Total: total,
|
||||||
|
Data: res,
|
||||||
|
}, nil
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package productlogic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/entity"
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
||||||
|
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ModifyCategoryLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewModifyCategoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ModifyCategoryLogic {
|
||||||
|
return &ModifyCategoryLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
func (l *ModifyCategoryLogic) ModifyCategory(in *product.ModifyCategoryReq) (*product.OKResp, error) {
|
||||||
|
err := l.svcCtx.CategoryUseCase.Update(l.ctx, in.GetId(), &entity.Category{Name: in.GetName()})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &product.OKResp{}, nil
|
||||||
|
}
|
|
@ -23,8 +23,32 @@ func NewProductServer(svcCtx *svc.ServiceContext) *ProductServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateCategory 建立 product 分類
|
// ====================== Category Service Start ======================
|
||||||
func (s *ProductServer) CreateCategory(ctx context.Context, in *product.CreateCategoryReq) (*product.OKResp, error) {
|
func (s *ProductServer) CreateCategory(ctx context.Context, in *product.CreateCategoryReq) (*product.OKResp, error) {
|
||||||
l := productlogic.NewCreateCategoryLogic(ctx, s.svcCtx)
|
l := productlogic.NewCreateCategoryLogic(ctx, s.svcCtx)
|
||||||
return l.CreateCategory(in)
|
return l.CreateCategory(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ModifyCategory 修改 product 分類名稱
|
||||||
|
func (s *ProductServer) ModifyCategory(ctx context.Context, in *product.ModifyCategoryReq) (*product.OKResp, error) {
|
||||||
|
l := productlogic.NewModifyCategoryLogic(ctx, s.svcCtx)
|
||||||
|
return l.ModifyCategory(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteCategory 刪除 product 分類
|
||||||
|
func (s *ProductServer) DeleteCategory(ctx context.Context, in *product.CategoryReq) (*product.OKResp, error) {
|
||||||
|
l := productlogic.NewDeleteCategoryLogic(ctx, s.svcCtx)
|
||||||
|
return l.DeleteCategory(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCategory 取得 product 分類
|
||||||
|
func (s *ProductServer) GetCategory(ctx context.Context, in *product.CategoryReq) (*product.Category, error) {
|
||||||
|
l := productlogic.NewGetCategoryLogic(ctx, s.svcCtx)
|
||||||
|
return l.GetCategory(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateCategory 建立 product 分類
|
||||||
|
func (s *ProductServer) ListCategory(ctx context.Context, in *product.ListCategoryReq) (*product.ListCategoryResp, error) {
|
||||||
|
l := productlogic.NewListCategoryLogic(ctx, s.svcCtx)
|
||||||
|
return l.ListCategory(in)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue