infobloxopen / atlas-app-toolkit

This repository provides common Go utilities and helpers that are reusable from project-to-project. The goal is to prevent code duplication by encouraging teams to use and contribute to toolkit libraries. The toolkit is not a framework. Rather, it is a set of (mostly gRPC-related) plugins and helpers.
Apache License 2.0
99 stars 115 forks source link

Upgrading to gorm v2 #304

Closed wk8 closed 2 years ago

calvin2021y commented 2 years ago

Hi @wk8, Thanks for the nice work.

I try use your branch but get this error:

user.pb.gorm.go:52:41: cannot use m.Id (type *"github.com/infobloxopen/atlas-app-toolkit/atlas/resource".Identifier) as type *"github.com/infobloxopen/atlas-app-toolkit/rpc/resource".Identifier in argument to "github.com/infobloxopen/atlas-app-toolkit/gorm/resource".Decode

There is atlas.rpc in your atlas-app-toolkit jrouge/gorm_v2 branch, but also there is atlas.resource.v1, how to fix this conflict ?

calvin2021y commented 2 years ago

I try add this patch:

diff --git a/gorm/resource/resource.go b/gorm/resource/resource.go
index 6d78620..4445134 100644
--- a/gorm/resource/resource.go
+++ b/gorm/resource/resource.go
@@ -9,7 +9,7 @@ import (

        "github.com/golang/protobuf/proto"

-       resourcepb "github.com/infobloxopen/atlas-app-toolkit/rpc/resource"
+       resourcepb "github.com/infobloxopen/atlas-app-toolkit/atlas/resource"
        "github.com/infobloxopen/atlas-app-toolkit/util"
 )

then get this error:

# github.com/infobloxopen/atlas-app-toolkit/gorm/resource
atlas-app-toolkit/gorm/resource/resource.go:124:5: undefined: resource.Nil
atlas-app-toolkit/gorm/resource/resource.go:130:10: undefined: resource.BuildString
atlas-app-toolkit/gorm/resource/resource.go:240:56: undefined: resource.ParseString
Calebjh commented 2 years ago

Merged into a new gorm_v2 branch in this repo, too, until we can get the protoc-gen-gorm and any other repos that depend on it into a state that also work with the gorm V2 changes