Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for Muto (0.34 sec)

  1. tests/embedded_struct_test.go

    		ImageUrl string
    	}
    
    	DB.Migrator().DropTable(&HNPost{}, &EngadgetPost{})
    	if err := DB.Migrator().AutoMigrate(&HNPost{}, &EngadgetPost{}); err != nil {
    		t.Fatalf("failed to auto migrate, got error: %v", err)
    	}
    
    	for _, name := range []string{"author_id", "author_name", "author_email"} {
    		if !DB.Migrator().HasColumn(&EngadgetPost{}, name) {
    			t.Errorf("should has prefixed column %v", name)
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  2. tests/create_test.go

    	type EmptyStruct struct {
    		ID uint
    	}
    	DB.Migrator().DropTable(&EmptyStruct{})
    
    	if err := DB.AutoMigrate(&EmptyStruct{}); err != nil {
    		t.Errorf("no error should happen when auto migrate, but got %v", err)
    	}
    
    	if err := DB.Create(&EmptyStruct{}).Error; err != nil {
    		t.Errorf("No error should happen when creating user, but got %v", err)
    	}
    }
    
    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)
  3. migrator/migrator.go

    	execTx = queryTx
    	if m.DB.DryRun {
    		queryTx.DryRun = false
    		execTx = m.DB.Session(&gorm.Session{Logger: &printSQLLogger{Interface: m.DB.Logger}})
    	}
    	return queryTx, execTx
    }
    
    // AutoMigrate auto migrate values
    func (m Migrator) AutoMigrate(values ...interface{}) error {
    	for _, value := range m.ReorderModels(values, true) {
    		queryTx, execTx := m.GetQueryAndExecTx()
    		if !queryTx.Migrator().HasTable(value) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  4. tests/migrate_test.go

    	if err := DB.AutoMigrate(&MigrateInt{}); err != nil {
    		t.Fatalf("Failed to auto migrate: error: %v", err)
    	}
    
    	// make new session to set custom logger tracer
    	session := DB.Session(&gorm.Session{Logger: tracer})
    
    	// The second AutoMigrate to catch an error
    	if err := session.AutoMigrate(&MigrateInt{}); err != nil {
    		t.Fatalf("Failed to auto migrate: error: %v", err)
    	}
    }
    
    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)
  5. migrator.go

    	tx := db.getInstance()
    
    	// apply scopes to migrator
    	for len(tx.Statement.scopes) > 0 {
    		tx = tx.executeScopes()
    	}
    
    	return tx.Dialector.Migrator(tx.Session(&Session{}))
    }
    
    // AutoMigrate run auto migration for given models
    func (db *DB) AutoMigrate(dst ...interface{}) error {
    	return db.Migrator().AutoMigrate(dst...)
    }
    
    // ViewOption view option
    type ViewOption struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  6. callbacks/create.go

    			}
    			pkField = db.Statement.Schema.PrioritizedPrimaryField
    			pkFieldName = db.Statement.Schema.PrioritizedPrimaryField.DBName
    		}
    
    		// append @id column with value for auto-increment primary key
    		// the @id value is correct, when: 1. without setting auto-increment primary key, 2. database AutoIncrementIncrement = 1
    		switch values := db.Statement.Dest.(type) {
    		case map[string]interface{}:
    			values[pkFieldName] = insertID
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  7. README.md

    * Context, Prepared Statement Mode, DryRun Mode
    * Batch Insert, FindInBatches, Find To Map
    * SQL Builder, Upsert, Locking, Optimizer/Index/Comment Hints, NamedArg, Search/Update/Create with SQL Expr
    * Composite Primary Key
    * Auto Migrations
    * Logger
    * Extendable, flexible plugin API: Database Resolver (Multiple Databases, Read/Write Splitting) / Prometheus…
    * Every feature comes with tests
    * Developer Friendly
    
    ## Getting Started
    
    Plain Text
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:20:06 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  8. tests/tests_test.go

    	if err = DB.Migrator().DropTable(allModels...); err != nil {
    		log.Printf("Failed to drop table, got error %v\n", err)
    		os.Exit(1)
    	}
    
    	if err = DB.AutoMigrate(allModels...); err != nil {
    		log.Printf("Failed to auto migrate, but got error %v\n", err)
    		os.Exit(1)
    	}
    
    	for _, m := range allModels {
    		if !DB.Migrator().HasTable(m) {
    			log.Printf("Failed to create table for %#v\n", m)
    			os.Exit(1)
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 3.3K bytes
    - Viewed (1)
  9. schema/relationship.go

    	conds = append(conds, clause.IN{Column: column, Values: values})
    	return
    }
    
    func copyableDataType(str DataType) bool {
    	for _, s := range []string{"auto_increment", "primary key"} {
    		if strings.Contains(strings.ToLower(string(str)), s) {
    			return false
    		}
    	}
    	return true
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
Back to top