Skip to content

Commit

Permalink
go module v2: update module version, and related files and paths to v2 (
Browse files Browse the repository at this point in the history
#358)

* update module version, and related files and paths to v2

* make gen and fmt
  • Loading branch information
hramazani authored Jan 10, 2023
1 parent 0f0ee94 commit 0639472
Show file tree
Hide file tree
Showing 92 changed files with 7,087 additions and 354 deletions.
4 changes: 2 additions & 2 deletions atlas/resource/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You could use it to define identifiers in your proto messages, e.g.
```proto
syntax = "proto3";
import "github.com/infobloxopen/atlas-app-toolkit/rpc/resource/resource.proto";
import "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/resource/resource.proto";
message MyMessage {
atlas.rpc.Identifier id = 1;
Expand All @@ -47,7 +47,7 @@ package main
import (
"fmt"

"github.com/infobloxopen/atlas-app-toolkit/rpc/resource"
"github.com/infobloxopen/atlas-app-toolkit/v2/rpc/resource"
)

func main() {
Expand Down
8 changes: 6 additions & 2 deletions atlas/resource/jsonpb.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (

// MarshalJSONPB implements jsonpb.JSONPBMarshaler interface by marshal
// Identifier from a JSON string in accordance with Atlas Reference format
// <application_name>/<resource_type>/<resource_id>
//
// <application_name>/<resource_type>/<resource_id>
//
// Support "null" value.
func (m Identifier) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) {
v := BuildString(m.GetApplicationName(), m.GetResourceType(), m.GetResourceId())
Expand All @@ -20,7 +22,9 @@ func (m Identifier) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) {

// UnmarshalJSONPB implements jsonpb.JSONPBUnmarshaler interface by unmarshal
// Identifier to a JSON string in accordance with Atlas Reference format
// <application_name>/<resource_type>/<resource_id>
//
// <application_name>/<resource_type>/<resource_id>
//
// Support "null" value.
func (m *Identifier) UnmarshalJSONPB(_ *jsonpb.Unmarshaler, data []byte) error {
v := strings.Trim(string(data), "\"")
Expand Down
5 changes: 4 additions & 1 deletion atlas/resource/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const (
)

// BuildString builds string id according to Atlas Reference format:
// <application_name>/<resource_type>/<resource_id>
//
// <application_name>/<resource_type>/<resource_id>
func BuildString(aname, rtype, rid string) string {
var l []string

Expand All @@ -28,7 +29,9 @@ func BuildString(aname, rtype, rid string) string {
}

// ParseString parses id according to Atlas Reference format:
//
// <application_name>/<resource_type>/<resource_id>
//
// All leading and trailing Delimiter are removed.
// The resource_id is parsed first, then resource type and last application name.
// The id "/a/b/c/" will be converted to "a/b/c" and returned as (a, b, c).
Expand Down
2 changes: 1 addition & 1 deletion auth/interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
mock_transport "github.com/infobloxopen/atlas-app-toolkit/mocks/transport"
mock_transport "github.com/infobloxopen/atlas-app-toolkit/v2/mocks/transport"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
Expand Down
4 changes: 2 additions & 2 deletions errors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ interceptor := errors.UnaryServerInterceptor(
<a name="validation"></a>
# Validation Errors

import "github.com/infobloxopen/atlas-app-toolkit/errors/mappers/validationerrors"
import "github.com/infobloxopen/atlas-app-toolkit/v2/errors/mappers/validationerrors"

`validationerrors` is a request contents validator server-side middleware for
gRPC.
Expand Down Expand Up @@ -309,7 +309,7 @@ Example Usage:

# PQ Errors

import "github.com/infobloxopen/atlas-app-toolkit/errors/mappers/pqerrors"
import "github.com/infobloxopen/atlas-app-toolkit/v2/errors/mappers/pqerrors"

`pqerrors` is a error mapper for postgres.

Expand Down
2 changes: 1 addition & 1 deletion errors/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"google.golang.org/grpc/status"

"github.com/golang/protobuf/proto"
"github.com/infobloxopen/atlas-app-toolkit/atlas/atlasrpc"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/atlasrpc"
)

// Container struct is an entity that servers a purpose of error container and
Expand Down
2 changes: 1 addition & 1 deletion errors/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/infobloxopen/atlas-app-toolkit/atlas/atlasrpc"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/atlasrpc"
"google.golang.org/grpc/codes"
)

Expand Down
2 changes: 1 addition & 1 deletion errors/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package errors
import (
"context"

"github.com/infobloxopen/atlas-app-toolkit/atlas/atlasrpc"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/atlasrpc"
"google.golang.org/grpc/codes"
)

Expand Down
2 changes: 1 addition & 1 deletion errors/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"context"
"fmt"

"github.com/infobloxopen/atlas-app-toolkit/atlas/atlasrpc"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/atlasrpc"
"google.golang.org/grpc/codes"
)

Expand Down
2 changes: 1 addition & 1 deletion errors/mappers/pqerrors/pqerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/lib/pq"
"google.golang.org/grpc/codes"

"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/v2/errors"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion errors/mappers/pqerrors/pqerrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/lib/pq"

"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/v2/errors"
)

func TestCond(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion errors/mappers/validationerrors/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/infobloxopen/atlas-app-toolkit/util"
"github.com/infobloxopen/atlas-app-toolkit/v2/util"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion errors/mappers/validationerrors/validationerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package validationerrors
import (
"context"

"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/v2/errors"
"google.golang.org/grpc/codes"
)

Expand Down
2 changes: 1 addition & 1 deletion errors/mappers/validationerrors/validationerrors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/v2/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down
8 changes: 4 additions & 4 deletions gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ You can also use the helper function provided in this package.
import (
"context"

"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/v2/gateway"
)

func (s *myServiceImpl) MyMethod(ctx context.Context, req *MyRequest) (*MyResponse, error) {
Expand Down Expand Up @@ -130,7 +130,7 @@ To override this behavior, the gRPC Gateway documentation recommends overwriting

```go
import (
"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/v2/gateway"
)

func init() {
Expand All @@ -157,7 +157,7 @@ Also you may use shortcuts like `SetCreated`, `SetUpdated`, and `SetDeleted`.

```go
import (
"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/v2/gateway"
)

func (s *myService) MyMethod(req *MyRequest) (*MyResponse, error) {
Expand Down Expand Up @@ -350,7 +350,7 @@ Here's an example that shows how to use [`DefaultProtoErrorHandler`](gateway/err
```go
import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/v2/gateway"

"github.com/yourrepo/yourapp"
)
Expand Down
2 changes: 1 addition & 1 deletion gateway/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"google.golang.org/grpc/status"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/infobloxopen/atlas-app-toolkit/atlas/atlasrpc"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/atlasrpc"
)

