Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 39 for Model (0.16 sec)

  1. tests/sql_builder_test.go

    	dryRunDB := DB.Session(&gorm.Session{DryRun: true})
    
    	stmt := dryRunDB.Model(&user).Where("id = ?", 1).Updates(map[string]interface{}{"age": ageInt(8)}).Statement
    	sql := DB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
    	if !regexp.MustCompile(`.*age.*=8,`).MatchString(sql) {
    		t.Errorf("Failed to generate sql, got %v", sql)
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  2. tests/query_test.go

    	var simpleUser2 SimpleUser
    	if err := DB.Model(&User{}).Select("id").First(&simpleUser2, user.ID).Error; err != nil {
    		t.Fatalf("Failed to query smaller user, got error %v", err)
    	}
    
    	AssertObjEqual(t, user, simpleUser2, "ID")
    
    	var simpleUsers []SimpleUser
    	if err := DB.Model(&User{}).Select("id").Find(&simpleUsers, user.ID).Error; err != nil || len(simpleUsers) != 1 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  3. tests/update_test.go

    	}
    
    	user3.Name = "save3_"
    	if err := DB.Model(User{Model: user3.Model}).Save(&user3).Error; err != nil {
    		t.Fatalf("failed to save user, got %v", err)
    	}
    
    	var result2 User
    	if err := DB.First(&result2, "name = ?", "save3_").Error; err != nil || result2.ID != user3.ID {
    		t.Fatalf("failed to find updated user, got %v", err)
    	}
    
    	if err := DB.Model(User{Model: user3.Model}).Save(&struct {
    		gorm.Model
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  4. 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)
  5. 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 May 01 22:53:12 GMT 2024
    - Last Modified: Fri Mar 08 08:38:19 GMT 2024
    - 6.5K bytes
    - Viewed (0)
  6. 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)
  7. tests/default_value_test.go

    package tests_test
    
    import (
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    )
    
    func TestDefaultValue(t *testing.T) {
    	type Harumph struct {
    		gorm.Model
    		Email   string    `gorm:"not null;index:,unique"`
    		Name    string    `gorm:"notNull;default:foo"`
    		Name2   string    `gorm:"size:233;not null;default:'foo'"`
    		Name3   string    `gorm:"size:233;notNull;default:''"`
    		Age     int       `gorm:"default:18"`
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  8. statement.go

    	}
    	return err
    }
    
    func (stmt *Statement) clone() *Statement {
    	newStmt := &Statement{
    		TableExpr:            stmt.TableExpr,
    		Table:                stmt.Table,
    		Model:                stmt.Model,
    		Unscoped:             stmt.Unscoped,
    		Dest:                 stmt.Dest,
    		ReflectValue:         stmt.ReflectValue,
    		Clauses:              map[string]clause.Clause{},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  9. istioctl/pkg/metrics/metrics.go

    	"strings"
    	"text/tabwriter"
    	"time"
    
    	"github.com/hashicorp/go-multierror"
    	"github.com/prometheus/client_golang/api"
    	promv1 "github.com/prometheus/client_golang/api/prometheus/v1"
    	"github.com/prometheus/common/model"
    	"github.com/spf13/cobra"
    
    	"istio.io/istio/istioctl/pkg/cli"
    	"istio.io/istio/istioctl/pkg/clioptions"
    	"istio.io/istio/istioctl/pkg/completion"
    	"istio.io/istio/istioctl/pkg/dashboard"
    	"istio.io/istio/pkg/log"
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Sat Apr 13 05:23:38 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  10. utils/tests/models.go

    	Active    bool
    }
    
    type Account struct {
    	gorm.Model
    	UserID sql.NullInt64
    	Number string
    }
    
    type Pet struct {
    	gorm.Model
    	UserID *uint
    	Name   string
    	Toy    Toy `gorm:"polymorphic:Owner;"`
    }
    
    type Toy struct {
    	gorm.Model
    	Name      string
    	OwnerID   string
    	OwnerType string
    }
    
    type Tools struct {
    	gorm.Model
    	Name     string
    	CustomID string
    	Type     string
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
Back to top