initial rewrite, use micro v4 and not cms-xxx stuff #4

Merged
vtolstov merged 24 commits from rewrite into master 2023-08-14 15:08:53 +03:00
4 changed files with 23 additions and 38 deletions
Showing only changes of commit dc0c660021 - Show all commits

View File

@ -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.31.0 // protoc-gen-go v1.26.0
// protoc v4.23.4 // protoc v4.23.4
// source: pkgdash.proto // source: pkgdash.proto
@ -1160,8 +1160,8 @@ var file_pkgdash_proto_rawDesc = []byte{
0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x45, 0xaa, 0x84, 0x9e, 0x03, 0x25,
0x2a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x17, 0x0a, 0x15, 0x2a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x17, 0x0a, 0x15,
0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x15, 0x22, 0x10, 0x2f, 0x76, 0x31,
0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x01, 0x2a,
0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d,
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73,
@ -1169,16 +1169,16 @@ var file_pkgdash_proto_rawDesc = []byte{
0x4e, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x4e, 0xaa, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65,
0x6e, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x6e, 0x74, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61,
0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x73, 0x68, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01,
0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x1e, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2f, 0x7b,
0x65, 0x2f, 0x7b, 0x70, 0x6b, 0x67, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x70, 0x6b, 0x67, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x3a, 0x01, 0x2a, 0x12,
0x7e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x7e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e,
0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e,
0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x40, 0xaa, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x73, 0x70, 0x22, 0x40, 0xaa,
0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x84, 0x9e, 0x03, 0x25, 0x2a, 0x0a, 0x41, 0x64, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,
0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x42, 0x17, 0x0a, 0x15, 0x12, 0x13, 0x0a, 0x11, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68,
0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x10, 0x3a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x73, 0x70, 0xb2, 0xea, 0xff, 0xf9, 0x01, 0x10, 0x22,
0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x3a, 0x01, 0x2a, 0x12,
0x76, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x76, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x70,
0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x6b, 0x67, 0x64, 0x61, 0x73, 0x68, 0x2e, 0x47, 0x65,

View File

@ -89,7 +89,6 @@ func (m *ErrorRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return ErrorRspMultiError(errors) return ErrorRspMultiError(errors)
} }
return nil return nil
} }
@ -195,7 +194,6 @@ func (m *Error) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return ErrorMultiError(errors) return ErrorMultiError(errors)
} }
return nil return nil
} }
@ -326,7 +324,6 @@ func (m *Package) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return PackageMultiError(errors) return PackageMultiError(errors)
} }
return nil return nil
} }
@ -479,7 +476,6 @@ func (m *Module) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return ModuleMultiError(errors) return ModuleMultiError(errors)
} }
return nil return nil
} }
@ -621,7 +617,6 @@ func (m *Issue) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return IssueMultiError(errors) return IssueMultiError(errors)
} }
return nil return nil
} }
@ -765,7 +760,6 @@ func (m *Comment) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return CommentMultiError(errors) return CommentMultiError(errors)
} }
return nil return nil
} }
@ -864,7 +858,6 @@ func (m *ListPackageReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return ListPackageReqMultiError(errors) return ListPackageReqMultiError(errors)
} }
return nil return nil
} }
@ -998,7 +991,6 @@ func (m *ListPackageRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return ListPackageRspMultiError(errors) return ListPackageRspMultiError(errors)
} }
return nil return nil
} }
@ -1131,7 +1123,6 @@ func (m *UpdatePackageReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return UpdatePackageReqMultiError(errors) return UpdatePackageReqMultiError(errors)
} }
return nil return nil
} }
@ -1242,7 +1233,6 @@ func (m *UpdatePackageRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return UpdatePackageRspMultiError(errors) return UpdatePackageRspMultiError(errors)
} }
return nil return nil
} }
@ -1355,7 +1345,6 @@ func (m *CommentReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return CommentReqMultiError(errors) return CommentReqMultiError(errors)
} }
return nil return nil
} }
@ -1467,7 +1456,6 @@ func (m *AddCommentReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return AddCommentReqMultiError(errors) return AddCommentReqMultiError(errors)
} }
return nil return nil
} }
@ -1578,7 +1566,6 @@ func (m *AddCommentRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return AddCommentRspMultiError(errors) return AddCommentRspMultiError(errors)
} }
return nil return nil
} }
@ -1700,7 +1687,6 @@ func (m *AddPackageReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return AddPackageReqMultiError(errors) return AddPackageReqMultiError(errors)
} }
return nil return nil
} }
@ -1811,7 +1797,6 @@ func (m *AddPackageRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return AddPackageRspMultiError(errors) return AddPackageRspMultiError(errors)
} }
return nil return nil
} }
@ -1911,7 +1896,6 @@ func (m *GetModuleReq) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return GetModuleReqMultiError(errors) return GetModuleReqMultiError(errors)
} }
return nil return nil
} }
@ -2044,7 +2028,6 @@ func (m *GetModuleRsp) validate(all bool) error {
if len(errors) > 0 { if len(errors) > 0 {
return GetModuleRspMultiError(errors) return GetModuleRspMultiError(errors)
} }
return nil return nil
} }

