Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Glitch committed Nov 13, 2024
1 parent 98dfb84 commit 94036b9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 18 deletions.
1 change: 0 additions & 1 deletion join.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func joinScope(relationName string, rel *schema.Relationship, fields []string, b
}

func join(tx *gorm.DB, joinName string, sch *schema.Schema) *gorm.DB {

var lastTable string
var relation *schema.Relationship
joins := make([]clause.Join, 0, strings.Count(joinName, ".")+1)
Expand Down
1 change: 0 additions & 1 deletion search.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func (s *Search) Scope(schema *schema.Schema) func(*gorm.DB) *gorm.DB {
searchQuery := tx.Session(&gorm.Session{NewDB: true})

for _, field := range s.Fields {

f, sch, joinName := getField(field, schema, nil)
if f == nil {
continue
Expand Down
2 changes: 0 additions & 2 deletions settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ func ScopeUnpaginated[T any](db *gorm.DB, request *Request, dest *[]T) *gorm.DB
// and process pagination. Returns the resulting `*database.Paginator`.
// The given request is expected to be validated using `ApplyValidation`.
func (s *Settings[T]) Scope(db *gorm.DB, request *Request, dest *[]T) (*database.Paginator[T], error) {

page := request.Page.Default(1)
pageSize := request.PerPage.Default(DefaultPageSize)

Expand Down Expand Up @@ -356,7 +355,6 @@ func getSelectableFields(blacklist *Blacklist, sch *schema.Schema) []*schema.Fie

func selectScope(table string, fields []*schema.Field, override bool) func(*gorm.DB) *gorm.DB {
return func(tx *gorm.DB) *gorm.DB {

if fields == nil {
return tx
}
Expand Down
2 changes: 0 additions & 2 deletions settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2073,13 +2073,11 @@ func TestNewRequest(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(c.desc, func(t *testing.T) {
request := NewRequest(c.query)
assert.Equal(t, c.want, request)
})
}

}

func TestScopeWithCaseInsensitiveSort(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ func TestConvertToSafeType(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("%s_%s", c.value, c.dataType), func(t *testing.T) {
val, ok := ConvertToSafeType(c.value, c.dataType)
assert.Equal(t, c.want, val)
Expand All @@ -235,7 +234,6 @@ func TestConvertToSafeType(t *testing.T) {
}

func TestConvertArgsToSafeType(t *testing.T) {

// No need for exhaustive testing here since it's already done by TestConvertToSafeType
cases := []struct {
want any
Expand All @@ -249,7 +247,6 @@ func TestConvertArgsToSafeType(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("%s_%s", c.value, c.dataType), func(t *testing.T) {
val, ok := ConvertArgsToSafeType(c.value, c.dataType)
assert.Equal(t, c.want, val)
Expand Down Expand Up @@ -384,7 +381,6 @@ func TestGetDataType(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(c.desc, func(t *testing.T) {
model, err := parseModel(openDryRunDB(t), c.model)
if !assert.NoError(t, err) {
Expand Down
8 changes: 0 additions & 8 deletions validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func TestParseJoin(t *testing.T) {
}

func TestValidateFilter(t *testing.T) {

t.Run("Constructor", func(t *testing.T) {
v := &FilterValidator{}
assert.NotNil(t, v)
Expand Down Expand Up @@ -233,7 +232,6 @@ func TestValidateFilter(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("Validate_%v_%t", c.value, c.want), func(t *testing.T) {
v := &FilterValidator{Or: c.or}
ctx := &validation.Context{
Expand All @@ -248,7 +246,6 @@ func TestValidateFilter(t *testing.T) {
}

func TestValidateSort(t *testing.T) {

t.Run("Constructor", func(t *testing.T) {
v := &SortValidator{}
assert.NotNil(t, v)
Expand Down Expand Up @@ -305,7 +302,6 @@ func TestValidateSort(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("Validate_%v_%t", c.value, c.want), func(t *testing.T) {
v := &SortValidator{}
ctx := &validation.Context{
Expand All @@ -320,7 +316,6 @@ func TestValidateSort(t *testing.T) {
}

func TestValidateJoin(t *testing.T) {

t.Run("Constructor", func(t *testing.T) {
v := &JoinValidator{}
assert.NotNil(t, v)
Expand Down Expand Up @@ -372,7 +367,6 @@ func TestValidateJoin(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("Validate_%v_%t", c.value, c.want), func(t *testing.T) {
v := &JoinValidator{}
ctx := &validation.Context{
Expand All @@ -387,7 +381,6 @@ func TestValidateJoin(t *testing.T) {
}

func TestValidateFields(t *testing.T) {

t.Run("Constructor", func(t *testing.T) {
v := &FieldsValidator{}
assert.NotNil(t, v)
Expand Down Expand Up @@ -422,7 +415,6 @@ func TestValidateFields(t *testing.T) {
}

for _, c := range cases {
c := c
t.Run(fmt.Sprintf("Validate_%v_%t", c.value, c.want), func(t *testing.T) {
v := &FieldsValidator{}
ctx := &validation.Context{
Expand Down

0 comments on commit 94036b9

Please sign in to comment.