Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 45 for things (0.13 sec)

  1. tests/postgres_test.go

    	}
    
    	DB.Create(&thing)
    
    	thing2 := Thing{
    		SomeID:  "1234",
    		OtherID: "1234",
    		Data:    "something else",
    	}
    
    	result := DB.Clauses(clause.OnConflict{
    		OnConstraint: "some_id_other_id_unique",
    		UpdateAll:    true,
    	}).Create(&thing2)
    	if result.Error != nil {
    		t.Errorf("creating second thing: %v", result.Error)
    	}
    
    	var things []Thing
    	if err := DB.Find(&things).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  2. schema/relationship_test.go

    				{"ID", "Thing", "ThingID", "likes", "", false},
    			},
    		},
    		Relation{
    			Name: "Dislikes", Type: schema.Many2Many, Schema: "Person", FieldSchema: "Thing",
    			JoinTable: JoinTable{Name: "dislikes", Table: "dislikes"},
    			References: []Reference{
    				{"ID", "Person", "PersonID", "dislikes", "", true},
    				{"ID", "Thing", "ThingID", "dislikes", "", false},
    			},
    		},
    	)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  3. schema/constraint.go

    		if chk := field.TagSettings["CHECK"]; chk != "" {
    			names := strings.Split(chk, ",")
    			if len(names) > 1 && regEnLetterAndMidline.MatchString(names[0]) {
    				checks[names[0]] = CheckConstraint{Name: names[0], Constraint: strings.Join(names[1:], ","), Field: field}
    			} else {
    				if names[0] == "" {
    					chk = strings.Join(names[1:], ",")
    				}
    				name := schema.namer.CheckerName(schema.Table, field.DBName)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  4. schema/serializer.go

    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"encoding/gob"
    	"encoding/json"
    	"fmt"
    	"reflect"
    	"strings"
    	"sync"
    	"time"
    )
    
    var serializerMap = sync.Map{}
    
    // RegisterSerializer register serializer
    func RegisterSerializer(name string, serializer SerializerInterface) {
    	serializerMap.Store(strings.ToLower(name), serializer)
    }
    
    // GetSerializer get serializer
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  5. clause/set_test.go

    package clause_test
    
    import (
    	"fmt"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestSet(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{
    				clause.Update{},
    				clause.Set([]clause.Assignment{{clause.PrimaryColumn, 1}}),
    			},
    			"UPDATE `users` SET `users`.`id`=?",
    			[]interface{}{1},
    		},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  6. tests/count_test.go

    package tests_test
    
    import (
    	"fmt"
    	"regexp"
    	"sort"
    	"strings"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCountWithGroup(t *testing.T) {
    	DB.Create([]Company{
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_a"},
    		{Name: "company_count_group_b"},
    		{Name: "company_count_group_c"},
    	})
    
    	var count1 int64
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  7. schema/naming.go

    	}
    	ret := buf.String()
    	return ret
    }
    
    func (ns NamingStrategy) toSchemaName(name string) string {
    	result := strings.ReplaceAll(strings.Title(strings.ReplaceAll(name, "_", " ")), " ", "")
    	for _, initialism := range commonInitialisms {
    		result = regexp.MustCompile(strings.Title(strings.ToLower(initialism))+"([A-Z]|$|_)").ReplaceAllString(result, initialism+"$1")
    	}
    	return result
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  8. utils/utils.go

    	frames := runtime.CallersFrames(pcs[:len])
    	for i := 0; i < len; i++ {
    		// second return value is "more", not "ok"
    		frame, _ := frames.Next()
    		if (!strings.HasPrefix(frame.File, gormSourceDir) ||
    			strings.HasSuffix(frame.File, "_test.go")) && !strings.HasSuffix(frame.File, ".gen.go") {
    			return string(strconv.AppendInt(append([]byte(frame.File), ':'), int64(frame.Line), 10))
    		}
    	}
    
    	return ""
    }
    
    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)
  9. logger/sql.go

    			case reflect.String:
    				vars[idx] = escaper + strings.ReplaceAll(fmt.Sprintf("%v", v), escaper, escaper+escaper) + escaper
    			default:
    				if v != nil && reflectValue.IsValid() && ((reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil()) || reflectValue.Kind() != reflect.Ptr) {
    					vars[idx] = escaper + strings.ReplaceAll(fmt.Sprintf("%v", v), escaper, escaper+escaper) + escaper
    				} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  10. chainable_api.go

    	tx = db.getInstance()
    	if strings.Contains(name, " ") || strings.Contains(name, "`") || len(args) > 0 {
    		tx.Statement.TableExpr = &clause.Expr{SQL: name, Vars: args}
    		if results := tableRegexp.FindStringSubmatch(name); len(results) == 3 {
    			if results[1] != "" {
    				tx.Statement.Table = results[1]
    			} else {
    				tx.Statement.Table = results[2]
    			}
    		}
    	} else if tables := strings.Split(name, "."); len(tables) == 2 {
    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)
Back to top