Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for RegExp (0.23 sec)

  1. tests/scanner_valuer_test.go

    package tests_test
    
    import (
    	"context"
    	"database/sql"
    	"database/sql/driver"
    	"encoding/json"
    	"errors"
    	"fmt"
    	"reflect"
    	"regexp"
    	"strconv"
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestScannerValuer(t *testing.T) {
    	DB.Migrator().DropTable(&ScannerValuerStruct{})
    	if err := DB.Migrator().AutoMigrate(&ScannerValuerStruct{}); err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K 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 21 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  3. schema/constraint.go

    package schema
    
    import (
    	"regexp"
    	"strings"
    
    	"gorm.io/gorm/clause"
    )
    
    // reg match english letters and midline
    var regEnLetterAndMidline = regexp.MustCompile(`^[\w-]+$`)
    
    type CheckConstraint struct {
    	Name       string
    	Constraint string // length(phone) >= 10
    	*Field
    }
    
    func (chk *CheckConstraint) GetName() string { return chk.Name }
    
    func (chk *CheckConstraint) Build() (sql string, vars []interface{}) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  4. tests/soft_delete_test.go

    	if !regexp.MustCompile(`UPDATE .users. SET .deleted_at.=.* WHERE .users.\..id. = .* AND .users.\..deleted_at. IS NULL`).MatchString(sql) {
    		t.Fatalf("invalid sql generated, got %v", sql)
    	}
    
    	sql = DB.Session(&gorm.Session{DryRun: true}).Table("user u").Select("name").Find(&User{}).Statement.SQL.String()
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  5. logger/sql.go

    	}
    }
    
    // ExplainSQL generate SQL string with given parameters, the generated SQL is expected to be used in logger, execute it might introduce a SQL injection vulnerability
    func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string {
    	var (
    		convertParams func(interface{}, int)
    		vars          = make([]string, len(avars))
    	)
    
    	convertParams = func(v interface{}, idx int) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  6. tests/count_test.go

    	result := dryDB.Table("users").Select("name").Count(&count)
    	if !regexp.MustCompile(`SELECT COUNT\(.name.\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Table("users").Distinct("name").Count(&count)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  7. tests/distinct_test.go

    package tests_test
    
    import (
    	"regexp"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestDistinct(t *testing.T) {
    	users := []User{
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct", Config{}),
    		*GetUser("distinct-2", Config{}),
    		*GetUser("distinct-3", Config{}),
    	}
    	users[0].Age = 20
    
    	if err := DB.Create(&users).Error; err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
  8. tests/table_test.go

    	if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("user as u").Select("name").Find(&User{}).Statement
    	if !regexp.MustCompile("SELECT .name. FROM user as u WHERE .u.\\..deleted_at. IS NULL").MatchString(r.Statement.SQL.String()) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  9. schema/naming.go

    package schema
    
    import (
    	"crypto/sha1"
    	"encoding/hex"
    	"regexp"
    	"strings"
    	"unicode/utf8"
    
    	"github.com/jinzhu/inflection"
    )
    
    // Namer namer interface
    type Namer interface {
    	TableName(table string) string
    	SchemaName(table string) string
    	ColumnName(table, column string) string
    	JoinTableName(joinTable string) string
    	RelationshipFKName(Relationship) string
    	CheckerName(table, column string) string
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  10. tests/joins_test.go

    package tests_test
    
    import (
    	"regexp"
    	"sort"
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestJoins(t *testing.T) {
    	user := *GetUser("joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false})
    
    	DB.Create(&user)
    
    	var user2 User
    	if err := DB.Joins("NamedPet").Joins("Company").Joins("Manager").Joins("Account").First(&user2, "users.name = ?", user.Name).Error; err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
Back to top