Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 123 for strict (0.18 sec)

  1. tests/scan_test.go

    )
    
    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}
    	DB.Save(&user1).Save(&user2).Save(&user3)
    
    	type result struct {
    		ID   uint
    		Name string
    		Age  int
    	}
    
    	var res result
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  2. tests/scanner_valuer_test.go

    	switch value := input.(type) {
    	case string:
    		return json.Unmarshal([]byte(value), l)
    	case []byte:
    		return json.Unmarshal(value, l)
    	default:
    		return errors.New("not supported")
    	}
    }
    
    type ExampleStruct struct {
    	Name string
    	Val  string
    }
    
    func (ExampleStruct) GormDataType() string {
    	return "bytes"
    }
    
    func (s ExampleStruct) Value() (driver.Value, error) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  3. prepare_stmt.go

    package gorm
    
    import (
    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"errors"
    	"reflect"
    	"sync"
    )
    
    type Stmt struct {
    	*sql.Stmt
    	Transaction bool
    	prepared    chan struct{}
    	prepareErr  error
    }
    
    type PreparedStmtDB struct {
    	Stmts       map[string]*Stmt
    	PreparedSQL []string
    	Mux         *sync.RWMutex
    	ConnPool
    }
    
    func NewPreparedStmtDB(connPool ConnPool) *PreparedStmtDB {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  4. schema/utils.go

    	"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 {
    				if names[j][len(names[j])-1] == '\\' {
    					i++
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  5. clause/select.go

    package clause
    
    // Select select attrs when querying, updating, creating
    type Select struct {
    	Distinct   bool
    	Columns    []Column
    	Expression Expression
    }
    
    func (s Select) Name() string {
    	return "SELECT"
    }
    
    func (s Select) Build(builder Builder) {
    	if len(s.Columns) > 0 {
    		if s.Distinct {
    			builder.WriteString("DISTINCT ")
    		}
    
    		for idx, column := range s.Columns {
    			if idx > 0 {
    				builder.WriteByte(',')
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 14 07:51:24 GMT 2021
    - 1.1K bytes
    - Viewed (0)
  6. schema/index_test.go

    	// Composite Index: Unique and priority.
    	Data2A string `gorm:"index:,unique,composite:comp_id2,priority:2"`
    	CompIdxLevel2C
    }
    
    type CompIdxLevel1C struct {
    	CompIdxLevel1B
    	Data1C string `gorm:"index:,composite:comp_id1"`
    }
    
    type CompIdxLevel1B struct {
    	Data1B string `gorm:"index:,composite:comp_id1"`
    }
    
    type CompIdxLevel2C struct {
    	CompIdxLevel2B
    	Data2C string `gorm:"index:,unique,composite:comp_id2,priority:1"`
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  7. schema/index.go

    	"strconv"
    	"strings"
    )
    
    type Index struct {
    	Name    string
    	Class   string // UNIQUE | FULLTEXT | SPATIAL
    	Type    string // btree, hash, gist, spgist, gin, and brin
    	Where   string
    	Comment string
    	Option  string        // WITH PARSER parser_name
    	Fields  []IndexOption // Note: IndexOption's Field maybe the same
    }
    
    type IndexOption struct {
    	*Field
    	Expression string
    	Sort       string // DESC, ASC
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  8. tests/update_test.go

    	user := GetUser("update-diff-schema-1", Config{})
    	DB.Create(&user)
    
    	type UserTemp struct {
    		Name string
    	}
    
    	err := DB.Model(&user).Updates(&UserTemp{Name: "update-diff-schema-2"}).Error
    	AssertEqual(t, err, nil)
    	AssertEqual(t, "update-diff-schema-2", user.Name)
    }
    
    type TokenOwner struct {
    	ID    int
    	Name  string
    	Token Token `gorm:"foreignKey:UserID"`
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  9. callbacks/callmethod.go

    					fc(value.Addr().Interface(), tx)
    				} else {
    					db.AddError(gorm.ErrInvalidValue)
    					return
    				}
    				db.Statement.CurDestIndex++
    			}
    		case reflect.Struct:
    			if db.Statement.ReflectValue.CanAddr() {
    				fc(db.Statement.ReflectValue.Addr().Interface(), tx)
    			} else {
    				db.AddError(gorm.ErrInvalidValue)
    			}
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  10. schema/callbacks_test.go

    		t.Fatalf("failed to parse user with callback, got error %v", err)
    	}
    
    	for _, str := range []string{"BeforeSave", "AfterCreate"} {
    		if !reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) {
    			t.Errorf("%v should be true", str)
    		}
    	}
    
    	for _, str := range []string{"BeforeCreate", "BeforeUpdate", "AfterUpdate", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"} {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 939 bytes
    - Viewed (0)
Back to top