Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for sortBy (0.17 sec)

  1. callbacks.go

    			if c.after == "*" && len(sorted) > 0 {
    				if curIdx := getRIndex(sorted, c.name); curIdx == -1 {
    					sorted = append(sorted, c.name)
    				}
    			} else if sortedIdx := getRIndex(sorted, c.after); sortedIdx != -1 {
    				if curIdx := getRIndex(sorted, c.name); curIdx == -1 {
    					// if after callback sorted, append current callback to last
    					sorted = append(sorted, c.name)
    				} else if curIdx < sortedIdx {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  2. clause/set_test.go

    package clause_test
    
    import (
    	"fmt"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestSet(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{
    				clause.Update{},
    				clause.Set([]clause.Assignment{{clause.PrimaryColumn, 1}}),
    			},
    			"UPDATE `users` SET `users`.`id`=?",
    			[]interface{}{1},
    		},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  3. tests/joins_test.go

    	} else if len(users2) != len(users) {
    		t.Fatalf("Failed to load join users, got: %v, expect: %v", len(users2), len(users))
    	}
    
    	sort.Slice(users2, func(i, j int) bool {
    		return users2[i].ID > users2[j].ID
    	})
    
    	sort.Slice(users, func(i, j int) bool {
    		return users[i].ID > users[j].ID
    	})
    
    	for idx, user := range users {
    		CheckUser(t, user, users2[idx])
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  4. tests/count_test.go

    package tests_test
    
    import (
    	"fmt"
    	"regexp"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCountWithGroup(t *testing.T) {
    	DB.Create([]Company{
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_b"},
    		{Name: "company_count_group_c"},
    	})
    
    	var count1 int64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  5. clause/set.go

    package clause
    
    import "sort"
    
    type Set []Assignment
    
    type Assignment struct {
    	Column Column
    	Value  interface{}
    }
    
    func (set Set) Name() string {
    	return "SET"
    }
    
    func (set Set) Build(builder Builder) {
    	if len(set) > 0 {
    		for idx, assignment := range set {
    			if idx > 0 {
    				builder.WriteByte(',')
    			}
    			builder.WriteQuoted(assignment.Column)
    			builder.WriteByte('=')
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Nov 29 03:02:44 GMT 2021
    - 1.4K bytes
    - Viewed (0)
  6. migrator/migrator.go

    			str = opt.Expression
    		} else if opt.Length > 0 {
    			str += fmt.Sprintf("(%d)", opt.Length)
    		}
    
    		if opt.Collate != "" {
    			str += " COLLATE " + opt.Collate
    		}
    
    		if opt.Sort != "" {
    			str += " " + opt.Sort
    		}
    		results = append(results, clause.Expr{SQL: str})
    	}
    	return
    }
    
    // BuildIndexOptionsInterface build index options interface
    type BuildIndexOptionsInterface interface {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  7. tests/preload_suits_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"encoding/json"
    	"reflect"
    	"sort"
    	"sync/atomic"
    	"testing"
    
    	"gorm.io/gorm"
    )
    
    func toJSONString(v interface{}) []byte {
    	r, _ := json.Marshal(v)
    	return r
    }
    
    func TestNestedPreload1(t *testing.T) {
    	type (
    		Level1 struct {
    			ID       uint
    			Value    string
    			Level2ID uint
    		}
    		Level2 struct {
    			ID       uint
    			Level1   Level1
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  8. tests/helper_test.go

    		if len(user.Pets) != len(expect.Pets) {
    			t.Fatalf("pets should equal, expect: %v, got %v", len(expect.Pets), len(user.Pets))
    		}
    
    		sort.Slice(user.Pets, func(i, j int) bool {
    			return user.Pets[i].ID > user.Pets[j].ID
    		})
    
    		sort.Slice(expect.Pets, func(i, j int) bool {
    			return expect.Pets[i].ID > expect.Pets[j].ID
    		})
    
    		for idx, pet := range user.Pets {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  9. schema/index.go

    					Where:   settings["WHERE"],
    					Comment: settings["COMMENT"],
    					Option:  settings["OPTION"],
    					Fields: []IndexOption{{
    						Field:      field,
    						Expression: settings["EXPRESSION"],
    						Sort:       settings["SORT"],
    						Collate:    settings["COLLATE"],
    						Length:     length,
    						priority:   priority,
    					}},
    				})
    			}
    		}
    	}
    
    	err = nil
    	return
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  10. tests/update_test.go

    	result.Friends = append(user.Friends, result.Friends...)
    
    	sort.Slice(result.Pets, func(i, j int) bool {
    		return result.Pets[i].ID < result.Pets[j].ID
    	})
    	sort.Slice(result.Team, func(i, j int) bool {
    		return result.Team[i].ID < result.Team[j].ID
    	})
    	sort.Slice(result.Friends, func(i, j int) bool {
    		return result.Friends[i].ID < result.Friends[j].ID
    	})
    	sort.Slice(result2.Pets, func(i, j int) bool {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
Back to top