Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 70 for utils (0.14 sec)

  1. 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)
  2. 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)
  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. 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)
  6. 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)
  7. callbacks/query.go

    							nestedAlias := utils.NestedRelationName(parentTableName, rel.Name)
    							if _, ok := specifiedRelationsName[nestedAlias]; !ok {
    								fromClause.Joins = append(fromClause.Joins, genJoinClause(join.JoinType, parentTableName, rel))
    								specifiedRelationsName[nestedAlias] = nil
    							}
    
    							if parentTableName != clause.CurrentTable {
    								parentTableName = utils.NestedRelationName(parentTableName, rel.Name)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  8. callbacks/associations.go

    package callbacks
    
    import (
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func SaveBeforeAssociations(create bool) func(db *gorm.DB) {
    	return func(db *gorm.DB) {
    		if db.Error == nil && db.Statement.Schema != nil {
    			selectColumns, restricted := db.Statement.SelectAndOmitColumns(create, !create)
    
    			// Save Belongs To associations
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  9. logger/sql.go

    package logger
    
    import (
    	"database/sql/driver"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strconv"
    	"strings"
    	"time"
    	"unicode"
    
    	"gorm.io/gorm/utils"
    )
    
    const (
    	tmFmtWithMS = "2006-01-02 15:04:05.999"
    	tmFmtZero   = "0000-00-00 00:00:00"
    	nullStr     = "NULL"
    )
    
    func isPrintable(s string) bool {
    	for _, r := range s {
    		if !unicode.IsPrint(r) {
    			return false
    		}
    	}
    	return true
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  10. clause/benchmarks_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 BenchmarkSelect(b *testing.B) {
    	user, _ := schema.Parse(&tests.User{}, &sync.Map{}, db.NamingStrategy)
    
    	for i := 0; i < b.N; i++ {
    		stmt := gorm.Statement{DB: db, Table: user.Table, Schema: user, Clauses: map[string]clause.Clause{}}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Oct 07 12:14:14 GMT 2022
    - 1.9K bytes
    - Viewed (0)
Back to top