Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for Key (0.16 sec)

  1. tests/create_test.go

    	}
    
    	jt := JoinTable{UserID: 1, FriendID: 2}
    	err := DB.Create(&jt).Error
    	if err != nil {
    		t.Errorf("No error should happen when create a record without a GORM primary key. But in the database this primary key exists and is the union of 2 or more fields\n But got: %s", err)
    	}
    }
    
    func TestSelectWithCreate(t *testing.T) {
    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. schema/relationship_test.go

    		},
    	})
    }
    
    func TestMany2ManyWithMultiPrimaryKeys(t *testing.T) {
    	type Tag struct {
    		ID     uint   `gorm:"primary_key"`
    		Locale string `gorm:"primary_key"`
    		Value  string
    	}
    
    	type Blog struct {
    		ID         uint   `gorm:"primary_key"`
    		Locale     string `gorm:"primary_key"`
    		Subject    string
    		Body       string
    		Tags       []Tag `gorm:"many2many:blog_tags;"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  3. errors.go

    	// ErrDuplicatedKey occurs when there is a unique key constraint violation
    	ErrDuplicatedKey = errors.New("duplicated key not allowed")
    	// ErrForeignKeyViolated occurs when there is a foreign key constraint violation
    	ErrForeignKeyViolated = errors.New("violates foreign key constraint")
    	// ErrCheckConstraintViolated occurs when there is a check constraint violation
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 02:53:17 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  4. schema/naming_test.go

    	}
    
    	ns := NamingStrategy{}
    	for key, value := range maps {
    		if ns.toDBName(key) != value {
    			t.Errorf("%v toName should equal %v, but got %v", key, value, ns.toDBName(key))
    		}
    	}
    
    	maps = map[string]string{
    		"x":                              "X",
    		"user_restrictions":              "UserRestriction",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
  5. .github/workflows/tests.yml

        - name: Check out code into the Go module directory
          uses: actions/checkout@v4
    
        - name: go mod package cache
          uses: actions/cache@v4
          with:
            path: ~/go/pkg/mod
            key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
    
        - name: Tests
          run: GITHUB_ACTION=true GORM_DIALECT=sqlite ./tests/tests_all.sh
    
      mysql:
        strategy:
          matrix:
    Others
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 02:34:20 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  6. tests/table_test.go

    		}
    
    		constraints := user.ParseUniqueConstraints()
    		if len(constraints) != 1 {
    			t.Fatalf("failed to find unique constraint, got %v", constraints)
    		}
    
    		for key := range constraints {
    			if len(key) != 63 {
    				t.Errorf("failed to find unique constraint, got %v", constraints)
    			}
    		}
    	})
    
    	t.Run("naming strategy", func(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  7. clause/clause.go

    		}
    
    		c.Expression.Build(builder)
    
    		if c.AfterExpression != nil {
    			builder.WriteByte(' ')
    			c.AfterExpression.Build(builder)
    		}
    	}
    }
    
    const (
    	PrimaryKey   string = "~~~py~~~" // primary key
    	CurrentTable string = "~~~ct~~~" // current table
    	Associations string = "~~~as~~~" // associations
    )
    
    var (
    	currentTable  = Table{Name: CurrentTable}
    	PrimaryColumn = Column{Table: CurrentTable, Name: PrimaryKey}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Feb 02 09:15:08 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  8. finisher_api.go

    	"errors"
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Create inserts value, returning the inserted data's primary key in value's id
    func (db *DB) Create(value interface{}) (tx *DB) {
    	if db.CreateBatchSize > 0 {
    		return db.CreateInBatches(value, db.CreateBatchSize)
    	}
    
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  9. tests/main_test.go

    		t.Errorf("Should be able to get setting after set")
    	} else if value.(string) != "world" {
    		t.Errorf("Set value should not be changed")
    	}
    
    	if _, ok := DB.Get("non_existing"); ok {
    		t.Errorf("Get non existing key should return error")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  10. migrator/column_type.go

    func (ct ColumnType) ColumnType() (columnType string, ok bool) {
    	return ct.ColumnTypeValue.String, ct.ColumnTypeValue.Valid
    }
    
    // PrimaryKey returns the column is primary key or not.
    func (ct ColumnType) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return ct.PrimaryKeyValue.Bool, ct.PrimaryKeyValue.Valid
    }
    
    // AutoIncrement returns the column is auto increment or not.
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 3.3K bytes
    - Viewed (0)
Back to top