Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
colorway
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
golang
colorway
Commits
f24a7fa1
Commit
f24a7fa1
authored
Jun 30, 2025
by
zhengyaoqiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(database): 核心表
parent
eae0a50b
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
650 additions
and
37 deletions
+650
-37
go.mod
go.mod
+2
-2
go.sum
go.sum
+4
-4
manager.go
internal/pkg/database/manager.go
+14
-0
category.go
internal/pkg/database/model/category.go
+12
-0
colorspu.go
internal/pkg/database/model/colorspu.go
+14
-3
completespu.go
internal/pkg/database/model/completespu.go
+23
-3
composition.go
internal/pkg/database/model/composition.go
+13
-0
fit.go
internal/pkg/database/model/fit.go
+11
-0
gender.go
internal/pkg/database/model/gender.go
+11
-0
image.go
internal/pkg/database/model/image.go
+12
-0
model.go
internal/pkg/database/model/model.go
+11
-0
product.go
internal/pkg/database/model/product.go
+11
-0
sku.go
internal/pkg/database/model/sku.go
+9
-9
category.go
internal/pkg/database/repository/category.go
+20
-0
composition.go
internal/pkg/database/repository/composition.go
+20
-0
fit.go
internal/pkg/database/repository/fit.go
+20
-0
gender.go
internal/pkg/database/repository/gender.go
+20
-0
image.go
internal/pkg/database/repository/image.go
+20
-0
model.go
internal/pkg/database/repository/model.go
+20
-0
product.go
internal/pkg/database/repository/product.go
+20
-0
colorway.go
internal/rpc/client/colorway/colorway.go
+4
-2
product.go
internal/rpc/client/product/product.go
+39
-0
colorway.go
internal/rpc/colorway.go
+2
-0
colorway.proto
internal/rpc/colorway.proto
+12
-0
uploadlogic.go
internal/rpc/internal/logic/product/uploadlogic.go
+38
-0
productserver.go
internal/rpc/internal/server/product/productserver.go
+28
-0
servicecontext.go
internal/rpc/internal/svc/servicecontext.go
+12
-0
colorway.pb.go
internal/rpc/pb/colorway/colorway.pb.go
+138
-14
colorway_grpc.pb.go
internal/rpc/pb/colorway/colorway_grpc.pb.go
+90
-0
No files found.
go.mod
View file @
f24a7fa1
...
@@ -4,7 +4,7 @@ go 1.24.3
...
@@ -4,7 +4,7 @@ go 1.24.3
require (
require (
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce
git
hub.com/iancoleman/strcase v0.3.0
git
.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250630014959-9d2b4facb28b
github.com/zeromicro/go-zero v1.8.4
github.com/zeromicro/go-zero v1.8.4
google.golang.org/grpc v1.73.0
google.golang.org/grpc v1.73.0
google.golang.org/protobuf v1.36.6
google.golang.org/protobuf v1.36.6
...
@@ -43,7 +43,7 @@ require (
...
@@ -43,7 +43,7 @@ require (
github.com/jinzhu/now v1.1.5 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.1
7.11
// indirect
github.com/klauspost/compress v1.1
8.0
// indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
...
...
go.sum
View file @
f24a7fa1
...
@@ -2,6 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
...
@@ -2,6 +2,8 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce h1:JBhBnnNR7DCqi67fxfLC7ZIJJXJP4jMTtP8DeW9XcJQ=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce h1:JBhBnnNR7DCqi67fxfLC7ZIJJXJP4jMTtP8DeW9XcJQ=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce/go.mod h1:1N8ux+rPaW+/OT74EGSz2oX51NvsEK3H4nlBZ+5Xx0M=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250627035541-7956996f27ce/go.mod h1:1N8ux+rPaW+/OT74EGSz2oX51NvsEK3H4nlBZ+5Xx0M=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250630014959-9d2b4facb28b h1:Lr5xxH47rdzrsMiClgZ5UH51RLMp/It08GSA+gfIsxg=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250630014959-9d2b4facb28b/go.mod h1:+oGrruo/MyXkrh5VPjDu/jvHN7tZGNkdZiKMJ/gIi4c=
github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
...
@@ -75,8 +77,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1
...
@@ -75,8 +77,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
...
@@ -87,8 +87,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
...
@@ -87,8 +87,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.1
7.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc
=
github.com/klauspost/compress v1.1
8.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo
=
github.com/klauspost/compress v1.1
7.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0
=
github.com/klauspost/compress v1.1
8.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ
=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
...
...
internal/pkg/database/manager.go
View file @
f24a7fa1
...
@@ -12,6 +12,13 @@ type Manager struct {
...
@@ -12,6 +12,13 @@ type Manager struct {
CompleteSpuRepository
repository
.
CompleteSpuInterface
CompleteSpuRepository
repository
.
CompleteSpuInterface
ColorSpuRepository
repository
.
ColorSpuInterface
ColorSpuRepository
repository
.
ColorSpuInterface
SkuRepository
repository
.
SkuInterface
SkuRepository
repository
.
SkuInterface
CategoryRepository
repository
.
CategoryInterface
CompositionRepository
repository
.
CompositionInterface
FitRepository
repository
.
FitInterface
GenderRepository
repository
.
GenderInterface
ImageRepository
repository
.
ImageInterface
ModelRepository
repository
.
ModelInterface
ProductRepository
repository
.
ProductInterface
}
}
func
(
receiver
*
Manager
)
init
()
error
{
func
(
receiver
*
Manager
)
init
()
error
{
...
@@ -58,6 +65,13 @@ func NewManager(dsn string) (*Manager, error) {
...
@@ -58,6 +65,13 @@ func NewManager(dsn string) (*Manager, error) {
CompleteSpuRepository
:
repository
.
NewCompleteSpu
(
db
),
CompleteSpuRepository
:
repository
.
NewCompleteSpu
(
db
),
ColorSpuRepository
:
repository
.
NewColorSpu
(
db
),
ColorSpuRepository
:
repository
.
NewColorSpu
(
db
),
SkuRepository
:
repository
.
NewSku
(
db
),
SkuRepository
:
repository
.
NewSku
(
db
),
CategoryRepository
:
repository
.
NewCategory
(
db
),
CompositionRepository
:
repository
.
NewComposition
(
db
),
FitRepository
:
repository
.
NewFit
(
db
),
GenderRepository
:
repository
.
NewGender
(
db
),
ImageRepository
:
repository
.
NewImage
(
db
),
ModelRepository
:
repository
.
NewModel
(
db
),
ProductRepository
:
repository
.
NewProduct
(
db
),
}
}
err
=
manager
.
init
()
err
=
manager
.
init
()
return
manager
,
err
return
manager
,
err
...
...
internal/pkg/database/model/category.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Category
struct
{
gorm
.
Model
Code
string
`gorm:"uniqueIndex; size:50"`
Name
string
`gorm:"size:50"`
Level
int
`gorm:"not null"`
}
type
Categories
[]
Category
internal/pkg/database/model/colorspu.go
View file @
f24a7fa1
...
@@ -4,10 +4,21 @@ import "gorm.io/gorm"
...
@@ -4,10 +4,21 @@ import "gorm.io/gorm"
type
ColorSpu
struct
{
type
ColorSpu
struct
{
gorm
.
Model
gorm
.
Model
StyleNumber
string
`gorm:"uniqueIndex:style; size:50; not null"`
CompleteSpuStyleNumber
string
`gorm:"uniqueIndex:style; size:50; not null"`
ColorCode
string
`gorm:"uniqueIndex:style; size:50; not null"`
ColorCode
string
`gorm:"uniqueIndex:style; size:50; not null"`
Color
Color
`gorm:"embedded;embeddedPrefix:color_"`
// 外键
// 外键
Skus
Skus
`gorm:"foreignKey:StyleNumber,ColorCode; references:StyleNumber,ColorCode; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
// 多对一
Skus
[]
Sku
`gorm:"foreignKey:ColorSpuStyleNumber,ColorSpuColorCode; references:CompleteSpuStyleNumber,ColorCode; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Images
[]
Image
`gorm:"foreignKey:ColorSpuStyleNumber,ColorSpuColorCode; references:CompleteSpuStyleNumber,ColorCode; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
}
type
ColorSpus
[]
ColorSpu
type
ColorSpus
[]
ColorSpu
type
Color
struct
{
Id
string
`gorm:"size:50; not null"`
Name
string
`gorm:"size:50; not null"`
BasicId
string
`gorm:"size:50; not null"`
BasicName
string
`gorm:"size:50; not null"`
}
internal/pkg/database/model/completespu.go
View file @
f24a7fa1
...
@@ -5,10 +5,30 @@ import "gorm.io/gorm"
...
@@ -5,10 +5,30 @@ import "gorm.io/gorm"
type
CompleteSpu
struct
{
type
CompleteSpu
struct
{
gorm
.
Model
gorm
.
Model
StyleNumber
string
`gorm:"uniqueIndex; size:50; not null"`
StyleNumber
string
`gorm:"uniqueIndex; size:50; not null"`
Title
string
`gorm:"size:100
"`
Title
Title
`gorm:"embedded;embeddedPrefix:title_
"`
Description
string
`gorm:"type:text"`
Description
string
`gorm:"type:text"`
Gender
string
`gorm:"size:20; not null"`
Season
string
`gorm:"size:20"`
Season
string
`gorm:"size:20"`
BrandId
string
`gorm:"size:50"`
Care
string
`gorm:"type:text"`
MadeIn
string
`gorm:"size:50"`
HsCode
string
`gorm:"size:50"`
// 外键
// 外键
ColorSpus
ColorSpus
`gorm:"foreignKey:StyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
// 多对一
ColorSpus
ColorSpus
`gorm:"foreignKey:CompleteSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Products
Products
`gorm:"foreignKey:CompleteSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Compositions
Compositions
`gorm:"foreignKey:CompleteSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Skus
Skus
`gorm:"foreignKey:ColorSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Models
Models
`gorm:"foreignKey:CompleteSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Fits
Fits
`gorm:"foreignKey:CompleteSpuStyleNumber; references:StyleNumber; constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
// 多对多
Genders
Genders
`gorm:"many2many:completespu_genders;foreignKey:StyleNumber; References:Code;"`
Categories
Categories
`gorm:"many2many:completespu_categories;foreignKey:StyleNumber; References:Code;"`
}
type
CompleteSpus
[]
CompleteSpu
type
Title
struct
{
En
string
`gorm:"size:100"`
Cn
string
`gorm:"size:100"`
}
}
internal/pkg/database/model/composition.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Composition
struct
{
gorm
.
Model
CompleteSpuStyleNumber
string
`gorm:"index; size:50; not null"`
Part
string
`gorm:"size:50"`
Material
string
`gorm:"size:50"`
Value
string
`gorm:"size:50"`
}
type
Compositions
[]
Composition
internal/pkg/database/model/fit.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Fit
struct
{
gorm
.
Model
CompleteSpuStyleNumber
string
`gorm:"index; size:50; not null"`
Content
string
`gorm:"type:text"`
}
type
Fits
[]
Fit
internal/pkg/database/model/gender.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Gender
struct
{
gorm
.
Model
Code
string
`gorm:"uniqueIndex; size:20; not null"`
Name
string
`gorm:"size:20; not null"`
}
type
Genders
[]
Gender
internal/pkg/database/model/image.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Image
struct
{
gorm
.
Model
ColorSpuStyleNumber
string
`gorm:"index:style; size:50; not null"`
ColorSpuColorCode
string
`gorm:"index:style; size:50; not null"`
Url
string
`gorm:"size:256"`
}
type
Images
[]
Image
internal/pkg/database/model/model.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Model
struct
{
gorm
.
Model
CompleteSpuStyleNumber
string
`gorm:"index; size:50; not null"`
Content
string
`gorm:"type:text"`
}
type
Models
[]
Model
internal/pkg/database/model/product.go
0 → 100644
View file @
f24a7fa1
package
model
import
"gorm.io/gorm"
type
Product
struct
{
gorm
.
Model
Pc3IdHex
string
`gorm:"uniqueIndex; not null; size:24"`
CompleteSpuStyleNumber
string
`gorm:"index; size:50; not null"`
}
type
Products
[]
Product
internal/pkg/database/model/sku.go
View file @
f24a7fa1
...
@@ -4,15 +4,15 @@ import "gorm.io/gorm"
...
@@ -4,15 +4,15 @@ import "gorm.io/gorm"
type
Sku
struct
{
type
Sku
struct
{
gorm
.
Model
gorm
.
Model
Pc3SkuId
string
`gorm:"uniqueIndex; not null; size:24"`
Pc3SkuId
string
`gorm:"uniqueIndex; not null; size:24"`
StyleNumber
string
`gorm:"size:50; not null"`
ColorSpu
StyleNumber
string
`gorm:"size:50; not null"`
ColorCode
string
`gorm:"size:50; not null"`
Color
SpuColor
Code
string
`gorm:"size:50; not null"`
Source
string
`gorm:"size:50; not null"`
Source
string
`gorm:"size:50; not null"`
Site
string
`gorm:"size:50; not null"`
Site
string
`gorm:"size:50; not null"`
Size
string
`gorm:"size:50; not null"`
Size
string
`gorm:"size:50; not null"`
Stock
int
`gorm:"not null"`
Stock
int
`gorm:"not null"`
Price
float64
`gorm:"type:decimal(10,2); not null"`
Price
float64
`gorm:"type:decimal(10,2); not null"`
Currency
string
`gorm:"size:50; not null"`
Currency
string
`gorm:"size:50; not null"`
}
}
type
Skus
[]
Sku
type
Skus
[]
Sku
internal/pkg/database/repository/category.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
CategoryInterface
interface
{
BaseInterface
}
type
Category
struct
{
*
Base
[
model
.
Category
]
}
func
NewCategory
(
db
*
gorm
.
DB
)
*
Category
{
return
&
Category
{
Base
:
NewBase
[
model
.
Category
](
db
),
}
}
internal/pkg/database/repository/composition.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
CompositionInterface
interface
{
BaseInterface
}
type
Composition
struct
{
*
Base
[
model
.
Composition
]
}
func
NewComposition
(
db
*
gorm
.
DB
)
*
Composition
{
return
&
Composition
{
Base
:
NewBase
[
model
.
Composition
](
db
),
}
}
internal/pkg/database/repository/fit.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
FitInterface
interface
{
BaseInterface
}
type
Fit
struct
{
*
Base
[
model
.
Fit
]
}
func
NewFit
(
db
*
gorm
.
DB
)
*
Fit
{
return
&
Fit
{
Base
:
NewBase
[
model
.
Fit
](
db
),
}
}
internal/pkg/database/repository/gender.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
GenderInterface
interface
{
BaseInterface
}
type
Gender
struct
{
*
Base
[
model
.
Gender
]
}
func
NewGender
(
db
*
gorm
.
DB
)
*
Gender
{
return
&
Gender
{
Base
:
NewBase
[
model
.
Gender
](
db
),
}
}
internal/pkg/database/repository/image.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
ImageInterface
interface
{
BaseInterface
}
type
Image
struct
{
*
Base
[
model
.
Image
]
}
func
NewImage
(
db
*
gorm
.
DB
)
*
Image
{
return
&
Image
{
Base
:
NewBase
[
model
.
Image
](
db
),
}
}
internal/pkg/database/repository/model.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
ModelInterface
interface
{
BaseInterface
}
type
Model
struct
{
*
Base
[
model
.
Model
]
}
func
NewModel
(
db
*
gorm
.
DB
)
*
Model
{
return
&
Model
{
Base
:
NewBase
[
model
.
Model
](
db
),
}
}
internal/pkg/database/repository/product.go
0 → 100644
View file @
f24a7fa1
package
repository
import
(
"git.chillcy.com/golang/colorway/internal/pkg/database/model"
"gorm.io/gorm"
)
type
ProductInterface
interface
{
BaseInterface
}
type
Product
struct
{
*
Base
[
model
.
Product
]
}
func
NewProduct
(
db
*
gorm
.
DB
)
*
Product
{
return
&
Product
{
Base
:
NewBase
[
model
.
Product
](
db
),
}
}
internal/rpc/client/colorway/colorway.go
View file @
f24a7fa1
...
@@ -13,8 +13,10 @@ import (
...
@@ -13,8 +13,10 @@ import (
)
)
type
(
type
(
Request
=
colorway
.
Request
ProductUploadRequest
=
colorway
.
ProductUploadRequest
Response
=
colorway
.
Response
ProductUploadResponse
=
colorway
.
ProductUploadResponse
Request
=
colorway
.
Request
Response
=
colorway
.
Response
Colorway
interface
{
Colorway
interface
{
Ping
(
ctx
context
.
Context
,
in
*
Request
,
opts
...
grpc
.
CallOption
)
(
*
Response
,
error
)
Ping
(
ctx
context
.
Context
,
in
*
Request
,
opts
...
grpc
.
CallOption
)
(
*
Response
,
error
)
...
...
internal/rpc/client/product/product.go
0 → 100644
View file @
f24a7fa1
// Code generated by goctl. DO NOT EDIT.
// Source: colorway.proto
package
product
import
(
"context"
"git.chillcy.com/golang/colorway/internal/rpc/pb/colorway"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type
(
ProductUploadRequest
=
colorway
.
ProductUploadRequest
ProductUploadResponse
=
colorway
.
ProductUploadResponse
Request
=
colorway
.
Request
Response
=
colorway
.
Response
Product
interface
{
Upload
(
ctx
context
.
Context
,
in
*
ProductUploadRequest
,
opts
...
grpc
.
CallOption
)
(
*
ProductUploadResponse
,
error
)
}
defaultProduct
struct
{
cli
zrpc
.
Client
}
)
func
NewProduct
(
cli
zrpc
.
Client
)
Product
{
return
&
defaultProduct
{
cli
:
cli
,
}
}
func
(
m
*
defaultProduct
)
Upload
(
ctx
context
.
Context
,
in
*
ProductUploadRequest
,
opts
...
grpc
.
CallOption
)
(
*
ProductUploadResponse
,
error
)
{
client
:=
colorway
.
NewProductClient
(
m
.
cli
.
Conn
())
return
client
.
Upload
(
ctx
,
in
,
opts
...
)
}
internal/rpc/colorway.go
View file @
f24a7fa1
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"git.chillcy.com/golang/colorway/internal/rpc/internal/config"
"git.chillcy.com/golang/colorway/internal/rpc/internal/config"
colorwayServer
"git.chillcy.com/golang/colorway/internal/rpc/internal/server/colorway"
colorwayServer
"git.chillcy.com/golang/colorway/internal/rpc/internal/server/colorway"
productServer
"git.chillcy.com/golang/colorway/internal/rpc/internal/server/product"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc"
"git.chillcy.com/golang/colorway/internal/rpc/pb/colorway"
"git.chillcy.com/golang/colorway/internal/rpc/pb/colorway"
...
@@ -27,6 +28,7 @@ func main() {
...
@@ -27,6 +28,7 @@ func main() {
s
:=
zrpc
.
MustNewServer
(
c
.
RpcServerConf
,
func
(
grpcServer
*
grpc
.
Server
)
{
s
:=
zrpc
.
MustNewServer
(
c
.
RpcServerConf
,
func
(
grpcServer
*
grpc
.
Server
)
{
colorway
.
RegisterColorwayServer
(
grpcServer
,
colorwayServer
.
NewColorwayServer
(
ctx
))
colorway
.
RegisterColorwayServer
(
grpcServer
,
colorwayServer
.
NewColorwayServer
(
ctx
))
colorway
.
RegisterProductServer
(
grpcServer
,
productServer
.
NewProductServer
(
ctx
))
if
c
.
Mode
==
service
.
DevMode
||
c
.
Mode
==
service
.
TestMode
{
if
c
.
Mode
==
service
.
DevMode
||
c
.
Mode
==
service
.
TestMode
{
reflection
.
Register
(
grpcServer
)
reflection
.
Register
(
grpcServer
)
...
...
internal/rpc/colorway.proto
View file @
f24a7fa1
...
@@ -3,6 +3,8 @@ syntax = "proto3";
...
@@ -3,6 +3,8 @@ syntax = "proto3";
package
colorway
;
package
colorway
;
option
go_package
=
"./colorway"
;
option
go_package
=
"./colorway"
;
// ============================================================
message
Request
{
message
Request
{
string
ping
=
1
;
string
ping
=
1
;
}
}
...
@@ -14,3 +16,13 @@ message Response {
...
@@ -14,3 +16,13 @@ message Response {
service
Colorway
{
service
Colorway
{
rpc
Ping
(
Request
)
returns
(
Response
);
rpc
Ping
(
Request
)
returns
(
Response
);
}
}
message
ProductUploadRequest
{
repeated
string
style_numbers
=
1
;
}
message
ProductUploadResponse
{}
service
Product
{
rpc
Upload
(
ProductUploadRequest
)
returns
(
ProductUploadResponse
);
}
internal/rpc/internal/logic/product/uploadlogic.go
0 → 100644
View file @
f24a7fa1
package
productlogic
import
(
"context"
"git.chillcy.com/golang/chillcy/project/pc4/pkg/rpc/client/product"
"log"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc"
"git.chillcy.com/golang/colorway/internal/rpc/pb/colorway"
"github.com/zeromicro/go-zero/core/logx"
)
type
UploadLogic
struct
{
ctx
context
.
Context
svcCtx
*
svc
.
ServiceContext
logx
.
Logger
}
func
NewUploadLogic
(
ctx
context
.
Context
,
svcCtx
*
svc
.
ServiceContext
)
*
UploadLogic
{
return
&
UploadLogic
{
ctx
:
ctx
,
svcCtx
:
svcCtx
,
Logger
:
logx
.
WithContext
(
ctx
),
}
}
func
(
l
*
UploadLogic
)
Upload
(
in
*
colorway
.
ProductUploadRequest
)
(
*
colorway
.
ProductUploadResponse
,
error
)
{
productList
,
err
:=
l
.
svcCtx
.
Pc4RpcService
.
Product
.
GetListByDesignerIds
(
l
.
ctx
,
&
product
.
ProductGetListByDesignerIdsRequest
{
DesignerIds
:
in
.
GetStyleNumbers
(),
})
if
err
!=
nil
{
return
nil
,
err
}
log
.
Println
(
productList
)
return
&
colorway
.
ProductUploadResponse
{},
nil
}
internal/rpc/internal/server/product/productserver.go
0 → 100644
View file @
f24a7fa1
// Code generated by goctl. DO NOT EDIT.
// Source: colorway.proto
package
server
import
(
"context"
"git.chillcy.com/golang/colorway/internal/rpc/internal/logic/product"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc"
"git.chillcy.com/golang/colorway/internal/rpc/pb/colorway"
)
type
ProductServer
struct
{
svcCtx
*
svc
.
ServiceContext
colorway
.
UnimplementedProductServer
}
func
NewProductServer
(
svcCtx
*
svc
.
ServiceContext
)
*
ProductServer
{
return
&
ProductServer
{
svcCtx
:
svcCtx
,
}
}
func
(
s
*
ProductServer
)
Upload
(
ctx
context
.
Context
,
in
*
colorway
.
ProductUploadRequest
)
(
*
colorway
.
ProductUploadResponse
,
error
)
{
l
:=
productlogic
.
NewUploadLogic
(
ctx
,
s
.
svcCtx
)
return
l
.
Upload
(
in
)
}
internal/rpc/internal/svc/servicecontext.go
View file @
f24a7fa1
...
@@ -2,13 +2,16 @@ package svc
...
@@ -2,13 +2,16 @@ package svc
import
(
import
(
"git.chillcy.com/golang/chillcy/pkg/etcd"
"git.chillcy.com/golang/chillcy/pkg/etcd"
"git.chillcy.com/golang/chillcy/project/pc4/pkg/rpc/client/product"
"git.chillcy.com/golang/colorway/internal/pkg/database"
"git.chillcy.com/golang/colorway/internal/pkg/database"
"git.chillcy.com/golang/colorway/internal/rpc/internal/config"
"git.chillcy.com/golang/colorway/internal/rpc/internal/config"
"github.com/zeromicro/go-zero/zrpc"
)
)
type
ServiceContext
struct
{
type
ServiceContext
struct
{
Config
config
.
Config
Config
config
.
Config
DatabaseManager
*
database
.
Manager
DatabaseManager
*
database
.
Manager
Pc4RpcService
Pc4RpcService
}
}
func
NewServiceContext
(
c
config
.
Config
)
*
ServiceContext
{
func
NewServiceContext
(
c
config
.
Config
)
*
ServiceContext
{
...
@@ -19,8 +22,17 @@ func NewServiceContext(c config.Config) *ServiceContext {
...
@@ -19,8 +22,17 @@ func NewServiceContext(c config.Config) *ServiceContext {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
// todo etcd config
pc4RpcProductServiceTarget
:=
"127.0.0.1:5100"
return
&
ServiceContext
{
return
&
ServiceContext
{
Config
:
c
,
Config
:
c
,
DatabaseManager
:
manager
,
DatabaseManager
:
manager
,
Pc4RpcService
:
Pc4RpcService
{
Product
:
product
.
NewProduct
(
zrpc
.
MustNewClient
(
zrpc
.
RpcClientConf
{
Target
:
pc4RpcProductServiceTarget
})),
},
}
}
}
}
type
Pc4RpcService
struct
{
Product
product
.
Product
}
internal/rpc/pb/colorway/colorway.pb.go
View file @
f24a7fa1
...
@@ -114,6 +114,91 @@ func (x *Response) GetPong() string {
...
@@ -114,6 +114,91 @@ func (x *Response) GetPong() string {
return
""
return
""
}
}
type
ProductUploadRequest
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
StyleNumbers
[]
string
`protobuf:"bytes,1,rep,name=style_numbers,json=styleNumbers,proto3" json:"style_numbers,omitempty"`
}
func
(
x
*
ProductUploadRequest
)
Reset
()
{
*
x
=
ProductUploadRequest
{}
if
protoimpl
.
UnsafeEnabled
{
mi
:=
&
file_colorway_proto_msgTypes
[
2
]
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
ms
.
StoreMessageInfo
(
mi
)
}
}
func
(
x
*
ProductUploadRequest
)
String
()
string
{
return
protoimpl
.
X
.
MessageStringOf
(
x
)
}
func
(
*
ProductUploadRequest
)
ProtoMessage
()
{}
func
(
x
*
ProductUploadRequest
)
ProtoReflect
()
protoreflect
.
Message
{
mi
:=
&
file_colorway_proto_msgTypes
[
2
]
if
protoimpl
.
UnsafeEnabled
&&
x
!=
nil
{
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
if
ms
.
LoadMessageInfo
()
==
nil
{
ms
.
StoreMessageInfo
(
mi
)
}
return
ms
}
return
mi
.
MessageOf
(
x
)
}
// Deprecated: Use ProductUploadRequest.ProtoReflect.Descriptor instead.
func
(
*
ProductUploadRequest
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_colorway_proto_rawDescGZIP
(),
[]
int
{
2
}
}
func
(
x
*
ProductUploadRequest
)
GetStyleNumbers
()
[]
string
{
if
x
!=
nil
{
return
x
.
StyleNumbers
}
return
nil
}
type
ProductUploadResponse
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
}
func
(
x
*
ProductUploadResponse
)
Reset
()
{
*
x
=
ProductUploadResponse
{}
if
protoimpl
.
UnsafeEnabled
{
mi
:=
&
file_colorway_proto_msgTypes
[
3
]
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
ms
.
StoreMessageInfo
(
mi
)
}
}
func
(
x
*
ProductUploadResponse
)
String
()
string
{
return
protoimpl
.
X
.
MessageStringOf
(
x
)
}
func
(
*
ProductUploadResponse
)
ProtoMessage
()
{}
func
(
x
*
ProductUploadResponse
)
ProtoReflect
()
protoreflect
.
Message
{
mi
:=
&
file_colorway_proto_msgTypes
[
3
]
if
protoimpl
.
UnsafeEnabled
&&
x
!=
nil
{
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
if
ms
.
LoadMessageInfo
()
==
nil
{
ms
.
StoreMessageInfo
(
mi
)
}
return
ms
}
return
mi
.
MessageOf
(
x
)
}
// Deprecated: Use ProductUploadResponse.ProtoReflect.Descriptor instead.
func
(
*
ProductUploadResponse
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_colorway_proto_rawDescGZIP
(),
[]
int
{
3
}
}
var
File_colorway_proto
protoreflect
.
FileDescriptor
var
File_colorway_proto
protoreflect
.
FileDescriptor
var
file_colorway_proto_rawDesc
=
[]
byte
{
var
file_colorway_proto_rawDesc
=
[]
byte
{
...
@@ -122,12 +207,23 @@ var file_colorway_proto_rawDesc = []byte{
...
@@ -122,12 +207,23 @@ var file_colorway_proto_rawDesc = []byte{
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x70
,
0x69
,
0x6e
,
0x67
,
0x18
,
0x01
,
0x20
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x70
,
0x69
,
0x6e
,
0x67
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x70
,
0x69
,
0x6e
,
0x67
,
0x22
,
0x1e
,
0x0a
,
0x08
,
0x52
,
0x65
,
0x73
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x70
,
0x69
,
0x6e
,
0x67
,
0x22
,
0x1e
,
0x0a
,
0x08
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x70
,
0x6f
,
0x6e
,
0x67
,
0x18
,
0x01
,
0x20
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x70
,
0x6f
,
0x6e
,
0x67
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x70
,
0x6f
,
0x6e
,
0x67
,
0x32
,
0x39
,
0x0a
,
0x08
,
0x43
,
0x6f
,
0x6c
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x70
,
0x6f
,
0x6e
,
0x67
,
0x22
,
0x3b
,
0x0a
,
0x14
,
0x50
,
0x72
,
0x6f
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x12
,
0x2d
,
0x0a
,
0x04
,
0x50
,
0x69
,
0x6e
,
0x67
,
0x12
,
0x11
,
0x2e
,
0x64
,
0x75
,
0x63
,
0x74
,
0x55
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x74
,
0x12
,
0x23
,
0x0a
,
0x0d
,
0x73
,
0x74
,
0x79
,
0x6c
,
0x65
,
0x5f
,
0x6e
,
0x75
,
0x6d
,
0x62
,
0x65
,
0x1a
,
0x12
,
0x2e
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x52
,
0x65
,
0x73
,
0x70
,
0x72
,
0x73
,
0x18
,
0x01
,
0x20
,
0x03
,
0x28
,
0x09
,
0x52
,
0x0c
,
0x73
,
0x74
,
0x79
,
0x6c
,
0x65
,
0x4e
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x42
,
0x0c
,
0x5a
,
0x0a
,
0x2e
,
0x2f
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x75
,
0x6d
,
0x62
,
0x65
,
0x72
,
0x73
,
0x22
,
0x17
,
0x0a
,
0x15
,
0x50
,
0x72
,
0x6f
,
0x64
,
0x75
,
0x63
,
0x61
,
0x79
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
0x74
,
0x55
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x32
,
0x39
,
0x0a
,
0x08
,
0x43
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x12
,
0x2d
,
0x0a
,
0x04
,
0x50
,
0x69
,
0x6e
,
0x67
,
0x12
,
0x11
,
0x2e
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x12
,
0x2e
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x32
,
0x54
,
0x0a
,
0x07
,
0x50
,
0x72
,
0x6f
,
0x64
,
0x75
,
0x63
,
0x74
,
0x12
,
0x49
,
0x0a
,
0x06
,
0x55
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x12
,
0x1e
,
0x2e
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x50
,
0x72
,
0x6f
,
0x64
,
0x75
,
0x63
,
0x74
,
0x55
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x1a
,
0x1f
,
0x2e
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x2e
,
0x50
,
0x72
,
0x6f
,
0x64
,
0x75
,
0x63
,
0x74
,
0x55
,
0x70
,
0x6c
,
0x6f
,
0x61
,
0x64
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x42
,
0x0c
,
0x5a
,
0x0a
,
0x2e
,
0x2f
,
0x63
,
0x6f
,
0x6c
,
0x6f
,
0x72
,
0x77
,
0x61
,
0x79
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
}
var
(
var
(
...
@@ -142,16 +238,20 @@ func file_colorway_proto_rawDescGZIP() []byte {
...
@@ -142,16 +238,20 @@ func file_colorway_proto_rawDescGZIP() []byte {
return
file_colorway_proto_rawDescData
return
file_colorway_proto_rawDescData
}
}
var
file_colorway_proto_msgTypes
=
make
([]
protoimpl
.
MessageInfo
,
2
)
var
file_colorway_proto_msgTypes
=
make
([]
protoimpl
.
MessageInfo
,
4
)
var
file_colorway_proto_goTypes
=
[]
interface
{}{
var
file_colorway_proto_goTypes
=
[]
interface
{}{
(
*
Request
)(
nil
),
// 0: colorway.Request
(
*
Request
)(
nil
),
// 0: colorway.Request
(
*
Response
)(
nil
),
// 1: colorway.Response
(
*
Response
)(
nil
),
// 1: colorway.Response
(
*
ProductUploadRequest
)(
nil
),
// 2: colorway.ProductUploadRequest
(
*
ProductUploadResponse
)(
nil
),
// 3: colorway.ProductUploadResponse
}
}
var
file_colorway_proto_depIdxs
=
[]
int32
{
var
file_colorway_proto_depIdxs
=
[]
int32
{
0
,
// 0: colorway.Colorway.Ping:input_type -> colorway.Request
0
,
// 0: colorway.Colorway.Ping:input_type -> colorway.Request
1
,
// 1: colorway.Colorway.Ping:output_type -> colorway.Response
2
,
// 1: colorway.Product.Upload:input_type -> colorway.ProductUploadRequest
1
,
// [1:2] is the sub-list for method output_type
1
,
// 2: colorway.Colorway.Ping:output_type -> colorway.Response
0
,
// [0:1] is the sub-list for method input_type
3
,
// 3: colorway.Product.Upload:output_type -> colorway.ProductUploadResponse
2
,
// [2:4] is the sub-list for method output_type
0
,
// [0:2] is the sub-list for method input_type
0
,
// [0:0] is the sub-list for extension type_name
0
,
// [0:0] is the sub-list for extension type_name
0
,
// [0:0] is the sub-list for extension extendee
0
,
// [0:0] is the sub-list for extension extendee
0
,
// [0:0] is the sub-list for field type_name
0
,
// [0:0] is the sub-list for field type_name
...
@@ -187,6 +287,30 @@ func file_colorway_proto_init() {
...
@@ -187,6 +287,30 @@ func file_colorway_proto_init() {
return
nil
return
nil
}
}
}
}
file_colorway_proto_msgTypes
[
2
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
ProductUploadRequest
);
i
{
case
0
:
return
&
v
.
state
case
1
:
return
&
v
.
sizeCache
case
2
:
return
&
v
.
unknownFields
default
:
return
nil
}
}
file_colorway_proto_msgTypes
[
3
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
ProductUploadResponse
);
i
{
case
0
:
return
&
v
.
state
case
1
:
return
&
v
.
sizeCache
case
2
:
return
&
v
.
unknownFields
default
:
return
nil
}
}
}
}
type
x
struct
{}
type
x
struct
{}
out
:=
protoimpl
.
TypeBuilder
{
out
:=
protoimpl
.
TypeBuilder
{
...
@@ -194,9 +318,9 @@ func file_colorway_proto_init() {
...
@@ -194,9 +318,9 @@ func file_colorway_proto_init() {
GoPackagePath
:
reflect
.
TypeOf
(
x
{})
.
PkgPath
(),
GoPackagePath
:
reflect
.
TypeOf
(
x
{})
.
PkgPath
(),
RawDescriptor
:
file_colorway_proto_rawDesc
,
RawDescriptor
:
file_colorway_proto_rawDesc
,
NumEnums
:
0
,
NumEnums
:
0
,
NumMessages
:
2
,
NumMessages
:
4
,
NumExtensions
:
0
,
NumExtensions
:
0
,
NumServices
:
1
,
NumServices
:
2
,
},
},
GoTypes
:
file_colorway_proto_goTypes
,
GoTypes
:
file_colorway_proto_goTypes
,
DependencyIndexes
:
file_colorway_proto_depIdxs
,
DependencyIndexes
:
file_colorway_proto_depIdxs
,
...
...
internal/rpc/pb/colorway/colorway_grpc.pb.go
View file @
f24a7fa1
...
@@ -107,3 +107,93 @@ var Colorway_ServiceDesc = grpc.ServiceDesc{
...
@@ -107,3 +107,93 @@ var Colorway_ServiceDesc = grpc.ServiceDesc{
Streams
:
[]
grpc
.
StreamDesc
{},
Streams
:
[]
grpc
.
StreamDesc
{},
Metadata
:
"colorway.proto"
,
Metadata
:
"colorway.proto"
,
}
}
const
(
Product_Upload_FullMethodName
=
"/colorway.Product/Upload"
)
// 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.
type
ProductClient
interface
{
Upload
(
ctx
context
.
Context
,
in
*
ProductUploadRequest
,
opts
...
grpc
.
CallOption
)
(
*
ProductUploadResponse
,
error
)
}
type
productClient
struct
{
cc
grpc
.
ClientConnInterface
}
func
NewProductClient
(
cc
grpc
.
ClientConnInterface
)
ProductClient
{
return
&
productClient
{
cc
}
}
func
(
c
*
productClient
)
Upload
(
ctx
context
.
Context
,
in
*
ProductUploadRequest
,
opts
...
grpc
.
CallOption
)
(
*
ProductUploadResponse
,
error
)
{
out
:=
new
(
ProductUploadResponse
)
err
:=
c
.
cc
.
Invoke
(
ctx
,
Product_Upload_FullMethodName
,
in
,
out
,
opts
...
)
if
err
!=
nil
{
return
nil
,
err
}
return
out
,
nil
}
// ProductServer is the server API for Product service.
// All implementations must embed UnimplementedProductServer
// for forward compatibility
type
ProductServer
interface
{
Upload
(
context
.
Context
,
*
ProductUploadRequest
)
(
*
ProductUploadResponse
,
error
)
mustEmbedUnimplementedProductServer
()
}
// UnimplementedProductServer must be embedded to have forward compatible implementations.
type
UnimplementedProductServer
struct
{
}
func
(
UnimplementedProductServer
)
Upload
(
context
.
Context
,
*
ProductUploadRequest
)
(
*
ProductUploadResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Upload not implemented"
)
}
func
(
UnimplementedProductServer
)
mustEmbedUnimplementedProductServer
()
{}
// UnsafeProductServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ProductServer will
// result in compilation errors.
type
UnsafeProductServer
interface
{
mustEmbedUnimplementedProductServer
()
}
func
RegisterProductServer
(
s
grpc
.
ServiceRegistrar
,
srv
ProductServer
)
{
s
.
RegisterService
(
&
Product_ServiceDesc
,
srv
)
}
func
_Product_Upload_Handler
(
srv
interface
{},
ctx
context
.
Context
,
dec
func
(
interface
{})
error
,
interceptor
grpc
.
UnaryServerInterceptor
)
(
interface
{},
error
)
{
in
:=
new
(
ProductUploadRequest
)
if
err
:=
dec
(
in
);
err
!=
nil
{
return
nil
,
err
}
if
interceptor
==
nil
{
return
srv
.
(
ProductServer
)
.
Upload
(
ctx
,
in
)
}
info
:=
&
grpc
.
UnaryServerInfo
{
Server
:
srv
,
FullMethod
:
Product_Upload_FullMethodName
,
}
handler
:=
func
(
ctx
context
.
Context
,
req
interface
{})
(
interface
{},
error
)
{
return
srv
.
(
ProductServer
)
.
Upload
(
ctx
,
req
.
(
*
ProductUploadRequest
))
}
return
interceptor
(
ctx
,
in
,
info
,
handler
)
}
// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var
Product_ServiceDesc
=
grpc
.
ServiceDesc
{
ServiceName
:
"colorway.Product"
,
HandlerType
:
(
*
ProductServer
)(
nil
),
Methods
:
[]
grpc
.
MethodDesc
{
{
MethodName
:
"Upload"
,
Handler
:
_Product_Upload_Handler
,
},
},
Streams
:
[]
grpc
.
StreamDesc
{},
Metadata
:
"colorway.proto"
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment