Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 629 for gorm (0.32 sec)

  1. gorm.go

    package gorm
    
    import (
    	"context"
    	"database/sql"
    	"fmt"
    	"reflect"
    	"sort"
    	"sync"
    	"time"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    )
    
    // for Config.cacheStore store PreparedStmtDB key
    const preparedStmtDBKey = "preparedStmt"
    
    // Config GORM config
    type Config struct {
    	// GORM perform single create, update, delete operations in transactions by default to ensure database data integrity
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. 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)
  3. schema/relationship_test.go

    	type Tag struct {
    		ID     uint   `gorm:"primary_key"`
    		Locale string `gorm:"primary_key"`
    		Value  string
    	}
    
    	type Blog struct {
    		ID         uint   `gorm:"primary_key"`
    		Locale     string `gorm:"primary_key"`
    		Subject    string
    		Body       string
    		Tags       []Tag `gorm:"many2many:blog_tags;"`
    		SharedTags []Tag `gorm:"many2many:shared_blog_tags;ForeignKey:id;References:id"`
    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)
  4. .github/workflows/tests.yml

          with:
            path: ~/go/pkg/mod
            key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
    
        - name: Tests
          run: GITHUB_ACTION=true GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
    
      mariadb:
        strategy:
          matrix:
            dbversion: [ 'mariadb:latest' ]
            go: ['1.21', '1.20', '1.19']
    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)
  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 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  6. 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)
  7. tests/docker-compose.yml

          - "9910:3306"
        environment:
          - MYSQL_DATABASE=gorm
          - MYSQL_USER=gorm
          - MYSQL_PASSWORD=gorm
          - MYSQL_RANDOM_ROOT_PASSWORD="yes"
      postgres:
        image: 'postgres:latest'
        ports:
          - "9920:5432"
        environment:
          - TZ=Asia/Shanghai
          - POSTGRES_DB=gorm
          - POSTGRES_USER=gorm
          - POSTGRES_PASSWORD=gorm
      mssql:
        image: '${MSSQL_IMAGE:-mcmoe/mssqldocker}:latest'
    Others
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 862 bytes
    - Viewed (0)
  8. utils/tests/models.go

    	Friends   []*User    `gorm:"many2many:user_friends;"`
    	Active    bool
    }
    
    type Account struct {
    	gorm.Model
    	UserID sql.NullInt64
    	Number string
    }
    
    type Pet struct {
    	gorm.Model
    	UserID *uint
    	Name   string
    	Toy    Toy `gorm:"polymorphic:Owner;"`
    }
    
    type Toy struct {
    	gorm.Model
    	Name      string
    	OwnerID   string
    	OwnerType string
    }
    
    type Tools struct {
    	gorm.Model
    	Name     string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  9. 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)
  10. 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)
Back to top