// ProtoStreamErrorHandlerFunc handles the error as a gRPC error generated via status package and replies to the testRequest.
Expand Down
2 changes: 1 addition & 1 deletion gateway/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"reflect"
"testing"

"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-app-toolkit/v2/errors"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc/codes"
Expand Down
4 changes: 2 additions & 2 deletions gateway/field_presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"reflect"
"strings"

"github.com/infobloxopen/atlas-app-toolkit/internal/casing"
"github.com/infobloxopen/atlas-app-toolkit/v2/internal/casing"
"google.golang.org/genproto/protobuf/field_mask"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
Expand Down Expand Up @@ -151,7 +151,7 @@ type presenceInterceptorOptionsDecorator struct {

type presenceInterceptorOption func(*presenceInterceptorOptionsDecorator)

//WithOverrideFieldMask represent an option to override field mask generated by grpc-gateway
// WithOverrideFieldMask represent an option to override field mask generated by grpc-gateway
func WithOverrideFieldMask(d *presenceInterceptorOptionsDecorator) {
d.overrideFieldMask = true
}
Expand Down
10 changes: 5 additions & 5 deletions gateway/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"net/http"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

//retainFields function extracts the configuration for fields that
//need to be ratained either from gRPC response or from original testRequest
//(in case when gRPC side didn't set any preferences) and retains only
//this fields on outgoing response (dynmap).
// retainFields function extracts the configuration for fields that
// need to be ratained either from gRPC response or from original testRequest
// (in case when gRPC side didn't set any preferences) and retains only
// this fields on outgoing response (dynmap).
func retainFields(ctx context.Context, req *http.Request, dynmap map[string]interface{}) {
fieldsStr := ""
if req != nil {
Expand Down
2 changes: 1 addition & 1 deletion gateway/fields_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"testing"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

func TestRetain(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
2 changes: 1 addition & 1 deletion gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"
"testing"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
Expand Down
2 changes: 1 addition & 1 deletion gateway/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"

"github.com/golang/protobuf/proto"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
)
Expand Down
2 changes: 1 addition & 1 deletion gateway/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gateway
import (
"testing"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

func TestUnsetOp(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion gateway/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strconv"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
Expand Down
2 changes: 1 addition & 1 deletion gorm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The created transaction is stored in `context.Context` and passed to the request

```go
import (
"github.com/infobloxopen/atlas-app-toolkit/gorm"
"github.com/infobloxopen/atlas-app-toolkit/v2/gorm"
)

func (s *MyService) MyMethod(ctx context.Context, req *MyMethodRequest) (*MyMethodResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion gorm/collection_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/jinzhu/gorm"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

type SortingCriteriaConverter interface {
Expand Down
4 changes: 2 additions & 2 deletions gorm/collection_operators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"

"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/gateway"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

type Person struct {
Expand Down
6 changes: 3 additions & 3 deletions gorm/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"

"github.com/infobloxopen/atlas-app-toolkit/atlas/resource"
"github.com/infobloxopen/atlas-app-toolkit/internal/casing"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/resource"
"github.com/infobloxopen/atlas-app-toolkit/v2/internal/casing"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

// DefaultFilteringConditionProcessor processes filter operator conversion
Expand Down
4 changes: 2 additions & 2 deletions gorm/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/jinzhu/gorm"

"github.com/infobloxopen/atlas-app-toolkit/internal/casing"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/internal/casing"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

// DefaultFieldSelectionConverter performs default convertion for FieldSelection collection operator
Expand Down
4 changes: 2 additions & 2 deletions gorm/filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/golang/protobuf/proto"

"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

type LogicalOperatorConverter interface {
Expand Down Expand Up @@ -57,7 +57,7 @@ func FilterStringToGorm(ctx context.Context, filter string, obj interface{}, pb
return FilteringToGormEx(ctx, f, obj, c)
}

//Deprecated: Use FilteringToGormEx instead
// Deprecated: Use FilteringToGormEx instead
// FilteringToGorm returns GORM Plain SQL representation of the filtering expression.
func FilteringToGorm(ctx context.Context, m *query.Filtering, obj interface{}, pb proto.Message) (string, []interface{}, map[string]struct{}, error) {
c := &DefaultFilteringConditionConverter{&DefaultFilteringConditionProcessor{pb}}
Expand Down
4 changes: 2 additions & 2 deletions gorm/filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/jinzhu/gorm/dialects/postgres"
"github.com/stretchr/testify/assert"

"github.com/infobloxopen/atlas-app-toolkit/atlas/resource"
"github.com/infobloxopen/atlas-app-toolkit/query"
"github.com/infobloxopen/atlas-app-toolkit/v2/atlas/resource"
"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)

type Entity struct {
Expand Down
Loading

0 comments on commit 0639472

Please sign in to comment.