Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 27 for from (0.15 sec)

  1. tests/create_test.go

    		t.Fatalf("failed to create data from map, got error: %v", err)
    	}
    
    	var result1 User
    	if err := DB.Where("name = ?", "create_from_map_1").First(&result1).Error; err != nil || result1.Age != 18 {
    		t.Fatalf("failed to create from map, got error %v", err)
    	}
    
    	datas := []map[string]interface{}{
    		{"Name": "create_from_map_2", "Age": 19},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  2. tests/connpool_test.go

    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  3. callbacks.go

    	c.processor.db.Logger.Warn(context.Background(), "removing callback `%s` from %s\n", name, utils.FileWithLineNum())
    	c.name = name
    	c.remove = true
    	c.processor.callbacks = append(c.processor.callbacks, c)
    	return c.processor.compile()
    }
    
    func (c *callback) Replace(name string, fn func(*DB)) error {
    	c.processor.db.Logger.Info(context.Background(), "replacing callback `%s` from %s\n", name, utils.FileWithLineNum())
    	c.name = name
    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)
  4. tests/count_test.go

    	if !regexp.MustCompile(`SELECT COUNT\(.name.\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Table("users").Distinct("name").Count(&count)
    	if !regexp.MustCompile(`SELECT COUNT\(DISTINCT\(.name.\)\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    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. migrator/migrator.go

    }
    
    // CreateView create view from Query in gorm.ViewOption.
    // Query in gorm.ViewOption is a [subquery]
    //
    //	// CREATE VIEW `user_view` AS SELECT * FROM `users` WHERE age > 20
    //	q := DB.Model(&User{}).Where("age > ?", 20)
    //	DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q})
    //
    //	// CREATE OR REPLACE VIEW `users_view` AS SELECT * FROM `users` WITH CHECK OPTION
    //	q := DB.Model(&User{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  6. tests/scopes_test.go

    					func(d *gorm.DB) *gorm.DB { return d.Where("a = 1") },
    					func(d *gorm.DB) *gorm.DB {
    						return d.Where(DB.Or("b = 2").Or("c = 3"))
    					},
    				).Find(&Language{})
    			},
    			expected: `SELECT * FROM "languages" WHERE a = 1 AND (b = 2 OR c = 3)`,
    		}, {
    			name: "depth_1_pre_cond",
    			queryFn: func(tx *gorm.DB) *gorm.DB {
    				return tx.Where("z = 0").Scopes(
    					func(d *gorm.DB) *gorm.DB { return d.Where("a = 1") },
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  7. callbacks/query.go

    						clauseSelect.Columns[idx] = clause.Column{Table: db.Statement.Table, Name: dbName}
    					}
    				}
    			}
    		}
    
    		// inline joins
    		fromClause := clause.From{}
    		if v, ok := db.Statement.Clauses["FROM"].Expression.(clause.From); ok {
    			fromClause = v
    		}
    
    		if len(db.Statement.Joins) != 0 || len(fromClause.Joins) != 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  8. utils/utils.go

    		s = dir
    	}
    	return filepath.ToSlash(s) + "/"
    }
    
    // FileWithLineNum return the file name and line number of the current file
    func FileWithLineNum() string {
    	pcs := [13]uintptr{}
    	// the third caller usually from gorm internal
    	len := runtime.Callers(3, pcs[:])
    	frames := runtime.CallersFrames(pcs[:len])
    	for i := 0; i < len; i++ {
    		// second return value is "more", not "ok"
    		frame, _ := frames.Next()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  9. logger/sql.go

    		sql = numericPlaceholderRe.ReplaceAllStringFunc(sql, func(v string) string {
    			num := v[1 : len(v)-1]
    			n, _ := strconv.Atoi(num)
    
    			// position var start from 1 ($1, $2)
    			n -= 1
    			if n >= 0 && n <= len(vars)-1 {
    				return vars[n]
    			}
    			return v
    		})
    	}
    
    	return sql
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  10. schema/naming.go

    func (ns NamingStrategy) TableName(str string) string {
    	if ns.SingularTable {
    		return ns.TablePrefix + ns.toDBName(str)
    	}
    	return ns.TablePrefix + inflection.Plural(ns.toDBName(str))
    }
    
    // SchemaName generate schema name from table name, don't guarantee it is the reverse value of TableName
    func (ns NamingStrategy) SchemaName(table string) string {
    	table = strings.TrimPrefix(table, ns.TablePrefix)
    
    	if ns.SingularTable {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
Back to top