Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for utils (0.2 sec)

  1. utils/utils.go

    package utils
    
    import (
    	"database/sql/driver"
    	"fmt"
    	"path/filepath"
    	"reflect"
    	"runtime"
    	"strconv"
    	"strings"
    	"unicode"
    )
    
    var gormSourceDir string
    
    func init() {
    	_, file, _, _ := runtime.Caller(0)
    	// compatible solution to get gorm source directory with various operating systems
    	gormSourceDir = sourceDir(file)
    }
    
    func sourceDir(file string) string {
    	dir := filepath.Dir(file)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  2. scan.go

    package gorm
    
    import (
    	"database/sql"
    	"database/sql/driver"
    	"reflect"
    	"time"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // prepareValues prepare values slice
    func prepareValues(values []interface{}, db *DB, columnTypes []*sql.ColumnType, columns []string) {
    	if db.Statement.Schema != nil {
    		for idx, name := range columns {
    			if field := db.Statement.Schema.LookUpField(name); field != nil {
    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)
  3. callbacks/preload.go

    			}
    
    			for idx, field := range joinRelForeignFields {
    				joinFieldValues[idx], _ = field.ValueOf(tx.Statement.Context, joinIndexValue)
    			}
    
    			if results, ok := joinIdentityMap[utils.ToStringKey(fieldValues...)]; ok {
    				joinKey := utils.ToStringKey(joinFieldValues...)
    				identityMap[joinKey] = append(identityMap[joinKey], results...)
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. chainable_api.go

    package gorm
    
    import (
    	"fmt"
    	"regexp"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    )
    
    // Model specify the model you would like to run db operations
    //
    //	// update all users's name to `hello`
    //	db.Model(&User{}).Update("name", "hello")
    //	// if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello`
    //	db.Model(&user).Update("name", "hello")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  5. callbacks/create.go

    package callbacks
    
    import (
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // BeforeCreate before create hooks
    func BeforeCreate(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeCreate) {
    		callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  6. tests/preload_test.go

    package tests_test
    
    import (
    	"context"
    	"encoding/json"
    	"regexp"
    	"sort"
    	"strconv"
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestPreloadWithAssociations(t *testing.T) {
    	user := *GetUser("preload_with_associations", Config{
    		Account:   true,
    		Pets:      2,
    		Toys:      3,
    		Company:   true,
    		Manager:   true,
    		Team:      4,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  7. schema/field.go

    		Readable:               true,
    		PrimaryKey:             utils.CheckTruth(tagSetting["PRIMARYKEY"], tagSetting["PRIMARY_KEY"]),
    		AutoIncrement:          utils.CheckTruth(tagSetting["AUTOINCREMENT"]),
    		HasDefaultValue:        utils.CheckTruth(tagSetting["AUTOINCREMENT"]),
    		NotNull:                utils.CheckTruth(tagSetting["NOT NULL"], tagSetting["NOTNULL"]),
    		Unique:                 utils.CheckTruth(tagSetting["UNIQUE"]),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  8. tests/query_test.go

    import (
    	"database/sql"
    	"database/sql/driver"
    	"fmt"
    	"reflect"
    	"regexp"
    	"sort"
    	"strconv"
    	"strings"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestFind(t *testing.T) {
    	users := []User{
    		*GetUser("find", Config{}),
    		*GetUser("find", Config{}),
    		*GetUser("find", Config{}),
    	}
    
    	if err := DB.Create(&users).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top