Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for COALESCE (0.04 sec)

  1. tests/query_test.go

    	}
    
    	// SELECT COALESCE(age,'42') FROM users;
    	r = dryDB.Table("users").Select("COALESCE(age,?)", 42).Find(&User{})
    	if !regexp.MustCompile(`SELECT COALESCE\(age,.*\) FROM .*users.*`).MatchString(r.Statement.SQL.String()) {
    		t.Fatalf("Build Select with func, but got %v", r.Statement.SQL.String())
    	}
    
    	// named arguments
    	r = dryDB.Table("users").Select("COALESCE(age, @default)", sql.Named("default", 42)).Find(&User{})
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 50.4K bytes
    - Viewed (0)
Back to top