Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 117 for io (0.14 sec)

  1. clause/joins_test.go

    package clause_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func TestJoin(t *testing.T) {
    	results := []struct {
    		name string
    		join clause.Join
    		sql  string
    	}{
    		{
    			name: "LEFT JOIN",
    			join: clause.Join{
    				Type:  clause.LeftJoin,
    				Table: clause.Table{Name: "user"},
    				ON: clause.Where{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Nov 03 13:03:13 GMT 2022
    - 2.6K bytes
    - Viewed (0)
  2. callbacks/delete.go

    package callbacks
    
    import (
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func BeforeDelete(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && db.Statement.Schema.BeforeDelete {
    		callMethod(db, func(value interface{}, tx *gorm.DB) bool {
    			if i, ok := value.(BeforeDeleteInterface); ok {
    				db.AddError(i.BeforeDelete(tx))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  3. logger/logger.go

    package logger
    
    import (
    	"context"
    	"errors"
    	"fmt"
    	"io"
    	"log"
    	"os"
    	"time"
    
    	"gorm.io/gorm/utils"
    )
    
    // ErrRecordNotFound record not found error
    var ErrRecordNotFound = errors.New("record not found")
    
    // Colors
    const (
    	Reset       = "\033[0m"
    	Red         = "\033[31m"
    	Green       = "\033[32m"
    	Yellow      = "\033[33m"
    	Blue        = "\033[34m"
    	Magenta     = "\033[35m"
    	Cyan        = "\033[36m"
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  4. tests/update_belongs_to_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateBelongsTo(t *testing.T) {
    	user := *GetUser("update-belongs-to", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Company = Company{Name: "company-belongs-to-association"}
    	user.Manager = &User{Name: "manager-belongs-to-association"}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  5. migrator.go

    package gorm
    
    import (
    	"reflect"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    )
    
    // Migrator returns migrator
    func (db *DB) Migrator() Migrator {
    	tx := db.getInstance()
    
    	// apply scopes to migrator
    	for len(tx.Statement.scopes) > 0 {
    		tx = tx.executeScopes()
    	}
    
    	return tx.Dialector.Migrator(tx.Session(&Session{}))
    }
    
    // AutoMigrate run auto migration for given models
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  6. tests/table_test.go

    package tests_test
    
    import (
    	"regexp"
    	"sync"
    	"testing"
    
    	"gorm.io/driver/postgres"
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    	. "gorm.io/gorm/utils/tests"
    )
    
    type UserWithTable struct {
    	gorm.Model
    	Name string
    }
    
    func (UserWithTable) TableName() string {
    	return "gorm.user"
    }
    
    func TestTable(t *testing.T) {
    	dryDB := DB.Session(&gorm.Session{DryRun: true})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  7. 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)
  8. tests/gorm_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/driver/mysql"
    
    	"gorm.io/gorm"
    )
    
    func TestOpen(t *testing.T) {
    	dsn := "gorm:gorm@tcp(localhost:9910)/gorm?loc=Asia%2FHongKong" // invalid loc
    	_, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
    	if err == nil {
    		t.Fatalf("should returns error but got nil")
    	}
    }
    
    func TestReturningWithNullToZeroValues(t *testing.T) {
    	dialect := DB.Dialector.Name()
    	switch dialect {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jun 01 07:22:21 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  9. finisher_api.go

    package gorm
    
    import (
    	"database/sql"
    	"errors"
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Create inserts value, returning the inserted data's primary key in value's id
    func (db *DB) Create(value interface{}) (tx *DB) {
    	if db.CreateBatchSize > 0 {
    		return db.CreateInBatches(value, db.CreateBatchSize)
    	}
    
    	tx = db.getInstance()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  10. callbacks/transaction.go

    package callbacks
    
    import (
    	"gorm.io/gorm"
    )
    
    func BeginTransaction(db *gorm.DB) {
    	if !db.Config.SkipDefaultTransaction && db.Error == nil {
    		if tx := db.Begin(); tx.Error == nil {
    			db.Statement.ConnPool = tx.Statement.ConnPool
    			db.InstanceSet("gorm:started_transaction", true)
    		} else if tx.Error == gorm.ErrInvalidTransaction {
    			tx.Error = nil
    		} else {
    			db.Error = tx.Error
    		}
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Nov 29 01:33:20 GMT 2021
    - 675 bytes
    - Viewed (0)
Back to top