Skip to content

Commit

Permalink
Merge pull request #79 from sudoblockio/fix/protoc-gorm
Browse files Browse the repository at this point in the history
Update Protoc Gorm Generation
  • Loading branch information
robcxyz authored Oct 1, 2024
2 parents c94a9a1 + 5de1012 commit 8d56067
Show file tree
Hide file tree
Showing 36 changed files with 3,437 additions and 3,390 deletions.
13 changes: 7 additions & 6 deletions src/crud/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package crud
import (
"encoding/json"
"fmt"
"github.com/sudoblockio/icon-transformer/config"
"github.com/sudoblockio/icon-transformer/metrics"
"go.uber.org/zap"
"golang.org/x/exp/slices"
"gorm.io/gorm/clause"
"log"
"reflect"
"regexp"
"strings"
"time"

"github.com/sudoblockio/icon-transformer/config"
"github.com/sudoblockio/icon-transformer/metrics"
"go.uber.org/zap"
"golang.org/x/exp/slices"
"gorm.io/gorm/clause"
)

// getModelColumnNames - Get a slice of column names from a Model's tags
Expand Down Expand Up @@ -60,7 +61,7 @@ func ToSnakeCase(str string) string {
return strings.ToLower(snake)
}

var matchPrimaryKey = regexp.MustCompile("primary_key")
var matchPrimaryKey = regexp.MustCompile("primaryKey")

// getModelPrimaryKeys - Get a slice of primary keys from the ORM Model's tags
func getModelPrimaryKeys[T any](model T) []clause.Column {
Expand Down
11 changes: 6 additions & 5 deletions src/crud/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package crud

import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/sudoblockio/icon-transformer/models"
"gorm.io/gorm/clause"
"reflect"
"regexp"
"testing"

"github.com/stretchr/testify/assert"
"github.com/sudoblockio/icon-transformer/models"
"gorm.io/gorm/clause"
)

func TestCrudUtilsExtractFilledFieldsFromModel(t *testing.T) {
Expand Down Expand Up @@ -51,7 +52,7 @@ func TestCrudUtilsRegex(t *testing.T) {
for _, test := range []TestsRegex{
{
regexp: matchPrimaryKey,
input: "primary_key",
input: "primaryKey",
output: true,
},
{
Expand All @@ -61,7 +62,7 @@ func TestCrudUtilsRegex(t *testing.T) {
},
{
regexp: matchPrimaryKey,
input: "primary_key;index:log_foo",
input: "primaryKey;index:log_foo",
output: true,
},
} {
Expand Down
Loading

0 comments on commit 8d56067

Please sign in to comment.