Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 69 for pool (0.15 sec)

  1. schema/pool.go

    package schema
    
    import (
    	"reflect"
    	"sync"
    )
    
    // sync pools
    var (
    	normalPool      sync.Map
    	poolInitializer = func(reflectType reflect.Type) FieldNewValuePool {
    		v, _ := normalPool.LoadOrStore(reflectType, &sync.Pool{
    			New: func() interface{} {
    				return reflect.New(reflectType).Interface()
    			},
    		})
    		return v.(FieldNewValuePool)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 11 13:37:44 GMT 2022
    - 345 bytes
    - Viewed (0)
  2. scan.go

    			}
    
    			if !isNilPtrValue { // ignore if value is nil
    				f := joinFields[idx][len(joinFields[idx])-1]
    				db.AddError(f.Set(db.Statement.Context, relValue, values[idx]))
    			}
    		}
    
    		// release data to pool
    		field.NewValuePool.Put(values[idx])
    	}
    }
    
    // ScanMode scan data mode
    type ScanMode uint8
    
    // scan modes
    const (
    	ScanInitialized         ScanMode = 1 << 0 // 1
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  3. schema/interfaces.go

    	Build() (sql string, vars []interface{})
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDataType() string
    }
    
    // FieldNewValuePool field new scan value pool
    type FieldNewValuePool interface {
    	Get() interface{}
    	Put(interface{})
    }
    
    // CreateClausesInterface create clauses interface
    type CreateClausesInterface interface {
    	CreateClauses(*Field) []clause.Interface
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 980 bytes
    - Viewed (0)
  4. finisher_api.go

    	}
    	Scan(rows, tx, ScanInitialized)
    	return tx.Error
    }
    
    // Connection uses a db connection to execute an arbitrary number of commands in fc. When finished, the connection is
    // returned to the connection pool.
    func (db *DB) Connection(fc func(tx *DB) error) (err error) {
    	if db.Error != nil {
    		return db.Error
    	}
    
    	tx := db.getInstance()
    	sqlDB, err := tx.DB()
    	if err != nil {
    		return
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  5. callbacks.go

    	db        *DB
    	Clauses   []string
    	fns       []func(*DB)
    	callbacks []*callback
    }
    
    type callback struct {
    	name      string
    	before    string
    	after     string
    	remove    bool
    	replace   bool
    	match     func(*DB) bool
    	handler   func(*DB)
    	processor *processor
    }
    
    func (cs *callbacks) Create() *processor {
    	return cs.processors["create"]
    }
    
    func (cs *callbacks) Query() *processor {
    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)
  6. callbacks/helper_test.go

    package callbacks
    
    import (
    	"reflect"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    )
    
    func TestLoadOrStoreVisitMap(t *testing.T) {
    	var vm visitMap
    	var loaded bool
    	type testM struct {
    		Name string
    	}
    
    	t1 := testM{Name: "t1"}
    	t2 := testM{Name: "t2"}
    	t3 := testM{Name: "t3"}
    
    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  7. 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])
    	}
    }
    
    func TestJoinConds(t *testing.T) {
    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)
  8. tests/count_test.go

    		t.Fatalf(fmt.Sprintf("Count should work, but got err %v", err))
    	}
    
    	expects := []User{{Name: "main"}, {Name: "other"}, {Name: "other"}}
    	sort.SliceStable(users, func(i, j int) bool {
    		return strings.Compare(users[i].Name, users[j].Name) < 0
    	})
    
    	AssertEqual(t, users, expects)
    
    	var count7 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)
  9. callbacks/visit_map_test.go

    package callbacks
    
    import (
    	"reflect"
    	"testing"
    )
    
    func TestLoadOrStoreVisitMap(t *testing.T) {
    	var vm visitMap
    	var loaded bool
    	type testM struct {
    		Name string
    	}
    
    	t1 := testM{Name: "t1"}
    	t2 := testM{Name: "t2"}
    	t3 := testM{Name: "t3"}
    
    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    		t.Fatalf("loaded should be false")
    	}
    
    Go
    - Registered: Sun Feb 25 09:35:10 GMT 2024
    - Last Modified: Thu Mar 17 15:53:31 GMT 2022
    - 780 bytes
    - Viewed (0)
  10. clause/set_test.go

    func TestAssignments(t *testing.T) {
    	set := clause.Assignments(map[string]interface{}{
    		"name": "jinzhu",
    		"age":  18,
    	})
    
    	assignments := []clause.Assignment(set)
    
    	sort.Slice(assignments, func(i, j int) bool {
    		return strings.Compare(assignments[i].Column.Name, assignments[j].Column.Name) > 0
    	})
    
    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)
Back to top