Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 45 for type (0.17 sec)

  1. schema/relationship_test.go

    				},
    			},
    		})
    	})
    
    	t.Run("has one with custom polymorphic type and id", func(t *testing.T) {
    		type Toy struct {
    			ID    int
    			Name  string
    			RefId int
    			Type  string
    		}
    
    		type Cat struct {
    			ID   int
    			Name string
    			Toy  Toy `gorm:"polymorphic:Owner;polymorphicType:Type;polymorphicId:RefId"`
    		}
    
    		s, err := schema.Parse(&Cat{}, &sync.Map{}, schema.NamingStrategy{})
    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)
  2. schema/serializer.go

    }
    
    // SerializerInterface serializer interface
    type SerializerInterface interface {
    	Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) error
    	SerializerValuerInterface
    }
    
    // SerializerValuerInterface serializer valuer interface
    type SerializerValuerInterface interface {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  3. scan.go

    				update = false
    				if isArrayKind {
    					db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
    				} else {
    					// if the slice cap is externally initialized, the externally initialized slice is directly used here
    					if reflectValue.Cap() == 0 {
    						db.Statement.ReflectValue.Set(reflect.MakeSlice(reflectValue.Type(), 0, 20))
    					} else {
    						reflectValue.SetLen(0)
    						db.Statement.ReflectValue.Set(reflectValue)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  4. schema/constraint.go

    package schema
    
    import (
    	"regexp"
    	"strings"
    
    	"gorm.io/gorm/clause"
    )
    
    // reg match english letters and midline
    var regEnLetterAndMidline = regexp.MustCompile(`^[\w-]+$`)
    
    type CheckConstraint struct {
    	Name       string
    	Constraint string // length(phone) >= 10
    	*Field
    }
    
    func (chk *CheckConstraint) GetName() string { return chk.Name }
    
    func (chk *CheckConstraint) Build() (sql string, vars []interface{}) {
    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)
  5. callbacks.go

    			"row":    {db: db},
    			"raw":    {db: db},
    		},
    	}
    }
    
    // callbacks gorm callbacks manager
    type callbacks struct {
    	processors map[string]*processor
    }
    
    type processor struct {
    	db        *DB
    	Clauses   []string
    	fns       []func(*DB)
    	callbacks []*callback
    }
    
    type callback struct {
    	name      string
    	before    string
    	after     string
    	remove    bool
    	replace   bool
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  6. tests/associations_has_many_test.go

    }
    
    func TestHasManyAssociationUnscoped(t *testing.T) {
    	type ItemContent struct {
    		gorm.Model
    		ItemID       uint   `gorm:"not null"`
    		Name         string `gorm:"not null;type:varchar(50)"`
    		LanguageCode string `gorm:"not null;type:varchar(2)"`
    	}
    	type Item struct {
    		gorm.Model
    		Logo     string        `gorm:"not null;type:varchar(50)"`
    		Contents []ItemContent `gorm:"foreignKey:ItemID"`
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  7. clause/limit.go

    package clause
    
    // Limit limit clause
    type Limit struct {
    	Limit  *int
    	Offset int
    }
    
    // Name where clause name
    func (limit Limit) Name() string {
    	return "LIMIT"
    }
    
    // Build build where clause
    func (limit Limit) Build(builder Builder) {
    	if limit.Limit != nil && *limit.Limit >= 0 {
    		builder.WriteString("LIMIT ")
    		builder.AddVar(builder, *limit.Limit)
    	}
    	if limit.Offset > 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 942 bytes
    - Viewed (0)
  8. tests/connpool_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"os"
    	"reflect"
    	"testing"
    
    	"gorm.io/driver/mysql"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type wrapperTx struct {
    	*sql.Tx
    	conn *wrapperConnPool
    }
    
    func (c *wrapperTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.PrepareContext(ctx, query)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  9. callbacks/helper_test.go

    package callbacks
    
    import (
    	"reflect"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    )
    
    func TestLoadOrStoreVisitMap(t *testing.T) {
    	var vm visitMap
    	var loaded bool
    	type testM struct {
    		Name string
    	}
    
    	t1 := testM{Name: "t1"}
    	t2 := testM{Name: "t2"}
    	t3 := testM{Name: "t3"}
    
    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  10. tests/create_test.go

    			t.Fatalf("errors happened when create: %v", err)
    		}
    
    		for _, pet := range pets {
    			CheckPet(t, *pet, *pet)
    		}
    	})
    }
    
    func TestCreateEmptyStruct(t *testing.T) {
    	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)
    	}
    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)
Back to top