Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 117 for io (0.14 sec)

  1. schema/callbacks_test.go

    package schema_test
    
    import (
    	"reflect"
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    )
    
    type UserWithCallback struct{}
    
    func (UserWithCallback) BeforeSave(*gorm.DB) error {
    	return nil
    }
    
    func (UserWithCallback) AfterCreate(*gorm.DB) error {
    	return nil
    }
    
    func TestCallback(t *testing.T) {
    	user, err := schema.Parse(&UserWithCallback{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 939 bytes
    - Viewed (0)
  2. tests/update_many2many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateMany2ManyAssociations(t *testing.T) {
    	user := *GetUser("update-many2many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Languages = []Language{{Code: "zh-CN", Name: "Chinese"}, {Code: "en", Name: "English"}}
    	for _, lang := range user.Languages {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  3. callbacks/callmethod.go

    package callbacks
    
    import (
    	"reflect"
    
    	"gorm.io/gorm"
    )
    
    func callMethod(db *gorm.DB, fc func(value interface{}, tx *gorm.DB) bool) {
    	tx := db.Session(&gorm.Session{NewDB: true})
    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  4. schema/utils.go

    package schema
    
    import (
    	"context"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    )
    
    var embeddedCacheKey = "embedded_cache_store"
    
    func ParseTagSetting(str string, sep string) map[string]string {
    	settings := map[string]string{}
    	names := strings.Split(str, sep)
    
    	for i := 0; i < len(names); i++ {
    		j := i
    		if len(names[j]) > 0 {
    			for {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  5. clause/group_by_test.go

    package clause_test
    
    import (
    	"fmt"
    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestGroupBy(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.GroupBy{
    				Columns: []clause.Column{{Name: "role"}},
    				Having:  []clause.Expression{clause.Eq{"role", "admin"}},
    			}},
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  6. clause/from_test.go

    package clause_test
    
    import (
    	"fmt"
    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestFrom(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}},
    			"SELECT * FROM `users`", nil,
    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{
    					Tables: []clause.Table{{Name: "users"}},
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  7. tests/scanner_valuer_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"encoding/json"
    	"errors"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strconv"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestScannerValuer(t *testing.T) {
    	DB.Migrator().DropTable(&ScannerValuerStruct{})
    	if err := DB.Migrator().AutoMigrate(&ScannerValuerStruct{}); err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  8. schema/index_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    type UserIndex struct {
    	Name         string `gorm:"index"`
    	Name2        string `gorm:"index:idx_name,unique"`
    	Name3        string `gorm:"index:,sort:desc,collate:utf8,type:btree,length:10,where:name3 != 'jinzhu'"`
    	Name4        string `gorm:"uniqueIndex"`
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  9. tests/helper_test.go

    package tests_test
    
    import (
    	"os"
    	"sort"
    	"strconv"
    	"strings"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    type Config struct {
    	Account   bool
    	Pets      int
    	Toys      int
    	Company   bool
    	Manager   bool
    	Team      int
    	Languages int
    	Friends   int
    	NamedPet  bool
    	Tools     int
    }
    
    func GetUser(name string, config Config) *User {
    	var (
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  10. tests/scan_test.go

    package tests_test
    
    import (
    	"reflect"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type PersonAddressInfo struct {
    	Person  *Person  `gorm:"embedded"`
    	Address *Address `gorm:"embedded"`
    }
    
    func TestScan(t *testing.T) {
    	user1 := User{Name: "ScanUser1", Age: 1}
    	user2 := User{Name: "ScanUser2", Age: 10}
    	user3 := User{Name: "ScanUser3", Age: 20}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
Back to top