Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 58 for asString (3.13 sec)

  1. schema/field_test.go

    }
    
    type UserWithPermissionControl struct {
    	ID    uint
    	Name  string `gorm:"-"`
    	Name2 string `gorm:"->"`
    	Name3 string `gorm:"<-"`
    	Name4 string `gorm:"<-:create"`
    	Name5 string `gorm:"<-:update"`
    	Name6 string `gorm:"<-:create,update"`
    	Name7 string `gorm:"->:false;<-:create,update"`
    	Name8 string `gorm:"->;-:migration"`
    }
    
    func TestParseFieldWithPermission(t *testing.T) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sat Feb 19 09:02:53 UTC 2022
    - 12.7K bytes
    - Viewed (0)
  2. tests/table_test.go

    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("`people`").Table("`user`").Find(&User{}).Statement
    	if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sat Mar 09 09:31:28 UTC 2024
    - 10.6K bytes
    - Viewed (0)
  3. tests/query_test.go

    		t.Fatalf("Build NOT condition, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Not(map[string]interface{}{"name": []string{}}).Find(&User{})
    	if !regexp.MustCompile("SELECT \\* FROM .*users.* WHERE .*name.* IS NOT NULL").MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build NOT condition, but got %v", result.Statement.SQL.String())
    	}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 49.8K bytes
    - Viewed (0)
  4. clause/clause.go

    	}
    }
    
    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}
    )
    
    // Column quote with name
    type Column struct {
    	Table string
    	Name  string
    	Alias string
    	Raw   bool
    }
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Thu Feb 02 09:15:08 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  5. schema/constraint.go

    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{}) {
    	return "CONSTRAINT ? CHECK (?)", []interface{}{clause.Column{Name: chk.Name}, clause.Expr{SQL: chk.Constraint}}
    }
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Mar 18 07:33:54 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  6. tests/preload_suits_test.go

    		t.Error(err)
    	}
    
    	if string(toJSONString(got)) != string(toJSONString(want)) {
    		t.Errorf("got %s; want %s", toJSONString(got), toJSONString(want))
    	}
    }
    
    type LevelA1 struct {
    	ID    uint
    	Value string
    }
    
    type LevelA2 struct {
    	ID       uint
    	Value    string
    	LevelA3s []*LevelA3 `json:",omitempty"`
    }
    
    type LevelA3 struct {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Mar 18 05:38:46 UTC 2022
    - 30.3K bytes
    - Viewed (0)
  7. tests/multi_primary_keys_test.go

    	Locale     string `gorm:"primary_key"`
    	Subject    string
    	Body       string
    	Tags       []Tag `gorm:"many2many:blog_tags;"`
    	SharedTags []Tag `gorm:"many2many:shared_blog_tags;ForeignKey:id;References:id"`
    	LocaleTags []Tag `gorm:"many2many:locale_blog_tags;ForeignKey:id,locale;References:id"`
    }
    
    type Tag struct {
    	ID     uint   `gorm:"primary_key"`
    	Locale string `gorm:"primary_key"`
    	Value  string
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 12.8K bytes
    - Viewed (0)
  8. utils/utils_test.go

    			t.Errorf("%v: expected %v, got %v", c.values, c.key, key)
    		}
    	}
    }
    
    func TestContains(t *testing.T) {
    	containsTests := []struct {
    		name  string
    		elems []string
    		elem  string
    		out   bool
    	}{
    		{"exists", []string{"1", "2", "3"}, "1", true},
    		{"not exists", []string{"1", "2", "3"}, "4", false},
    	}
    	for _, test := range containsTests {
    		t.Run(test.name, func(t *testing.T) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Feb 19 03:42:25 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  9. tests/embedded_struct_test.go

    )
    
    func TestEmbeddedStruct(t *testing.T) {
    	type ReadOnly struct {
    		ReadOnly *bool
    	}
    
    	type BasePost struct {
    		Id    int64
    		Title string
    		URL   string
    		ReadOnly
    	}
    
    	type Author struct {
    		ID    string
    		Name  string
    		Email string
    	}
    
    	type HNPost struct {
    		BasePost
    		Author  `gorm:"EmbeddedPrefix:user_"` // Embedded struct
    		Upvotes int32
    	}
    
    	type EngadgetPost struct {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  10. schema/constraint_test.go

    package schema_test
    
    import (
    	"reflect"
    	"sync"
    	"testing"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    type UserCheck struct {
    	Name  string `gorm:"check:name_checker,name <> 'jinzhu'"`
    	Name2 string `gorm:"check:name <> 'jinzhu'"`
    	Name3 string `gorm:"check:,name <> 'jinzhu'"`
    }
    
    func TestParseCheck(t *testing.T) {
    	user, err := schema.Parse(&UserCheck{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sun Feb 04 07:49:19 UTC 2024
    - 2.2K bytes
    - Viewed (0)
Back to top