Created
January 19, 2020 13:22
-
-
Save yutakahashi114/a8c56da28b65e9ad1469ca6098e2f5f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subQuery := builder. | |
Select("id"). | |
From("users"). | |
Where(builder.Eq{"last_name": "テスト"}). | |
Where(builder.Like{"last_name", "テスト"}). | |
Where(builder.In("last_name", "テスト", "テスト2")). | |
Where(builder.In("last_name", []string{"テスト", "テスト2"})). | |
Where(builder.Eq{"first_name": "太郎2"}. | |
Or(builder.Eq{"first_name": "太郎3"}). | |
Or(builder.Eq{"first_name": "太郎4"}), | |
). | |
Where(builder.Gte{"created_at": t}). | |
Where(builder.IsNull{"deleted_at"}) | |
fs := []friend{} | |
err = engine. | |
In("friend_id", subQuery). | |
Limit(10, 10). | |
Asc("id", "friend_id"). | |
Desc("user_id"). | |
Find(&fs) | |
if err != nil { | |
log.Println(err) | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment