Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
feat: implement part of tag service (#2051)
boojack89ba2a65405c
diff --git a/api/v2/gw_mux.go b/api/v2/gw_mux.gonew file mode 100644index 000000000..e3b15c049--- /dev/null+++ b/api/v2/gw_mux.go@@ -0,0 +1,33 @@+package v2++import (+ "context"+ "fmt"++ grpcRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"+ "github.com/labstack/echo/v4"+ apiv2pb "github.com/usememos/memos/proto/gen/api/v2"+ "google.golang.org/grpc"+ "google.golang.org/grpc/credentials/insecure"+)++// RegisterGateway registers the gRPC-Gateway with the given Echo instance.+func RegisterGateway(ctx context.Context, e *echo.Echo, grpcServerPort int) {+ // Create a client connection to the gRPC Server we just started.+ // This is where the gRPC-Gateway proxies the requests.+ conn, err := grpc.DialContext(+ ctx,+ fmt.Sprintf(":%d", grpcServerPort),+ grpc.WithTransportCredentials(insecure.NewCredentials()),+ )+ if err != nil {+ panic(err)+ }++ gwMux := grpcRuntime.NewServeMux()+ err = apiv2pb.RegisterTagServiceHandler(context.Background(), gwMux, conn)+ if err != nil {+ panic(err)+ }+ e.Any("/api/v2/*", echo.WrapHandler(gwMux))+}diff --git a/api/v2/tag_service.go b/api/v2/tag_service.gonew file mode 100644index 000000000..3f063fdf7--- /dev/null+++ b/api/v2/tag_service.go@@ -0,0 +1,46 @@+package v2++import (+ "context"++ apiv2pb "github.com/usememos/memos/proto/gen/api/v2"+ "github.com/usememos/memos/store"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/status"+)++type TagService struct {+ apiv2pb.UnimplementedTagServiceServer++ Store *store.Store+}++// NewTagService creates a new TagService.+func NewTagService(store *store.Store) *TagService {+ return &TagService{+ Store: store,+ }+}++func (s *TagService) ListTags(ctx context.Context, request *apiv2pb.ListTagsRequest) (*apiv2pb.ListTagsResponse, error) {+ tags, err := s.Store.ListTags(ctx, &store.FindTag{+ CreatorID: int(request.CreatorId),+ })+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to list tags: %v", err)+ }++ response := &apiv2pb.ListTagsResponse{}+ for _, tag := range tags {+ response.Tags = append(response.Tags, convertTagFromStore(tag))+ }++ return response, nil+}++func convertTagFromStore(tag *store.Tag) *apiv2pb.Tag {+ return &apiv2pb.Tag{+ Name: tag.Name,+ CreatorId: int32(tag.CreatorID),+ }+}diff --git a/api/v2/v2.go b/api/v2/v2.gonew file mode 100644index 000000000..5ec3cc8e8--- /dev/null+++ b/api/v2/v2.go@@ -0,0 +1 @@+package v2diff --git a/go.mod b/go.modindex 152736793..255cca3d4 100644--- a/go.mod+++ b/go.mod@@ -10,10 +10,10 @@ require (github.com/aws/aws-sdk-go-v2/credentials v1.13.12github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.51github.com/aws/aws-sdk-go-v2/service/s3 v1.30.3- github.com/bufbuild/connect-go v1.10.0github.com/disintegration/imaging v1.6.2github.com/google/uuid v1.3.0github.com/gorilla/feeds v1.1.1+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2github.com/labstack/echo/v4 v4.9.0github.com/pkg/errors v0.9.1github.com/spf13/cobra v1.6.1@@ -21,12 +21,13 @@ require (github.com/stretchr/testify v1.8.1github.com/yuin/goldmark v1.5.4go.uber.org/zap v1.24.0- golang.org/x/crypto v0.1.0+ golang.org/x/crypto v0.11.0golang.org/x/exp v0.0.0-20230111222715-75897c7a292agolang.org/x/mod v0.8.0- golang.org/x/net v0.7.0- golang.org/x/oauth2 v0.5.0- google.golang.org/grpc v1.52.0+ golang.org/x/net v0.12.0+ golang.org/x/oauth2 v0.10.0+ google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e+ google.golang.org/grpc v1.57.0modernc.org/sqlite v1.24.0)@@ -34,9 +35,11 @@ require (github.com/dustin/go-humanize v1.0.1 // indirectgithub.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirectgithub.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect+ github.com/rogpeppe/go-internal v1.9.0 // indirectgolang.org/x/image v0.7.0 // indirectgolang.org/x/tools v0.6.0 // indirect- google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect+ google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect+ google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e // indirectlukechampine.com/uint128 v1.2.0 // indirectmodernc.org/cc/v3 v3.40.0 // indirectmodernc.org/ccgo/v3 v3.16.13 // indirect@@ -67,11 +70,10 @@ require (github.com/fsnotify/fsnotify v1.6.0 // indirectgithub.com/golang-jwt/jwt v3.2.2+incompatible // indirectgithub.com/golang-jwt/jwt/v4 v4.5.0- github.com/golang/protobuf v1.5.2 // indirect+ github.com/golang/protobuf v1.5.3 // indirectgithub.com/hashicorp/hcl v1.0.0 // indirectgithub.com/inconshreveable/mousetrap v1.0.1 // indirectgithub.com/jmespath/go-jmespath v0.4.0 // indirect- github.com/kr/pretty v0.3.1 // indirectgithub.com/labstack/gommon v0.3.1 // indirectgithub.com/magiconair/properties v1.8.7 // indirectgithub.com/mattn/go-colorable v0.1.12 // indirect@@ -88,12 +90,11 @@ require (github.com/valyala/fasttemplate v1.2.1 // indirectgo.uber.org/atomic v1.9.0 // indirectgo.uber.org/multierr v1.8.0 // indirect- golang.org/x/sys v0.5.0 // indirect- golang.org/x/text v0.9.0 // indirect+ golang.org/x/sys v0.10.0 // indirect+ golang.org/x/text v0.11.0 // indirectgolang.org/x/time v0.1.0 // indirectgoogle.golang.org/appengine v1.6.7 // indirectgoogle.golang.org/protobuf v1.31.0- gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirectgopkg.in/ini.v1 v1.67.0 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect)diff --git a/go.sum b/go.sumindex 3aa7fcbe6..4628a08d0 100644--- a/go.sum+++ b/go.sum@@ -83,8 +83,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.18.3/go.mod h1:b+psTJn33Q4qGoDaM7ZiOgithub.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=-github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg=-github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=@@ -94,7 +92,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXgithub.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=@@ -120,6 +117,7 @@ github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqgithub.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=+github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=@@ -145,8 +143,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDgithub.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=-github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=-github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=+github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=+github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=@@ -184,6 +182,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mgithub.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=github.com/gorilla/feeds v1.1.1 h1:HwKXxqzcRNg9to+BbvJog4+f3s/xzvtZXICcQGutYfY=github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA=+github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 h1:dygLcbEBA+t/P7ck6a8AkXv6juQ4cK0RHBoh32jxhHM=+github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2/go.mod h1:Ap9RLCIJVtgQg1/BBgVEfypOAySvvlcpcVQkSzJCH4Y=github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=@@ -206,13 +206,10 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:Cgithub.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=-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/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY=github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks=github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o=@@ -234,7 +231,6 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+Wgithub.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=@@ -310,8 +306,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhgolang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=-golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=-golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=+golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=+golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=@@ -387,8 +383,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9vgolang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=-golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=-golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=+golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=+golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=@@ -398,8 +394,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJgolang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=-golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s=-golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=+golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8=+golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI=golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=@@ -456,8 +452,9 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBcgolang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=+golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=+golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=@@ -469,8 +466,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=-golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=+golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=+golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=@@ -594,8 +592,12 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6Dgoogle.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=-google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY=-google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=+google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 h1:Au6te5hbKUV8pIYWHqOUZ1pva5qK/rwbIhoXEUB9Lu8=+google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y=+google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw=+google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=+google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e h1:S83+ibolgyZ0bqz7KEsUOPErxcv4VzlszxY+31OfB/E=+google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=@@ -612,8 +614,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckMgoogle.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=-google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=-google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=+google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=+google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=@@ -631,7 +633,6 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwgopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=-gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=diff --git a/proto/api/v2/tag_service.proto b/proto/api/v2/tag_service.protonew file mode 100644index 000000000..7c85c9561--- /dev/null+++ b/proto/api/v2/tag_service.proto@@ -0,0 +1,26 @@+syntax = "proto3";++package memos.api.v2;++import "google/api/annotations.proto";++option go_package = "gen/api/v2";++service TagService {+ rpc ListTags(ListTagsRequest) returns (ListTagsResponse) {+ option (google.api.http) = {get: "/api/v2/tags"};+ }+}++message Tag {+ string name = 1;+ int32 creator_id = 2;+}++message ListTagsRequest {+ int32 creator_id = 1;+}++message ListTagsResponse {+ repeated Tag tags = 1;+}diff --git a/proto/apiv2/tag_service.proto b/proto/apiv2/tag_service.protodeleted file mode 100644index a75dfe3ca..000000000--- a/proto/apiv2/tag_service.proto+++ /dev/null@@ -1,22 +0,0 @@-syntax = "proto3";--package memos.apiv2;--option go_package = "gen/apiv2";--service TagService {- rpc ListTags(ListTagsRequest) returns (ListTagsResponse);-}--message Tag {- string name = 1;- int32 creator_id = 2;-}--message ListTagsRequest {- int32 creator_id = 1;-}--message ListTagsResponse {- repeated Tag tags = 1;-}diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yamlindex 412847e95..9b899b986 100644--- a/proto/buf.gen.yaml+++ b/proto/buf.gen.yaml@@ -3,16 +3,18 @@ managed:enabled: truego_package_prefix:default: github.com/usememos/memos/proto/gen+ except:+ - buf.build/googleapis/googleapisplugins:- - plugin: buf.build/grpc/go:v1.3.0+ - plugin: buf.build/protocolbuffers/go:v1.31.0out: genopt:- paths=source_relative- - plugin: buf.build/bufbuild/connect-go:v1.10.0+ - plugin: buf.build/grpc/go:v1.3.0out: genopt:- paths=source_relative- - plugin: buf.build/protocolbuffers/go:v1.31.0+ - plugin: buf.build/grpc-ecosystem/gateway:v2.16.1out: genopt:- paths=source_relativediff --git a/proto/buf.lock b/proto/buf.locknew file mode 100644index 000000000..2c703b6f4--- /dev/null+++ b/proto/buf.lock@@ -0,0 +1,13 @@+# Generated by buf. DO NOT EDIT.+version: v1+deps:+ - remote: buf.build+ owner: googleapis+ repository: googleapis+ commit: 711e289f6a384c4caeebaff7c6931ade+ digest: shake256:e08fb55dad7469f69df00304eed31427d2d1576e9aab31e6bf86642688e04caaf0372f15fe6974cf79432779a635b3ea401ca69c943976dc42749524e4c25d94+ - remote: buf.build+ owner: grpc-ecosystem+ repository: grpc-gateway+ commit: fed2dcdcfd694403ad51cd3c94957830+ digest: shake256:ed076a21e3d772892fc465ced0e4dd50f9dba86fdd4473920eaa25efa4807644e8e021be423dcfcee74bf4242e7e57422393f9b1abb10acb18ea1a5df509bb19diff --git a/proto/buf.yaml b/proto/buf.yamlindex ece50e92c..59bf45eb6 100644--- a/proto/buf.yaml+++ b/proto/buf.yaml@@ -8,3 +8,7 @@ lint:- DEFAULTexcept:- PACKAGE_DIRECTORY_MATCH+ - PACKAGE_VERSION_SUFFIX+deps:+ - buf.build/googleapis/googleapis+ - buf.build/grpc-ecosystem/grpc-gatewaydiff --git a/proto/gen/apiv2/tag_service.pb.go b/proto/gen/api/v2/tag_service.pb.gosimilarity index 53%rename from proto/gen/apiv2/tag_service.pb.gorename to proto/gen/api/v2/tag_service.pb.goindex dfb2bb67a..d3fb150ca 100644--- a/proto/gen/apiv2/tag_service.pb.go+++ b/proto/gen/api/v2/tag_service.pb.go@@ -2,11 +2,12 @@// versions:// protoc-gen-go v1.31.0// protoc (unknown)-// source: apiv2/tag_service.proto+// source: api/v2/tag_service.protopackage apiv2import (+ _ "google.golang.org/genproto/googleapis/api/annotations"protoreflect "google.golang.org/protobuf/reflect/protoreflect"protoimpl "google.golang.org/protobuf/runtime/protoimpl"reflect "reflect"@@ -32,7 +33,7 @@ type Tag struct {func (x *Tag) Reset() {*x = Tag{}if protoimpl.UnsafeEnabled {- mi := &file_apiv2_tag_service_proto_msgTypes[0]+ mi := &file_api_v2_tag_service_proto_msgTypes[0]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -45,7 +46,7 @@ func (x *Tag) String() string {func (*Tag) ProtoMessage() {}func (x *Tag) ProtoReflect() protoreflect.Message {- mi := &file_apiv2_tag_service_proto_msgTypes[0]+ mi := &file_api_v2_tag_service_proto_msgTypes[0]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -58,7 +59,7 @@ func (x *Tag) ProtoReflect() protoreflect.Message {// Deprecated: Use Tag.ProtoReflect.Descriptor instead.func (*Tag) Descriptor() ([]byte, []int) {- return file_apiv2_tag_service_proto_rawDescGZIP(), []int{0}+ return file_api_v2_tag_service_proto_rawDescGZIP(), []int{0}}func (x *Tag) GetName() string {@@ -86,7 +87,7 @@ type ListTagsRequest struct {func (x *ListTagsRequest) Reset() {*x = ListTagsRequest{}if protoimpl.UnsafeEnabled {- mi := &file_apiv2_tag_service_proto_msgTypes[1]+ mi := &file_api_v2_tag_service_proto_msgTypes[1]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -99,7 +100,7 @@ func (x *ListTagsRequest) String() string {func (*ListTagsRequest) ProtoMessage() {}func (x *ListTagsRequest) ProtoReflect() protoreflect.Message {- mi := &file_apiv2_tag_service_proto_msgTypes[1]+ mi := &file_api_v2_tag_service_proto_msgTypes[1]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -112,7 +113,7 @@ func (x *ListTagsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListTagsRequest.ProtoReflect.Descriptor instead.func (*ListTagsRequest) Descriptor() ([]byte, []int) {- return file_apiv2_tag_service_proto_rawDescGZIP(), []int{1}+ return file_api_v2_tag_service_proto_rawDescGZIP(), []int{1}}func (x *ListTagsRequest) GetCreatorId() int32 {@@ -133,7 +134,7 @@ type ListTagsResponse struct {func (x *ListTagsResponse) Reset() {*x = ListTagsResponse{}if protoimpl.UnsafeEnabled {- mi := &file_apiv2_tag_service_proto_msgTypes[2]+ mi := &file_api_v2_tag_service_proto_msgTypes[2]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -146,7 +147,7 @@ func (x *ListTagsResponse) String() string {func (*ListTagsResponse) ProtoMessage() {}func (x *ListTagsResponse) ProtoReflect() protoreflect.Message {- mi := &file_apiv2_tag_service_proto_msgTypes[2]+ mi := &file_api_v2_tag_service_proto_msgTypes[2]if protoimpl.UnsafeEnabled && x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -159,7 +160,7 @@ func (x *ListTagsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListTagsResponse.ProtoReflect.Descriptor instead.func (*ListTagsResponse) Descriptor() ([]byte, []int) {- return file_apiv2_tag_service_proto_rawDescGZIP(), []int{2}+ return file_api_v2_tag_service_proto_rawDescGZIP(), []int{2}}func (x *ListTagsResponse) GetTags() []*Tag {@@ -169,62 +170,66 @@ func (x *ListTagsResponse) GetTags() []*Tag {return nil}-var File_apiv2_tag_service_proto protoreflect.FileDescriptor+var File_api_v2_tag_service_proto protoreflect.FileDescriptor-var file_apiv2_tag_service_proto_rawDesc = []byte{- 0x0a, 0x17, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76,- 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73,- 0x2e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x22, 0x38, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a,+var file_api_v2_tag_service_proto_rawDesc = []byte{+ 0x0a, 0x18, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x5f, 0x73, 0x65, 0x72,+ 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, 0x6f,+ 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,+ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a,0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18,0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64,0x22, 0x30, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75,0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69,0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72,- 0x49, 0x64, 0x22, 0x38, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65,- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01,- 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,- 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0x55, 0x0a, 0x0a,- 0x54, 0x61, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x08, 0x4c, 0x69,- 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,- 0x70, 0x69, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71,- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,- 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,- 0x6e, 0x73, 0x65, 0x42, 0x9a, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,- 0x73, 0x2e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x42, 0x0f, 0x54, 0x61, 0x67, 0x53, 0x65, 0x72, 0x76,- 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68,- 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f,- 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f,- 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65,- 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x76, 0x32, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f,- 0x73, 0x5c, 0x41, 0x70, 0x69, 0x76, 0x32, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c,- 0x41, 0x70, 0x69, 0x76, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,- 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x76, 0x32,- 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x49, 0x64, 0x22, 0x39, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65,+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01,+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,+ 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x32, 0x6d, 0x0a,+ 0x0a, 0x54, 0x61, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x08, 0x4c,+ 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65,+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c,+ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x42, 0xa7, 0x01, 0x0a,+ 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,+ 0x32, 0x42, 0x0f, 0x54, 0x61, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f,+ 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,+ 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32,+ 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d,+ 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65,+ 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d,+ 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,+ 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41,+ 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (- file_apiv2_tag_service_proto_rawDescOnce sync.Once- file_apiv2_tag_service_proto_rawDescData = file_apiv2_tag_service_proto_rawDesc+ file_api_v2_tag_service_proto_rawDescOnce sync.Once+ file_api_v2_tag_service_proto_rawDescData = file_api_v2_tag_service_proto_rawDesc)-func file_apiv2_tag_service_proto_rawDescGZIP() []byte {- file_apiv2_tag_service_proto_rawDescOnce.Do(func() {- file_apiv2_tag_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_apiv2_tag_service_proto_rawDescData)+func file_api_v2_tag_service_proto_rawDescGZIP() []byte {+ file_api_v2_tag_service_proto_rawDescOnce.Do(func() {+ file_api_v2_tag_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_tag_service_proto_rawDescData)})- return file_apiv2_tag_service_proto_rawDescData+ return file_api_v2_tag_service_proto_rawDescData}-var file_apiv2_tag_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)-var file_apiv2_tag_service_proto_goTypes = []interface{}{- (*Tag)(nil), // 0: memos.apiv2.Tag- (*ListTagsRequest)(nil), // 1: memos.apiv2.ListTagsRequest- (*ListTagsResponse)(nil), // 2: memos.apiv2.ListTagsResponse+var file_api_v2_tag_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)+var file_api_v2_tag_service_proto_goTypes = []interface{}{+ (*Tag)(nil), // 0: memos.api.v2.Tag+ (*ListTagsRequest)(nil), // 1: memos.api.v2.ListTagsRequest+ (*ListTagsResponse)(nil), // 2: memos.api.v2.ListTagsResponse}-var file_apiv2_tag_service_proto_depIdxs = []int32{- 0, // 0: memos.apiv2.ListTagsResponse.tags:type_name -> memos.apiv2.Tag- 1, // 1: memos.apiv2.TagService.ListTags:input_type -> memos.apiv2.ListTagsRequest- 2, // 2: memos.apiv2.TagService.ListTags:output_type -> memos.apiv2.ListTagsResponse+var file_api_v2_tag_service_proto_depIdxs = []int32{+ 0, // 0: memos.api.v2.ListTagsResponse.tags:type_name -> memos.api.v2.Tag+ 1, // 1: memos.api.v2.TagService.ListTags:input_type -> memos.api.v2.ListTagsRequest+ 2, // 2: memos.api.v2.TagService.ListTags:output_type -> memos.api.v2.ListTagsResponse2, // [2:3] is the sub-list for method output_type1, // [1:2] is the sub-list for method input_type1, // [1:1] is the sub-list for extension type_name@@ -232,13 +237,13 @@ var file_apiv2_tag_service_proto_depIdxs = []int32{0, // [0:1] is the sub-list for field type_name}-func init() { file_apiv2_tag_service_proto_init() }-func file_apiv2_tag_service_proto_init() {- if File_apiv2_tag_service_proto != nil {+func init() { file_api_v2_tag_service_proto_init() }+func file_api_v2_tag_service_proto_init() {+ if File_api_v2_tag_service_proto != nil {return}if !protoimpl.UnsafeEnabled {- file_apiv2_tag_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {+ file_api_v2_tag_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*Tag); i {case 0:return &v.state@@ -250,7 +255,7 @@ func file_apiv2_tag_service_proto_init() {return nil}}- file_apiv2_tag_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {+ file_api_v2_tag_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ListTagsRequest); i {case 0:return &v.state@@ -262,7 +267,7 @@ func file_apiv2_tag_service_proto_init() {return nil}}- file_apiv2_tag_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {+ file_api_v2_tag_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {switch v := v.(*ListTagsResponse); i {case 0:return &v.state@@ -279,18 +284,18 @@ func file_apiv2_tag_service_proto_init() {out := protoimpl.TypeBuilder{File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),- RawDescriptor: file_apiv2_tag_service_proto_rawDesc,+ RawDescriptor: file_api_v2_tag_service_proto_rawDesc,NumEnums: 0,NumMessages: 3,NumExtensions: 0,NumServices: 1,},- GoTypes: file_apiv2_tag_service_proto_goTypes,- DependencyIndexes: file_apiv2_tag_service_proto_depIdxs,- MessageInfos: file_apiv2_tag_service_proto_msgTypes,+ GoTypes: file_api_v2_tag_service_proto_goTypes,+ DependencyIndexes: file_api_v2_tag_service_proto_depIdxs,+ MessageInfos: file_api_v2_tag_service_proto_msgTypes,}.Build()- File_apiv2_tag_service_proto = out.File- file_apiv2_tag_service_proto_rawDesc = nil- file_apiv2_tag_service_proto_goTypes = nil- file_apiv2_tag_service_proto_depIdxs = nil+ File_api_v2_tag_service_proto = out.File+ file_api_v2_tag_service_proto_rawDesc = nil+ file_api_v2_tag_service_proto_goTypes = nil+ file_api_v2_tag_service_proto_depIdxs = nil}diff --git a/proto/gen/api/v2/tag_service.pb.gw.go b/proto/gen/api/v2/tag_service.pb.gw.gonew file mode 100644index 000000000..59bf6180a--- /dev/null+++ b/proto/gen/api/v2/tag_service.pb.gw.go@@ -0,0 +1,173 @@+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.+// source: api/v2/tag_service.proto++/*+Package apiv2 is a reverse proxy.++It translates gRPC into RESTful JSON APIs.+*/+package apiv2++import (+ "context"+ "io"+ "net/http"++ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"+ "google.golang.org/grpc"+ "google.golang.org/grpc/codes"+ "google.golang.org/grpc/grpclog"+ "google.golang.org/grpc/metadata"+ "google.golang.org/grpc/status"+ "google.golang.org/protobuf/proto"+)++// Suppress "imported and not used" errors+var _ codes.Code+var _ io.Reader+var _ status.Status+var _ = runtime.String+var _ = utilities.NewDoubleArray+var _ = metadata.Join++var (+ filter_TagService_ListTags_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}+)++func request_TagService_ListTags_0(ctx context.Context, marshaler runtime.Marshaler, client TagServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq ListTagsRequest+ var metadata runtime.ServerMetadata++ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TagService_ListTags_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := client.ListTags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err++}++func local_request_TagService_ListTags_0(ctx context.Context, marshaler runtime.Marshaler, server TagServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq ListTagsRequest+ var metadata runtime.ServerMetadata++ if err := req.ParseForm(); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TagService_ListTags_0); err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ msg, err := server.ListTags(ctx, &protoReq)+ return msg, metadata, err++}++// RegisterTagServiceHandlerServer registers the http handlers for service TagService to "mux".+// UnaryRPC :call TagServiceServer directly.+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTagServiceHandlerFromEndpoint instead.+func RegisterTagServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TagServiceServer) error {++ mux.Handle("GET", pattern_TagService_ListTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.TagService/ListTags", runtime.WithHTTPPathPattern("/api/v2/tags"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_TagService_ListTags_0(annotatedContext, inboundMarshaler, server, req, pathParams)+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_TagService_ListTags_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })++ return nil+}++// RegisterTagServiceHandlerFromEndpoint is same as RegisterTagServiceHandler but+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.+func RegisterTagServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {+ conn, err := grpc.DialContext(ctx, endpoint, opts...)+ if err != nil {+ return err+ }+ defer func() {+ if err != nil {+ if cerr := conn.Close(); cerr != nil {+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)+ }+ return+ }+ go func() {+ <-ctx.Done()+ if cerr := conn.Close(); cerr != nil {+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)+ }+ }()+ }()++ return RegisterTagServiceHandler(ctx, mux, conn)+}++// RegisterTagServiceHandler registers the http handlers for service TagService to "mux".+// The handlers forward requests to the grpc endpoint over "conn".+func RegisterTagServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {+ return RegisterTagServiceHandlerClient(ctx, mux, NewTagServiceClient(conn))+}++// RegisterTagServiceHandlerClient registers the http handlers for service TagService+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TagServiceClient".+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TagServiceClient"+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in+// "TagServiceClient" to call the correct interceptors.+func RegisterTagServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TagServiceClient) error {++ mux.Handle("GET", pattern_TagService_ListTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.TagService/ListTags", runtime.WithHTTPPathPattern("/api/v2/tags"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_TagService_ListTags_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_TagService_ListTags_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })++ return nil+}++var (+ pattern_TagService_ListTags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "tags"}, ""))+)++var (+ forward_TagService_ListTags_0 = runtime.ForwardResponseMessage+)diff --git a/proto/gen/apiv2/tag_service_grpc.pb.go b/proto/gen/api/v2/tag_service_grpc.pb.gosimilarity index 94%rename from proto/gen/apiv2/tag_service_grpc.pb.gorename to proto/gen/api/v2/tag_service_grpc.pb.goindex b29143e33..64d4ae01b 100644--- a/proto/gen/apiv2/tag_service_grpc.pb.go+++ b/proto/gen/api/v2/tag_service_grpc.pb.go@@ -2,7 +2,7 @@// versions:// - protoc-gen-go-grpc v1.3.0// - protoc (unknown)-// source: apiv2/tag_service.proto+// source: api/v2/tag_service.protopackage apiv2@@ -19,7 +19,7 @@ import (const _ = grpc.SupportPackageIsVersion7const (- TagService_ListTags_FullMethodName = "/memos.apiv2.TagService/ListTags"+ TagService_ListTags_FullMethodName = "/memos.api.v2.TagService/ListTags")// TagServiceClient is the client API for TagService service.@@ -96,7 +96,7 @@ func _TagService_ListTags_Handler(srv interface{}, ctx context.Context, dec func// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)var TagService_ServiceDesc = grpc.ServiceDesc{- ServiceName: "memos.apiv2.TagService",+ ServiceName: "memos.api.v2.TagService",HandlerType: (*TagServiceServer)(nil),Methods: []grpc.MethodDesc{{@@ -105,5 +105,5 @@ var TagService_ServiceDesc = grpc.ServiceDesc{},},Streams: []grpc.StreamDesc{},- Metadata: "apiv2/tag_service.proto",+ Metadata: "api/v2/tag_service.proto",}diff --git a/proto/gen/apiv2/apiv2connect/tag_service.connect.go b/proto/gen/apiv2/apiv2connect/tag_service.connect.godeleted file mode 100644index bb6527001..000000000--- a/proto/gen/apiv2/apiv2connect/tag_service.connect.go+++ /dev/null@@ -1,104 +0,0 @@-// Code generated by protoc-gen-connect-go. DO NOT EDIT.-//-// Source: apiv2/tag_service.proto--package apiv2connect--import (- context "context"- errors "errors"- connect_go "github.com/bufbuild/connect-go"- apiv2 "github.com/usememos/memos/proto/gen/apiv2"- http "net/http"- strings "strings"-)--// This is a compile-time assertion to ensure that this generated file and the connect package are-// compatible. If you get a compiler error that this constant is not defined, this code was-// generated with a version of connect newer than the one compiled into your binary. You can fix the-// problem by either regenerating this code with an older version of connect or updating the connect-// version compiled into your binary.-const _ = connect_go.IsAtLeastVersion0_1_0--const (- // TagServiceName is the fully-qualified name of the TagService service.- TagServiceName = "memos.apiv2.TagService"-)--// These constants are the fully-qualified names of the RPCs defined in this package. They're-// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.-//-// Note that these are different from the fully-qualified method names used by-// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to-// reflection-formatted method names, remove the leading slash and convert the remaining slash to a-// period.-const (- // TagServiceListTagsProcedure is the fully-qualified name of the TagService's ListTags RPC.- TagServiceListTagsProcedure = "/memos.apiv2.TagService/ListTags"-)--// TagServiceClient is a client for the memos.apiv2.TagService service.-type TagServiceClient interface {- ListTags(context.Context, *connect_go.Request[apiv2.ListTagsRequest]) (*connect_go.Response[apiv2.ListTagsResponse], error)-}--// NewTagServiceClient constructs a client for the memos.apiv2.TagService service. By default, it-// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends-// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or-// connect.WithGRPCWeb() options.-//-// The URL supplied here should be the base URL for the Connect or gRPC server (for example,-// http://api.acme.com or https://acme.com/grpc).-func NewTagServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) TagServiceClient {- baseURL = strings.TrimRight(baseURL, "/")- return &tagServiceClient{- listTags: connect_go.NewClient[apiv2.ListTagsRequest, apiv2.ListTagsResponse](- httpClient,- baseURL+TagServiceListTagsProcedure,- opts...,- ),- }-}--// tagServiceClient implements TagServiceClient.-type tagServiceClient struct {- listTags *connect_go.Client[apiv2.ListTagsRequest, apiv2.ListTagsResponse]-}--// ListTags calls memos.apiv2.TagService.ListTags.-func (c *tagServiceClient) ListTags(ctx context.Context, req *connect_go.Request[apiv2.ListTagsRequest]) (*connect_go.Response[apiv2.ListTagsResponse], error) {- return c.listTags.CallUnary(ctx, req)-}--// TagServiceHandler is an implementation of the memos.apiv2.TagService service.-type TagServiceHandler interface {- ListTags(context.Context, *connect_go.Request[apiv2.ListTagsRequest]) (*connect_go.Response[apiv2.ListTagsResponse], error)-}--// NewTagServiceHandler builds an HTTP handler from the service implementation. It returns the path-// on which to mount the handler and the handler itself.-//-// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf-// and JSON codecs. They also support gzip compression.-func NewTagServiceHandler(svc TagServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {- tagServiceListTagsHandler := connect_go.NewUnaryHandler(- TagServiceListTagsProcedure,- svc.ListTags,- opts...,- )- return "/memos.apiv2.TagService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {- switch r.URL.Path {- case TagServiceListTagsProcedure:- tagServiceListTagsHandler.ServeHTTP(w, r)- default:- http.NotFound(w, r)- }- })-}--// UnimplementedTagServiceHandler returns CodeUnimplemented from all methods.-type UnimplementedTagServiceHandler struct{}--func (UnimplementedTagServiceHandler) ListTags(context.Context, *connect_go.Request[apiv2.ListTagsRequest]) (*connect_go.Response[apiv2.ListTagsResponse], error) {- return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("memos.apiv2.TagService.ListTags is not implemented"))-}diff --git a/server/server.go b/server/server.goindex bd6fe0577..d675aca68 100644--- a/server/server.go+++ b/server/server.go@@ -4,23 +4,29 @@ import ("context""encoding/json""fmt"+ "net""net/http""time""github.com/google/uuid"+ "github.com/labstack/echo/v4"+ "github.com/labstack/echo/v4/middleware""github.com/pkg/errors"apiv1 "github.com/usememos/memos/api/v1"+ apiv2 "github.com/usememos/memos/api/v2"+ "github.com/usememos/memos/common/log""github.com/usememos/memos/common/util""github.com/usememos/memos/plugin/telegram"+ apiv2pb "github.com/usememos/memos/proto/gen/api/v2""github.com/usememos/memos/server/profile""github.com/usememos/memos/store"-- "github.com/labstack/echo/v4"- "github.com/labstack/echo/v4/middleware"+ "go.uber.org/zap"+ "google.golang.org/grpc")type Server struct {- e *echo.Echo+ e *echo.Echo+ grpcServer *grpc.ServerID stringSecret string@@ -94,6 +100,13 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.StoreapiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store)apiV1Service.Register(rootGroup)+ // Register gPRC server services.+ s.grpcServer = grpc.NewServer()+ apiv2pb.RegisterTagServiceServer(s.grpcServer, apiv2.NewTagService(store))++ // Register gRPC gateway as api v2.+ apiv2.RegisterGateway(ctx, e, s.Profile.Port+1)+return s, nil}@@ -105,6 +118,17 @@ func (s *Server) Start(ctx context.Context) error {go s.telegramBot.Start(ctx)go autoBackup(ctx, s.Store)+ // Start gRPC server.+ listen, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Profile.Port+1))+ if err != nil {+ return err+ }+ go func() {+ if err := s.grpcServer.Serve(listen); err != nil {+ log.Error("grpc server listen error", zap.Error(err))+ }+ }()+return s.e.Start(fmt.Sprintf(":%d", s.Profile.Port))}