Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 74 for utils (0.16 sec)

  1. schema/utils.go

    package schema
    
    import (
    	"context"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    )
    
    var embeddedCacheKey = "embedded_cache_store"
    
    func ParseTagSetting(str string, sep string) map[string]string {
    	settings := map[string]string{}
    	names := strings.Split(str, sep)
    
    	for i := 0; i < len(names); i++ {
    		j := i
    		if len(names[j]) > 0 {
    			for {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  2. utils/tests/utils.go

    	"fmt"
    	"go/ast"
    	"reflect"
    	"testing"
    	"time"
    
    	"gorm.io/gorm/utils"
    )
    
    func AssertObjEqual(t *testing.T, r, e interface{}, names ...string) {
    	for _, name := range names {
    		rv := reflect.Indirect(reflect.ValueOf(r))
    		ev := reflect.Indirect(reflect.ValueOf(e))
    		if rv.IsValid() != ev.IsValid() {
    			t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), r, e)
    			return
    		}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  3. utils/utils.go

    package utils
    
    import (
    	"database/sql/driver"
    	"fmt"
    	"path/filepath"
    	"reflect"
    	"runtime"
    	"strconv"
    	"strings"
    	"unicode"
    )
    
    var gormSourceDir string
    
    func init() {
    	_, file, _, _ := runtime.Caller(0)
    	// compatible solution to get gorm source directory with various operating systems
    	gormSourceDir = sourceDir(file)
    }
    
    func sourceDir(file string) string {
    	dir := filepath.Dir(file)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  4. utils/utils_test.go

    package utils
    
    import (
    	"database/sql"
    	"database/sql/driver"
    	"errors"
    	"math"
    	"strings"
    	"testing"
    	"time"
    )
    
    func TestIsValidDBNameChar(t *testing.T) {
    	for _, db := range []string{"db", "dbName", "db_name", "db1", "1dbname", "db$name"} {
    		if fields := strings.FieldsFunc(db, IsValidDBNameChar); len(fields) != 1 {
    			t.Fatalf("failed to parse db name %v", db)
    		}
    	}
    }
    
    func TestCheckTruth(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Feb 19 03:42:25 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  5. schema/utils_test.go

    Jinzhu <******@****.***> 1596190765 +0800
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jul 31 10:19:25 GMT 2020
    - 1.5K bytes
    - Viewed (0)
  6. utils/utils_unix_test.go

    package utils
    
    import (
    	"testing"
    )
    
    func TestSourceDir(t *testing.T) {
    	cases := []struct {
    		file string
    		want string
    	}{
    		{
    			file: "/Users/name/go/pkg/mod/gorm.io/gorm@v1.2.3/utils/utils.go",
    			want: "/Users/name/go/pkg/mod/gorm.io/",
    		},
    		{
    			file: "/go/work/proj/gorm/utils/utils.go",
    			want: "/go/work/proj/gorm/",
    		},
    		{
    			file: "/go/work/proj/gorm_alias/utils/utils.go",
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Nov 21 02:48:13 GMT 2022
    - 731 bytes
    - Viewed (0)
  7. utils/utils_windows_test.go

    package utils
    
    import (
    	"testing"
    )
    
    func TestSourceDir(t *testing.T) {
    	cases := []struct {
    		file string
    		want string
    	}{
    		{
    			file: `C:/Users/name/go/pkg/mod/gorm.io/gorm@v1.2.3/utils/utils.go`,
    			want: `C:/Users/name/go/pkg/mod/gorm.io/`,
    		},
    		{
    			file: `C:/go/work/proj/gorm/utils/utils.go`,
    			want: `C:/go/work/proj/gorm/`,
    		},
    		{
    			file: `C:/go/work/proj/gorm_alias/utils/utils.go`,
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Nov 21 02:48:13 GMT 2022
    - 715 bytes
    - Viewed (0)
  8. tests/update_many2many_test.go

    package tests_test
    
    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestUpdateMany2ManyAssociations(t *testing.T) {
    	user := *GetUser("update-many2many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Languages = []Language{{Code: "zh-CN", Name: "Chinese"}, {Code: "en", Name: "English"}}
    	for _, lang := range user.Languages {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  9. tests/associations_has_one_test.go

    package tests_test
    
    import (
    	"testing"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestHasOneAssociation(t *testing.T) {
    	user := *GetUser("hasone", Config{Account: true})
    
    	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)
    	DB.Model(&user2).Association("Account").Find(&user2.Account)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  10. schema/index_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils/tests"
    )
    
    type UserIndex struct {
    	Name         string `gorm:"index"`
    	Name2        string `gorm:"index:idx_name,unique"`
    	Name3        string `gorm:"index:,sort:desc,collate:utf8,type:btree,length:10,where:name3 != 'jinzhu'"`
    	Name4        string `gorm:"uniqueIndex"`
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
Back to top