Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 51 for texts (0.16 sec)

  1. tests/README.md

    # Test Guide
    
    ```bash
    cd tests
    # prepare test databases
    docker-compose up
    
    # run all tests
    ./tests_all.sh
    Plain Text
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 23 01:38:51 GMT 2020
    - 110 bytes
    - Viewed (0)
  2. tests/benchmark_test.go

    package tests_test
    
    import (
    	"fmt"
    	"testing"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    func BenchmarkCreate(b *testing.B) {
    	user := *GetUser("bench", Config{})
    
    	for x := 0; x < b.N; x++ {
    		user.ID = 0
    		DB.Create(&user)
    	}
    }
    
    func BenchmarkFind(b *testing.B) {
    	user := *GetUser("find", Config{})
    	DB.Create(&user)
    
    	for x := 0; x < b.N; x++ {
    		DB.Find(&User{}, "id = ?", user.ID)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 01 03:50:57 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  3. tests/named_argument_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"errors"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestNamedArg(t *testing.T) {
    	type NamedUser struct {
    		gorm.Model
    		Name1 string
    		Name2 string
    		Name3 string
    	}
    
    	DB.Migrator().DropTable(&NamedUser{})
    	DB.AutoMigrate(&NamedUser{})
    
    	namedUser := NamedUser{Name1: "jinzhu1", Name2: "jinzhu2", Name3: "jinzhu3"}
    	DB.Create(&namedUser)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Dec 21 11:50:00 GMT 2021
    - 2.7K bytes
    - Viewed (0)
  4. tests/update_has_one_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateHasOne(t *testing.T) {
    	user := *GetUser("update-has-one", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Account = Account{Number: "account-has-one-association"}
    
    	if err := DB.Save(&user).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 3.6K bytes
    - Viewed (0)
  5. tests/prepared_stmt_test.go

    package tests_test
    
    import (
    	"context"
    	"errors"
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestPreparedStmt(t *testing.T) {
    	tx := DB.Session(&gorm.Session{PrepareStmt: true})
    
    	if _, ok := tx.ConnPool.(*gorm.PreparedStmtDB); !ok {
    		t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  6. tests/connpool_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"os"
    	"reflect"
    	"testing"
    
    	"gorm.io/driver/mysql"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type wrapperTx struct {
    	*sql.Tx
    	conn *wrapperConnPool
    }
    
    func (c *wrapperTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {
    	c.conn.got = append(c.conn.got, query)
    	return c.Tx.PrepareContext(ctx, query)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  7. tests/soft_delete_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"encoding/json"
    	"errors"
    	"regexp"
    	"testing"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestSoftDelete(t *testing.T) {
    	user := *GetUser("SoftDelete", Config{})
    	DB.Save(&user)
    
    	var count int64
    	var age uint
    
    	if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  8. tests/embedded_struct_test.go

    package tests_test
    
    import (
    	"database/sql/driver"
    	"encoding/json"
    	"errors"
    	"reflect"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestEmbeddedStruct(t *testing.T) {
    	type ReadOnly struct {
    		ReadOnly *bool
    	}
    
    	type BasePost struct {
    		Id    int64
    		Title string
    		URL   string
    		ReadOnly
    	}
    
    	type Author struct {
    		ID    string
    		Name  string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  9. 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)
  10. .github/workflows/tests.yml

        - name: go mod package cache
          uses: actions/cache@v4
          with:
            path: ~/go/pkg/mod
            key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
    
        - name: Tests
          run: GITHUB_ACTION=true GORM_DIALECT=sqlite ./tests/tests_all.sh
    
      mysql:
        strategy:
          matrix:
            dbversion: ['mysql:latest', 'mysql:5.7']
            go: ['1.21', '1.20', '1.19']
            platform: [ubuntu-latest]
    Others
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 02:34:20 GMT 2024
    - 6.6K bytes
    - Viewed (0)
Back to top