Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for parser (0.16 sec)

  1. schema/index_test.go

    	Name6        int64  `gorm:"index:profile,comment:hello \\, world,where:age > 10"`
    	Age          int64  `gorm:"index:profile,expression:ABS(age),option:WITH PARSER parser_name"`
    	OID          int64  `gorm:"index:idx_id;index:idx_oid,unique"`
    	MemberNumber string `gorm:"index:idx_id,priority:1"`
    	Name7        string `gorm:"index:type"`
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. schema/index.go

    	Where   string
    	Comment string
    	Option  string        // WITH PARSER parser_name
    	Fields  []IndexOption // Note: IndexOption's Field maybe the same
    }
    
    type IndexOption struct {
    	*Field
    	Expression string
    	Sort       string // DESC, ASC
    	Collate    string
    	Length     int
    	priority   int
    }
    
    // ParseIndexes parse schema indexes
    func (schema *Schema) ParseIndexes() map[string]Index {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  3. 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 Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 939 bytes
    - Viewed (0)
  4. schema/schema_test.go

    func TestParseSchema(t *testing.T) {
    	user, err := schema.Parse(&tests.User{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user, got error %v", err)
    	}
    
    	checkUserSchema(t, user)
    }
    
    func TestParseSchemaWithPointerFields(t *testing.T) {
    	user, err := schema.Parse(&User{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse pointer user, got error %v", err)
    	}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  5. schema/field_test.go

    	Name7 string `gorm:"->:false;<-:create,update"`
    	Name8 string `gorm:"->;-:migration"`
    }
    
    func TestParseFieldWithPermission(t *testing.T) {
    	user, err := schema.Parse(&UserWithPermissionControl{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("Failed to parse user with permission, got error %v", err)
    	}
    
    	fields := []*schema.Field{
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  6. tests/multi_primary_keys_test.go

    	}
    
    	if name := DB.Dialector.Name(); name == "postgres" {
    		stmt := gorm.Statement{DB: DB}
    		stmt.Parse(&Blog{})
    		stmt.Schema.LookUpField("ID").Unique = true
    		stmt.Parse(&Tag{})
    		stmt.Schema.LookUpField("ID").Unique = true
    		// postgers only allow unique constraint matching given keys
    	}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  7. statement.go

    				}
    			}
    		default:
    			reflectValue := reflect.Indirect(reflect.ValueOf(arg))
    			for reflectValue.Kind() == reflect.Ptr {
    				reflectValue = reflectValue.Elem()
    			}
    
    			if s, err := schema.Parse(arg, stmt.DB.cacheStore, stmt.DB.NamingStrategy); err == nil {
    				selectedColumns := map[string]bool{}
    				if idx == 0 {
    					for _, v := range args[1:] {
    						if vs, ok := v.(string); ok {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  8. callbacks/update.go

    		updatingSchema := stmt.Schema
    		var isDiffSchema bool
    		if !updatingValue.CanAddr() || stmt.Dest != stmt.Model {
    			// different schema
    			updatingStmt := &gorm.Statement{DB: stmt.DB}
    			if err := updatingStmt.Parse(stmt.Dest); err == nil {
    				updatingSchema = updatingStmt.Schema
    				isDiffSchema = true
    			}
    		}
    
    		switch updatingValue.Kind() {
    		case reflect.Struct:
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  9. callbacks/preload.go

    	db.Statement.Settings.Range(func(k, v interface{}) bool {
    		tx.Statement.Settings.Store(k, v)
    		return true
    	})
    
    	if err := tx.Statement.Parse(dest); err != nil {
    		tx.AddError(err)
    		return tx
    	}
    	tx.Statement.ReflectValue = reflectValue
    	tx.Statement.Unscoped = db.Statement.Unscoped
    	return tx
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  10. schema/constraint_test.go

    	Name2 string `gorm:"check:name <> 'jinzhu'"`
    	Name3 string `gorm:"check:,name <> 'jinzhu'"`
    }
    
    func TestParseCheck(t *testing.T) {
    	user, err := schema.Parse(&UserCheck{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user check, got error %v", err)
    	}
    
    	results := map[string]schema.CheckConstraint{
    		"name_checker": {
    			Name:       "name_checker",
    			Constraint: "name <> 'jinzhu'",
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
Back to top