View File

@ -8,7 +8,8 @@ package pkgdashpb
import ( import (
context "context" context "context"
client "go.unistack.org/micro/v4/client" _ "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
) )
@ -17,11 +18,11 @@ var (
) )
type PkgdashServiceClient interface { type PkgdashServiceClient interface {
ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...options.Option) (*ListPackageRsp, error)
UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error)
AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error) AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error)
AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error) AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error)
GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error) GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error)
} }
type PkgdashServiceServer interface { type PkgdashServiceServer interface {

View File

@ -9,6 +9,7 @@ import (
v41 "go.unistack.org/micro-client-http/v4" v41 "go.unistack.org/micro-client-http/v4"
v4 "go.unistack.org/micro-server-http/v4" v4 "go.unistack.org/micro-server-http/v4"
client "go.unistack.org/micro/v4/client" client "go.unistack.org/micro/v4/client"
options "go.unistack.org/micro/v4/options"
server "go.unistack.org/micro/v4/server" server "go.unistack.org/micro/v4/server"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
http "net/http" http "net/http"
@ -63,7 +64,7 @@ func NewPkgdashServiceClient(name string, c client.Client) PkgdashServiceClient
return &pkgdashServiceClient{c: c, name: name} return &pkgdashServiceClient{c: c, name: name}
} }
func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...client.CallOption) (*ListPackageRsp, error) { func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Empty, opts ...options.Option) (*ListPackageRsp, error) {
errmap := make(map[string]interface{}, 1) errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{} errmap["default"] = &ErrorRsp{}
opts = append(opts, opts = append(opts,
@ -81,7 +82,7 @@ func (c *pkgdashServiceClient) ListPackage(ctx context.Context, req *emptypb.Emp
return rsp, nil return rsp, nil
} }
func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...client.CallOption) (*UpdatePackageRsp, error) { func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePackageReq, opts ...options.Option) (*UpdatePackageRsp, error) {
errmap := make(map[string]interface{}, 1) errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{} errmap["default"] = &ErrorRsp{}
opts = append(opts, opts = append(opts,
@ -100,7 +101,7 @@ func (c *pkgdashServiceClient) UpdatePackage(ctx context.Context, req *UpdatePac
return rsp, nil return rsp, nil
} }
func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...client.CallOption) (*AddCommentRsp, error) { func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentReq, opts ...options.Option) (*AddCommentRsp, error) {
errmap := make(map[string]interface{}, 1) errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{} errmap["default"] = &ErrorRsp{}
opts = append(opts, opts = append(opts,
@ -119,7 +120,7 @@ func (c *pkgdashServiceClient) AddComment(ctx context.Context, req *AddCommentRe
return rsp, nil return rsp, nil
} }
func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...client.CallOption) (*AddPackageRsp, error) { func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageReq, opts ...options.Option) (*AddPackageRsp, error) {
errmap := make(map[string]interface{}, 1) errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{} errmap["default"] = &ErrorRsp{}
opts = append(opts, opts = append(opts,
@ -138,7 +139,7 @@ func (c *pkgdashServiceClient) AddPackage(ctx context.Context, req *AddPackageRe
return rsp, nil return rsp, nil
} }
func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...client.CallOption) (*GetModuleRsp, error) { func (c *pkgdashServiceClient) GetModule(ctx context.Context, req *GetModuleReq, opts ...options.Option) (*GetModuleRsp, error) {
errmap := make(map[string]interface{}, 1) errmap := make(map[string]interface{}, 1)
errmap["default"] = &ErrorRsp{} errmap["default"] = &ErrorRsp{}
opts = append(opts, opts = append(opts,
@ -180,7 +181,7 @@ func (h *pkgdashServiceServer) GetModule(ctx context.Context, req *GetModuleReq,
return h.PkgdashServiceServer.GetModule(ctx, req, rsp) return h.PkgdashServiceServer.GetModule(ctx, req, rsp)
} }
func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...server.HandlerOption) error { func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts ...options.Option) error {
type pkgdashService interface { type pkgdashService interface {
ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error ListPackage(ctx context.Context, req *emptypb.Empty, rsp *ListPackageRsp) error
UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error UpdatePackage(ctx context.Context, req *UpdatePackageReq, rsp *UpdatePackageRsp) error
@ -192,7 +193,7 @@ func RegisterPkgdashServiceServer(s server.Server, sh PkgdashServiceServer, opts
pkgdashService pkgdashService
} }
h := &pkgdashServiceServer{sh} h := &pkgdashServiceServer{sh}
var nopts []server.HandlerOption var nopts []options.Option
nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints)) nopts = append(nopts, v4.HandlerEndpoints(PkgdashServiceServerEndpoints))
return s.Handle(s.NewHandler(&PkgdashService{h}, append(nopts, opts...)...)) return s.Handle(&PkgdashService{h}, append(nopts, opts...)...)
} }