Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 66 for uniques (0.16 sec)

  1. schema/constraint.go

    	return "CONSTRAINT ? UNIQUE (?)", []interface{}{clause.Column{Name: uni.Name}, clause.Column{Name: uni.Field.DBName}}
    }
    
    // ParseUniqueConstraints parse schema unique constraints
    func (schema *Schema) ParseUniqueConstraints() map[string]UniqueConstraint {
    	uniques := make(map[string]UniqueConstraint)
    	for _, field := range schema.Fields {
    		if field.Unique {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  2. schema/constraint_test.go

    	type UserUnique struct {
    		Name1 string `gorm:"unique"`
    		Name2 string `gorm:"uniqueIndex"`
    	}
    
    	user, err := schema.Parse(&UserUnique{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse user unique, got error %v", err)
    	}
    	constraints := user.ParseUniqueConstraints()
    
    	results := map[string]schema.UniqueConstraint{
    		"uni_user_uniques_name1": {
    			Name:  "uni_user_uniques_name1",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  3. migrator/index.go

    // PrimaryKey returns the index is primary key or not.
    func (idx Index) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return idx.PrimaryKeyValue.Bool, idx.PrimaryKeyValue.Valid
    }
    
    // Unique returns whether the index is unique or not.
    func (idx Index) Unique() (unique bool, ok bool) {
    	return idx.UniqueValue.Bool, idx.UniqueValue.Valid
    }
    
    // Option return the optional attribute of the index
    func (idx Index) Option() string {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 02:32:46 GMT 2023
    - 1023 bytes
    - Viewed (0)
  4. migrator/migrator.go

    	unique, ok := columnType.Unique()
    	if !ok || field.PrimaryKey {
    		return nil // skip primary key
    	}
    	// By default, ColumnType's Unique is not affected by UniqueIndex, so we don't care about UniqueIndex.
    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		// We're currently only receiving boolean values on `Unique` tag,
    		// so the UniqueConstraint name is fixed
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. tests/hooks_test.go

    	DB.Migrator().DropTable(&Product{})
    	DB.AutoMigrate(&Product{})
    
    	p := Product{Code: "unique_code", Price: 100}
    	DB.Save(&p)
    
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 1, 0, 0, 0, 0}) {
    		t.Fatalf("Callbacks should be invoked successfully, %v", p.GetCallTimes())
    	}
    
    	DB.Where("Code = ?", "unique_code").First(&p)
    	if !reflect.DeepEqual(p.GetCallTimes(), []int64{1, 1, 0, 1, 0, 0, 0, 0, 1}) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  6. internal/crypto/doc.go

    // with customer provided keys (SSE-C).
    //
    // All objects are encrypted with an unique and randomly generated 'ObjectKey'.
    // The ObjectKey itself is never stored in plaintext. Instead it is only stored
    // in a sealed from. The sealed 'ObjectKey' is created by encrypting the 'ObjectKey'
    // with an unique key-encryption-key. Given the correct key-encryption-key the
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Aug 26 19:52:29 GMT 2022
    - 5K bytes
    - Viewed (0)
  7. cmd/metrics-resource.go

    // retrieved from a peer, along with errors if any
    type PeerResourceMetrics struct {
    	Metrics map[MetricSubsystem]ResourceMetrics
    	Errors  []string
    }
    
    // ResourceMetrics is a map of unique key identifying
    // a resource metric (e.g. reads_per_sec_{node}_{drive})
    // to its data
    type ResourceMetrics map[string]ResourceMetric
    
    // ResourceMetric represents a single resource metric
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Apr 23 23:56:12 GMT 2024
    - 17.4K bytes
    - Viewed (0)
  8. tests/postgres_test.go

    		SomeID  string
    		OtherID string
    		Data    string
    	}
    
    	DB.Migrator().DropTable(&Thing{})
    	DB.Migrator().CreateTable(&Thing{})
    	if err := DB.Exec("ALTER TABLE things ADD CONSTRAINT some_id_other_id_unique UNIQUE (some_id, other_id)").Error; err != nil {
    		t.Error(err)
    	}
    
    	thing := Thing{
    		SomeID:  "1234",
    		OtherID: "1234",
    		Data:    "something",
    	}
    
    	DB.Create(&thing)
    
    	thing2 := Thing{
    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)
  9. internal/crypto/key.go

    	"github.com/minio/sio"
    )
    
    // ObjectKey is a 256 bit secret key used to encrypt the object.
    // It must never be stored in plaintext.
    type ObjectKey [32]byte
    
    // GenerateKey generates a unique ObjectKey from a 256 bit external key
    // and a source of randomness. If random is nil the default PRNG of the
    // system (crypto/rand) is used.
    func GenerateKey(extKey []byte, random io.Reader) (key ObjectKey) {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Mar 19 20:28:10 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  10. schema/naming.go

    }
    
    // IndexName generate index name
    func (ns NamingStrategy) IndexName(table, column string) string {
    	return ns.formatName("idx", table, ns.toDBName(column))
    }
    
    // UniqueName generate unique constraint name
    func (ns NamingStrategy) UniqueName(table, column string) string {
    	return ns.formatName("uni", table, ns.toDBName(column))
    }
    
    func (ns NamingStrategy) formatName(prefix, table, name string) string {
    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