userQuery :=UserQuery{NameStartOr: &[]string{"Bob", "John", "Tim"}}users, err := userDataAccess.Query(ctx, userQuery)// SQL="SELECT id, name, score, memo, deleted FROM t_user // WHERE (name LIKE ? OR name LIKE ? OR name LIKE ?)" args="[Bob% John% Tim%]"
UserOr *UserQuery
userQuery :=UserQuery{UserOr: &UserQuery{IdIn: &[]int64{1, 4, 12}, Deleted: P(true)}}users, err := userDataAccess.Query(ctx, userQuery)// SQL="SELECT id, name, score, memo, deleted FROM t_user // WHERE (id IN (?, ?, ?) OR deleted = ?)" args="[1 4 12 true]"
UsersOr *[]UserQuery
userQuery :=UserQuery{UsersOr: &[]UserQuery{ {IdIn: &[]int64{1, 4, 12}, Deleted: P(true)}, {IdGt: P(int64(10)), Deleted: P(false)},}}users, err := userDataAccess.Query(ctx, userQuery)// SQL="SELECT id, name, score, memo, deleted FROM t_user// WHERE (id IN (?, ?, ?) AND deleted = ? OR id > ? AND deleted = ?)"// args="[1 4 12 true 10 false]"
And Suffix
When the name of a field ends with And, the logical operator connecting multiple query conditions is AND.