Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 231 for utils (0.19 sec)

  1. scan.go

    package gorm
    
    import (
    	"database/sql"
    	"database/sql/driver"
    	"reflect"
    	"time"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // prepareValues prepare values slice
    func prepareValues(values []interface{}, db *DB, columnTypes []*sql.ColumnType, columns []string) {
    	if db.Statement.Schema != nil {
    		for idx, name := range columns {
    			if field := db.Statement.Schema.LookUpField(name); field != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  2. callbacks/preload.go

    			}
    
    			for idx, field := range joinRelForeignFields {
    				joinFieldValues[idx], _ = field.ValueOf(tx.Statement.Context, joinIndexValue)
    			}
    
    			if results, ok := joinIdentityMap[utils.ToStringKey(fieldValues...)]; ok {
    				joinKey := utils.ToStringKey(joinFieldValues...)
    				identityMap[joinKey] = append(identityMap[joinKey], results...)
    			}
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  3. clause/clause_test.go

    package clause_test
    
    import (
    	"reflect"
    	"strings"
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    var db, _ = gorm.Open(tests.DummyDialector{}, nil)
    
    func checkBuildClauses(t *testing.T, clauses []clause.Interface, result string, vars []interface{}) {
    	var (
    		buildNames    []string
    		buildNamesMap = map[string]bool{}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Jun 02 02:50:38 GMT 2020
    - 1012 bytes
    - Viewed (0)
  4. association.go

    package gorm
    
    import (
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Association Mode contains some helper methods to handle relationship things easily.
    type Association struct {
    	DB           *DB
    	Relationship *schema.Relationship
    	Unscope      bool
    	Error        error
    }
    
    func (db *DB) Association(column string) *Association {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  5. statement.go

    			if mv, mok := stmt.Dest.(map[string]interface{}); mok {
    				if fv, ok := mv[field.Name]; ok {
    					return !utils.AssertEqual(fv, fieldValue)
    				} else if fv, ok := mv[field.DBName]; ok {
    					return !utils.AssertEqual(fv, fieldValue)
    				}
    			} else {
    				destValue := reflect.ValueOf(stmt.Dest)
    				for destValue.Kind() == reflect.Ptr {
    					destValue = destValue.Elem()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  6. schema/constraint_test.go

    package schema_test
    
    import (
    	"reflect"
    	"sync"
    	"testing"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    type UserCheck struct {
    	Name  string `gorm:"check:name_checker,name <> 'jinzhu'"`
    	Name2 string `gorm:"check:name <> 'jinzhu'"`
    	Name3 string `gorm:"check:,name <> 'jinzhu'"`
    }
    
    func TestParseCheck(t *testing.T) {
    	user, err := schema.Parse(&UserCheck{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  7. tests/update_has_many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateHasManyAssociations(t *testing.T) {
    	user := *GetUser("update-has-many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Pets = []*Pet{{Name: "pet1"}, {Name: "pet2"}}
    	if err := DB.Save(&user).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2K bytes
    - Viewed (0)
  8. logger/logger.go

    		if rows == -1 {
    			l.Printf(l.traceWarnStr, utils.FileWithLineNum(), slowLog, float64(elapsed.Nanoseconds())/1e6, "-", sql)
    		} else {
    			l.Printf(l.traceWarnStr, utils.FileWithLineNum(), slowLog, float64(elapsed.Nanoseconds())/1e6, rows, sql)
    		}
    	case l.LogLevel == Info:
    		sql, rows := fc()
    		if rows == -1 {
    			l.Printf(l.traceStr, utils.FileWithLineNum(), float64(elapsed.Nanoseconds())/1e6, "-", sql)
    		} else {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  9. tests/update_many2many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateMany2ManyAssociations(t *testing.T) {
    	user := *GetUser("update-many2many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Languages = []Language{{Code: "zh-CN", Name: "Chinese"}, {Code: "en", Name: "English"}}
    	for _, lang := range user.Languages {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  10. tests/benchmark_test.go

    package tests_test
    
    import (
    	"fmt"
    	"testing"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    func BenchmarkCreate(b *testing.B) {
    	user := *GetUser("bench", Config{})
    
    	for x := 0; x < b.N; x++ {
    		user.ID = 0
    		DB.Create(&user)
    	}
    }
    
    func BenchmarkFind(b *testing.B) {
    	user := *GetUser("find", Config{})
    	DB.Create(&user)
    
    	for x := 0; x < b.N; x++ {
    		DB.Find(&User{}, "id = ?", user.ID)
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 01 03:50:57 GMT 2022
    - 1.5K bytes
    - Viewed (0)
Back to top