1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| package main
import ( "fmt"
"gorm.io/driver/mysql" "gorm.io/gorm" )
func main() { arg1 := "argument one" arg2 := "argument two" arg3 := "argument three" arg4 := "argument four" arg5 := "argument five" arg6 := "argument six" arg7 := "argument seven" fmt.Println(arg1, arg2, arg3, arg4, arg5, arg6, arg7) fmt.Println( arg1, arg2, arg3, arg4, arg5, arg6, arg7, )
sql := "SELECT id, name, info FROM t_user user LEFT JOIN t_info info ON user.id = info.user_id where name != ''" fmt.Println(sql) sql = ` SELECT id, name, info FROM t_user user LEFT JOIN t_info info ON user.id = info.user_id where name != '' and info != '' ` fmt.Println(sql) sql = "SELECT id, name, info FROM t_user user " + "LEFT JOIN t_info info ON user.id = info.user_id " + "where name != '' and info != ''" fmt.Println(sql)
if arg1 == arg2 && arg2 == arg3 && arg3 == arg4 && arg4 == arg5 && arg5 == arg6 && arg6 == arg7 { fmt.Println("pass") } if arg1 == arg2 && arg2 == arg3 && arg3 == arg4 && arg4 == arg5 && arg5 == arg6 && arg6 == arg7 { fmt.Println("pass") }
db, err := gorm.Open(mysql.Open(""), &gorm.Config{}) if err != nil { fmt.Println(err) return } db.Table("table").Select("id", "name", "info").Where("name != ? and info != ?", "", "").Find(nil) db.Table("table"). Select("id", "name", "info"). Where("name != ? and info != ?", "", ""). Find(nil) }
|