Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 60 for Map (0.17 sec)

  1. schema/index_test.go

    	Data2B string `gorm:"index:,unique,composite:comp_id2,priority:3"`
    }
    
    func TestParseIndex(t *testing.T) {
    	user, err := schema.Parse(&UserIndex{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user index, got error %v", err)
    	}
    
    	results := map[string]schema.Index{
    		"idx_user_indices_name": {
    			Name:   "idx_user_indices_name",
    			Fields: []schema.IndexOption{{Field: &schema.Field{Name: "Name"}}},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. prepare_stmt.go

    	prepared    chan struct{}
    	prepareErr  error
    }
    
    type PreparedStmtDB struct {
    	Stmts       map[string]*Stmt
    	PreparedSQL []string
    	Mux         *sync.RWMutex
    	ConnPool
    }
    
    func NewPreparedStmtDB(connPool ConnPool) *PreparedStmtDB {
    	return &PreparedStmtDB{
    		ConnPool:    connPool,
    		Stmts:       make(map[string]*Stmt),
    		Mux:         &sync.RWMutex{},
    		PreparedSQL: make([]string, 0, 100),
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  3. schema/index.go

    	*Field
    	Expression string
    	Sort       string // DESC, ASC
    	Collate    string
    	Length     int
    	priority   int
    }
    
    // ParseIndexes parse schema indexes
    func (schema *Schema) ParseIndexes() map[string]Index {
    	indexes := map[string]Index{}
    
    	for _, field := range schema.Fields {
    		if field.TagSettings["INDEX"] != "" || field.TagSettings["UNIQUEINDEX"] != "" {
    			fieldIndexes, err := parseFieldIndexes(field)
    			if err != nil {
    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)
  4. schema/callbacks_test.go

    	return nil
    }
    
    func (UserWithCallback) AfterCreate(*gorm.DB) error {
    	return nil
    }
    
    func TestCallback(t *testing.T) {
    	user, err := schema.Parse(&UserWithCallback{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user with callback, got error %v", err)
    	}
    
    	for _, str := range []string{"BeforeSave", "AfterCreate"} {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 939 bytes
    - Viewed (0)
  5. tests/migrate_test.go

    		t.Fatalf("Failed to find has one constraint between people and managers")
    	}
    }
    
    func TestSmartMigrateColumn(t *testing.T) {
    	fullSupported := map[string]bool{"mysql": true, "postgres": true}[DB.Dialector.Name()]
    
    	type UserMigrateColumn struct {
    		ID       uint
    		Name     string
    		Salary   float64
    		Birthday time.Time `gorm:"precision:4"`
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  6. tests/scanner_valuer_test.go

    	}
    
    	if !reflect.DeepEqual([]interface{}{"jinzhu", "POINT(100 100)"}, stmt.Vars) {
    		t.Errorf("generated vars is not equal, got %v", stmt.Vars)
    	}
    
    	stmt = dryRunDB.Model(UserWithPoint{}).Create(map[string]interface{}{
    		"Name":  "jinzhu",
    		"Point": clause.Expr{SQL: "ST_PointFromText(?)", Vars: []interface{}{"POINT(100 100)"}},
    	}).Statement
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  7. tests/scan_test.go

    		return strings.Compare(results[i].Name, results[j].Name) <= -1
    	})
    
    	if len(results) != 2 || results[0].Name != user2.Name || results[1].Name != user3.Name {
    		t.Errorf("Scan into struct map, got %#v", results)
    	}
    
    	type ID uint64
    	var id ID
    	DB.Raw("select id from users where id = ?", user2.ID).Scan(&id)
    	if uint(id) != user2.ID {
    		t.Errorf("Failed to scan to customized data type")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  8. schema/schema_test.go

    		{Name: "Name", DBName: "company_name", BindNames: []string{"Base", "Name"}, DataType: schema.String, TagSettings: map[string]string{"EMBEDDED": "EMBEDDED", "EMBEDDEDPREFIX": "company_"}},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  9. callbacks/preload.go

    //		"k4": {
    //			"k5.k6": {"arg4"},
    //		},
    //	}
    func parsePreloadMap(s *schema.Schema, preloads map[string][]interface{}) map[string]map[string][]interface{} {
    	preloadMap := map[string]map[string][]interface{}{}
    	setPreloadMap := func(name, value string, args []interface{}) {
    		if _, ok := preloadMap[name]; !ok {
    			preloadMap[name] = map[string][]interface{}{}
    		}
    		if value != "" {
    			preloadMap[name][value] = args
    		}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. callbacks/helper.go

    package callbacks
    
    import (
    	"reflect"
    	"sort"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    )
    
    // ConvertMapToValuesForCreate convert map to values
    func ConvertMapToValuesForCreate(stmt *gorm.Statement, mapValue map[string]interface{}) (values clause.Values) {
    	values.Columns = make([]clause.Column, 0, len(mapValue))
    	selectColumns, restricted := stmt.SelectAndOmitColumns(true, false)
    
    	keys := make([]string, 0, len(mapValue))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 14 12:32:57 GMT 2022
    - 3.7K bytes
    - Viewed (0)
Back to top