Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 49 for Database (9.51 sec)

  1. tests/preload_suits_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"encoding/json"
    	"reflect"
    	"sort"
    	"sync/atomic"
    	"testing"
    
    	"gorm.io/gorm"
    )
    
    func toJSONString(v interface{}) []byte {
    	r, _ := json.Marshal(v)
    	return r
    }
    
    func TestNestedPreload1(t *testing.T) {
    	type (
    		Level1 struct {
    			ID       uint
    			Value    string
    			Level2ID uint
    		}
    		Level2 struct {
    			ID       uint
    			Level1   Level1
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  2. tests/transaction_test.go

    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestTransactionOnClosedConn(t *testing.T) {
    	DB, err := OpenTestConnection(&gorm.Config{})
    	if err != nil {
    		t.Fatalf("failed to connect database, got error %v", err)
    	}
    	rawDB, _ := DB.DB()
    	rawDB.Close()
    
    	if err := DB.Transaction(func(tx *gorm.DB) error {
    		return nil
    	}); 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. interfaces.go

    package gorm
    
    import (
    	"context"
    	"database/sql"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    )
    
    // Dialector GORM database dialector
    type Dialector interface {
    	Name() string
    	Initialize(*DB) error
    	Migrator(db *DB) Migrator
    	DataTypeOf(*schema.Field) string
    	DefaultValueOf(*schema.Field) clause.Expression
    	BindVarTo(writer clause.Writer, stmt *Statement, v interface{})
    	QuoteTo(clause.Writer, string)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  4. tests/error_translator_test.go

    	type City struct {
    		gorm.Model
    		Name string `gorm:"unique"`
    	}
    
    	db, err := OpenTestConnection(&gorm.Config{TranslateError: true})
    	if err != nil {
    		t.Fatalf("failed to connect database, got error %v", err)
    	}
    
    	dialectors := map[string]bool{"sqlite": true, "postgres": true, "mysql": true, "sqlserver": true}
    	if supported, found := dialectors[db.Dialector.Name()]; !(found && supported) {
    		return
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  5. schema/model_test.go

    package schema_test
    
    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
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  6. README.md

    * SQL Builder, Upsert, Locking, Optimizer/Index/Comment Hints, NamedArg, Search/Update/Create with SQL Expr
    * Composite Primary Key
    * Auto Migrations
    * Logger
    * Extendable, flexible plugin API: Database Resolver (Multiple Databases, Read/Write Splitting) / Prometheus…
    * Every feature comes with tests
    * Developer Friendly
    
    ## Getting Started
    
    * GORM Guides [https://gorm.io](https://gorm.io)
    Plain Text
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:20:06 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  7. tests/update_test.go

    		Updates(&ElementWithIgnoredField{Value: "bar", IgnoredField: 100})
    
    	var result ElementWithIgnoredField
    	if err := DB.First(&result, elem.Id).Error; err != nil {
    		t.Errorf("error getting an element from database: %s", err.Error())
    	}
    
    	if result.IgnoredField != 0 {
    		t.Errorf("element's ignored field should not be updated")
    	}
    }
    
    func TestUpdateFromSubQuery(t *testing.T) {
    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)
  8. statement.go

    package gorm
    
    import (
    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"fmt"
    	"reflect"
    	"regexp"
    	"sort"
    	"strconv"
    	"strings"
    	"sync"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Statement statement
    type Statement struct {
    	*DB
    	TableExpr            *clause.Expr
    	Table                string
    	Model                interface{}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  9. schema/field_test.go

    package schema_test
    
    import (
    	"context"
    	"database/sql"
    	"reflect"
    	"sync"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    func TestFieldValuerAndSetter(t *testing.T) {
    	var (
    		userSchema, _ = schema.Parse(&tests.User{}, &sync.Map{}, schema.NamingStrategy{})
    		user          = tests.User{
    			Model: gorm.Model{
    				ID:        10,
    				CreatedAt: time.Now(),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  10. tests/tests_test.go

    	sqlserverDSN = "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
    	tidbDSN      = "root:@tcp(localhost:9940)/test?charset=utf8&parseTime=True&loc=Local"
    )
    
    func init() {
    	var err error
    	if DB, err = OpenTestConnection(&gorm.Config{}); err != nil {
    		log.Printf("failed to connect database, got error %v", err)
    		os.Exit(1)
    	} else {
    		sqlDB, err := DB.DB()
    		if err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 3.3K bytes
    - Viewed (1)
Back to top