Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 52 for from (0.18 sec)

  1. 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)
  2. 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)
  3. 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)
  4. chainable_api.go

    	}
    	return
    }
    
    // Distinct specify distinct fields that you want querying
    //
    //	// Select distinct names of users
    //	db.Distinct("name").Find(&results)
    //	// Select distinct name/age pairs from users
    //	db.Distinct("name", "age").Find(&results)
    func (db *DB) Distinct(args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Distinct = true
    	if len(args) > 0 {
    		tx = tx.Select(args[0], args[1:]...)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  5. clause/order_by_test.go

    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.OrderBy{
    				Columns: []clause.OrderByColumn{{Column: clause.PrimaryColumn, Desc: true}},
    			}},
    			"SELECT * FROM `users` ORDER BY `users`.`id` DESC", nil,
    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{}, clause.OrderBy{
    					Columns: []clause.OrderByColumn{{Column: clause.PrimaryColumn, Desc: true}},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  6. tests/postgres_test.go

    	Name int
    }
    
    func TestAlterColumnDataType(t *testing.T) {
    	DB.AutoMigrate(Company{})
    
    	if err := DB.Table("companies").Migrator().AlterColumn(CompanyNew{}, "name"); err != nil {
    		t.Fatalf("failed to alter column from string to int, got error %v", err)
    	}
    
    	DB.AutoMigrate(Company{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  7. clause/returning_test.go

    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Returning{
    				[]clause.Column{clause.PrimaryColumn},
    			}},
    			"SELECT * FROM `users` RETURNING `users`.`id`", nil,
    		}, {
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Returning{
    				[]clause.Column{clause.PrimaryColumn},
    			}, clause.Returning{
    				[]clause.Column{{Name: "name"}, {Name: "age"}},
    			}},
    			"SELECT * FROM `users` RETURNING `users`.`id`,`name`,`age`", nil,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Jun 02 01:18:01 GMT 2020
    - 845 bytes
    - Viewed (0)
  8. callbacks/callbacks.go

    package callbacks
    
    import (
    	"gorm.io/gorm"
    )
    
    var (
    	createClauses = []string{"INSERT", "VALUES", "ON CONFLICT"}
    	queryClauses  = []string{"SELECT", "FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", "FOR"}
    	updateClauses = []string{"UPDATE", "SET", "WHERE"}
    	deleteClauses = []string{"DELETE", "FROM", "WHERE"}
    )
    
    type Config struct {
    	LastInsertIDReversed bool
    	CreateClauses        []string
    	QueryClauses         []string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 3.3K bytes
    - Viewed (0)
  9. utils/tests/dummy_dialecter.go

    		CreateClauses:        []string{"INSERT", "VALUES", "ON CONFLICT", "RETURNING"},
    		UpdateClauses:        []string{"UPDATE", "SET", "WHERE", "RETURNING"},
    		DeleteClauses:        []string{"DELETE", "FROM", "WHERE", "RETURNING"},
    		LastInsertIDReversed: true,
    	})
    
    	return nil
    }
    
    func (DummyDialector) DefaultValueOf(field *schema.Field) clause.Expression {
    	return clause.Expr{SQL: "DEFAULT"}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 06 06:03:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  10. tests/preload_test.go

    	if err != nil {
    		t.Fatalf("failed to preload and find users: %v", err)
    	}
    
    	AssertEqual(t, result, users)
    	AssertEqual(t, len(query), 2) // Check preload queries are merged
    
    	if !regexp.MustCompile(`SELECT \* FROM .*tools.* WHERE .*IN.*`).MatchString(query[0]) {
    		t.Fatalf("Expected first query to preload manager tools, got: %s", query[0])
    	}
    }
    
    func TestEmbedPreload(t *testing.T) {
    	type Country struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
Back to top