Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 81 for Model (0.17 sec)

  1. tests/scanner_valuer_test.go

    	if err := DB.Create(&data).Error; err != nil {
    		t.Errorf("Should got no error when creating data, but got %v", err)
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("xnewpass")).Error; err == nil {
    		t.Errorf("Should failed to update data with invalid data")
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("newpass")).Error; err != nil {
    		t.Errorf("Should got no error update data with valid data, but got %v", err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  2. schema/schema_test.go

    		{Name: "ID", DBName: "id", BindNames: []string{"Model", "ID"}, DataType: schema.Uint, PrimaryKey: true, Tag: `gorm:"primarykey"`, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY"}, Size: 64, HasDefaultValue: true, AutoIncrement: true},
    		{Name: "CreatedAt", DBName: "created_at", BindNames: []string{"Model", "CreatedAt"}, DataType: schema.Time},
    		{Name: "UpdatedAt", DBName: "updated_at", BindNames: []string{"Model", "UpdatedAt"}, DataType: schema.Time},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  3. tests/error_translator_test.go

    	}
    }
    
    func TestSupportedDialectorWithErrForeignKeyViolated(t *testing.T) {
    	tidbSkip(t, "not support the foreign key feature")
    
    	type City struct {
    		gorm.Model
    		Name string `gorm:"unique"`
    	}
    
    	type Museum struct {
    		gorm.Model
    		Name   string `gorm:"unique"`
    		CityID uint
    		City   City `gorm:"Constraint:OnUpdate:CASCADE,OnDelete:CASCADE;FOREIGNKEY:CityID;References:ID"`
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  4. callbacks/update.go

    	"gorm.io/gorm/utils"
    )
    
    func SetupUpdateReflectValue(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil {
    		if !db.Statement.ReflectValue.CanAddr() || db.Statement.Model != db.Statement.Dest {
    			db.Statement.ReflectValue = reflect.ValueOf(db.Statement.Model)
    			for db.Statement.ReflectValue.Kind() == reflect.Ptr {
    				db.Statement.ReflectValue = db.Statement.ReflectValue.Elem()
    			}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  5. tests/serializer_test.go

    import (
    	"bytes"
    	"context"
    	"fmt"
    	"reflect"
    	"strings"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type SerializerStruct struct {
    	gorm.Model
    	Name                   []byte                 `gorm:"json"`
    	Roles                  Roles                  `gorm:"serializer:json"`
    	Roles2                 *Roles                 `gorm:"serializer:json"`
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  6. istioctl/pkg/writer/pilot/status_test.go

    	discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
    	status "github.com/envoyproxy/go-control-plane/envoy/service/status/v3"
    	"google.golang.org/protobuf/types/known/anypb"
    
    	"istio.io/istio/pilot/pkg/model"
    	"istio.io/istio/pilot/pkg/util/protoconv"
    	"istio.io/istio/pilot/pkg/xds"
    	v3 "istio.io/istio/pilot/pkg/xds/v3"
    	"istio.io/istio/pkg/cluster"
    	"istio.io/istio/pkg/test/util/assert"
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Fri Mar 08 08:38:19 GMT 2024
    - 6.5K bytes
    - Viewed (0)
  7. gorm.go

    }
    
    // SetupJoinTable setup join table schema
    func (db *DB) SetupJoinTable(model interface{}, field string, joinTable interface{}) error {
    	var (
    		tx                      = db.getInstance()
    		stmt                    = tx.Statement
    		modelSchema, joinSchema *schema.Schema
    	)
    
    	err := stmt.Parse(model)
    	if err != nil {
    		return err
    	}
    	modelSchema = stmt.Schema
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  8. tests/scan_test.go

    	if res.ID != user2.ID || res.Name != user2.Name || res.Age != int(user2.Age) {
    		t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user2)
    	}
    
    	DB.Model(&User{Model: gorm.Model{ID: user3.ID}}).Select("id, name, age").Scan(&res)
    	if res.ID != user3.ID || res.Name != user3.Name || res.Age != int(user3.Age) {
    		t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user3)
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  9. tests/non_std_test.go

    	if updatedAt1.Format(time.RFC3339Nano) == animal.UpdatedAt.Format(time.RFC3339Nano) {
    		t.Errorf("UpdatedAt should be updated")
    	}
    
    	var animals []Animal
    	DB.Find(&animals)
    	if count := DB.Model(Animal{}).Where("1=1").Update("CreatedAt", time.Now().Add(2*time.Hour)).RowsAffected; count != int64(len(animals)) {
    		t.Error("RowsAffected should be correct when do batch update")
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  10. cmd/iam-etcd-store.go

    	//  a large number of policies
    	r, err := ies.client.Get(ctx, iamConfigPoliciesPrefix, etcd.WithPrefix())
    	if err != nil {
    		return err
    	}
    
    	// Parse all values to construct the policies data model.
    	for _, kvs := range r.Kvs {
    		if err = ies.getPolicyDocKV(ctx, kvs, m); err != nil && !errors.Is(err, errNoSuchPolicy) {
    			return err
    		}
    	}
    	return nil
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 13.6K bytes
    - Viewed (0)
Back to top