Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for io (0.14 sec)

  1. tests/scanner_valuer_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"encoding/json"
    	"errors"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strconv"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestScannerValuer(t *testing.T) {
    	DB.Migrator().DropTable(&ScannerValuerStruct{})
    	if err := DB.Migrator().AutoMigrate(&ScannerValuerStruct{}); err != nil {
    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)
  2. tests/transaction_test.go

    package tests_test
    
    import (
    	"context"
    	"errors"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestTransaction(t *testing.T) {
    	tx := DB.Begin()
    	user := *GetUser("transaction", Config{})
    
    	if err := tx.Save(&user).Error; err != nil {
    		t.Fatalf("No error should raise, but got %v", err)
    	}
    
    	if err := tx.First(&User{}, "name = ?", "transaction").Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  3. tests/update_test.go

    package tests_test
    
    import (
    	"errors"
    	"regexp"
    	"sort"
    	"strings"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdate(t *testing.T) {
    	var (
    		users = []*User{
    			GetUser("update-1", Config{}),
    			GetUser("update-2", Config{}),
    			GetUser("update-3", Config{}),
    		}
    		user          = users[1]
    		lastUpdatedAt time.Time
    	)
    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)
  4. 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)
  5. tests/joins_test.go

    package tests_test
    
    import (
    	"regexp"
    	"sort"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestJoins(t *testing.T) {
    	user := *GetUser("joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false})
    
    	DB.Create(&user)
    
    	var user2 User
    	if err := DB.Joins("NamedPet").Joins("Company").Joins("Manager").Joins("Account").First(&user2, "users.name = ?", user.Name).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  6. 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) {
    	user := *GetUser("create", Config{})
    
    	if results := DB.Create(&user); results.Error != nil {
    		t.Fatalf("errors happened when create: %v", results.Error)
    	} else if results.RowsAffected != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  7. tests/associations_has_many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestHasManyAssociation(t *testing.T) {
    	user := *GetUser("hasmany", Config{Pets: 2})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	CheckUser(t, user, user)
    
    	// Find
    	var user2 User
    	DB.Find(&user2, "id = ?", user.ID)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  8. schema/relationship_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    )
    
    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)
    		}
    	}
    }
    
    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)
  9. 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)
  10. callbacks/query.go

    package callbacks
    
    import (
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func Query(db *gorm.DB) {
    	if db.Error == nil {
    		BuildQuerySQL(db)
    
    		if !db.DryRun && db.Error == nil {
    			rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    			if err != nil {
    				db.AddError(err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
Back to top