Search Options

Results per page
Sort
Preferred Languages
Advance

Results 61 - 70 of 1,053 for gorm (0.01 sec)

  1. .github/workflows/tests.yml

        services:
          mysql:
            image: ${{ matrix.dbversion }}
            env:
              MYSQL_DATABASE: gorm
              MYSQL_USER: gorm
              MYSQL_PASSWORD: gorm
              MYSQL_RANDOM_ROOT_PASSWORD: "yes"
            ports:
              - 9910:3306
            options: >-
              --health-cmd "mysqladmin ping -ugorm -pgorm"
              --health-interval 10s
              --health-start-period 10s
              --health-timeout 5s
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Sep 08 09:19:22 UTC 2025
    - 8.9K bytes
    - Viewed (0)
  2. callbacks/callbacks.go

    package callbacks
    
    import (
    	"gorm.io/gorm"
    )
    
    var (
    	createClauses = []string{"INSERT", "VALUES", "ON CONFLICT"}
    	queryClauses  = []string{"SELECT", "FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", "FOR"}
    	updateClauses = []string{"UPDATE", "SET", "WHERE"}
    	deleteClauses = []string{"DELETE", "FROM", "WHERE"}
    )
    
    type Config struct {
    	LastInsertIDReversed bool
    	CreateClauses        []string
    	QueryClauses         []string
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Wed Oct 27 23:56:55 UTC 2021
    - 3.3K bytes
    - Viewed (0)
  3. callbacks/raw.go

    package callbacks
    
    import (
    	"gorm.io/gorm"
    )
    
    func RawExec(db *gorm.DB) {
    	if db.Error == nil && !db.DryRun {
    		result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    		if err != nil {
    			db.AddError(err)
    			return
    		}
    
    		db.RowsAffected, _ = result.RowsAffected()
    
    		if db.Statement.Result != nil {
    			db.Statement.Result.Result = result
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 468 bytes
    - Viewed (0)
  4. tests/create_test.go

    package tests_test
    
    import (
    	"errors"
    	"fmt"
    	"regexp"
    	"testing"
    	"time"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCreate(t *testing.T) {
    	u1 := *GetUser("create", Config{})
    
    	if results := DB.Create(&u1); results.Error != nil {
    		t.Fatalf("errors happened when create: %v", results.Error)
    	} else if results.RowsAffected != 1 {
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Jul 21 09:55:20 UTC 2025
    - 26.8K bytes
    - Viewed (0)
  5. tests/scopes_test.go

    import (
    	"context"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func NameIn1And2(d *gorm.DB) *gorm.DB {
    	return d.Where("name in (?)", []string{"ScopeUser1", "ScopeUser2"})
    }
    
    func NameIn2And3(d *gorm.DB) *gorm.DB {
    	return d.Where("name in (?)", []string{"ScopeUser2", "ScopeUser3"})
    }
    
    func NameIn(names []string) func(d *gorm.DB) *gorm.DB {
    	return func(d *gorm.DB) *gorm.DB {
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  6. logger/slog_test.go

    		return "select count(*) from users", 0
    	}, nil)
    
    	if strings.Contains(buf.String(), "gorm/logger/slog.go") {
    		t.Error("Found internal slog.go reference in caller frame. Expected only test file references.")
    	}
    
    	if !strings.Contains(buf.String(), "gorm/logger/slog_test.go") {
    		t.Error("Missing expected test file reference. 'gorm/logger/slog_test.go' should appear in caller frames.")
    	}
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Thu Oct 30 10:56:26 UTC 2025
    - 782 bytes
    - Viewed (0)
  7. schema/relationship_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func checkStructRelation(t *testing.T, data interface{}, relations ...Relation) {
    	if s, err := schema.Parse(data, &sync.Map{}, schema.NamingStrategy{}); err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	} else {
    		for _, rel := range relations {
    			checkSchemaRelation(t, s, rel)
    		}
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Aug 18 11:44:52 UTC 2025
    - 26.5K bytes
    - Viewed (0)
  8. 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)
    
    	var parsedNames []string
    	for i := 0; i < len(names); i++ {
    		s := names[i]
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Thu Oct 30 11:15:36 UTC 2025
    - 5.9K bytes
    - Viewed (0)
  9. tests/submodel_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    )
    
    type Man struct {
    	ID     int
    	Age    int
    	Name   string
    	Detail string
    }
    
    // Panic-safe BeforeUpdate hook that checks for Changed("age")
    func (m *Man) BeforeUpdate(tx *gorm.DB) (err error) {
    	if !tx.Statement.Changed("age") {
    		return nil
    	}
    	return nil
    }
    
    func TestSubModel(t *testing.T) {
    	man := Man{Age: 18, Name: "random-name"}
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Sep 08 09:19:22 UTC 2025
    - 947 bytes
    - Viewed (0)
  10. schema/model_test.go

    import (
    	"database/sql"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/utils/tests"
    )
    
    type User struct {
    	*gorm.Model
    	Name      *string
    	Age       *uint
    	Birthday  *time.Time
    	Account   *tests.Account
    	Pets      []*tests.Pet
    	Toys      []*tests.Toy `gorm:"polymorphic:Owner"`
    	CompanyID *int
    	Company   *tests.Company
    	ManagerID *uint
    	Manager   *User
    	Team      []*User           `gorm:"foreignkey:ManagerID"`
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 1.1K bytes
    - Viewed (0)
Back to top