diff options
| author | lost+skunk <[email protected]> | 2024-06-14 00:05:21 +0300 |
|---|---|---|
| committer | lost+skunk <[email protected]> | 2024-06-14 00:05:21 +0300 |
| commit | 8f645d7ccb01c15650958f2f9dd14f15f9afd72b (patch) | |
| tree | 73725978cf40a28c477867b1470fe30846442094 /misc.go | |
| parent | fd031a255bdd8fab8db24d41535959276e815e70 (diff) | |
| download | devianter-8f645d7ccb01c15650958f2f9dd14f15f9afd72b.tar.gz devianter-8f645d7ccb01c15650958f2f9dd14f15f9afd72b.tar.bz2 devianter-8f645d7ccb01c15650958f2f9dd14f15f9afd72b.zip | |
небольшие улучшения
Diffstat (limited to 'misc.go')
| -rw-r--r-- | misc.go | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -116,13 +116,13 @@ func AEmedia(name string, t rune) (string, error) { } /* SEARCH */ -type search struct { - Total int `json:"estTotal"` - Pages int // only for 'a' and 'g' scope. - Results []deviantion `json:"deviations,results"` +type Search struct { + Total int `json:"estTotal"` + Pages int // only for 'a' and 'g' scope. + Results []Deviation `json:"deviations,results"` } -func Search(query string, page int, scope rune, user ...string) (ss search, e error) { +func SearchFunc(query string, page int, scope rune, user ...string) (ss Search, e error) { var url strings.Builder e = nil @@ -159,7 +159,8 @@ func Search(query string, page int, scope rune, user ...string) (ss search, e er ujson(url.String(), &ss) // расчёт, сколько всего страниц по запросу. без токена 417 страниц - максимум - for x := 0; x < int(math.Round(float64(ss.Total/25))); x++ { + totalfloat := int(math.Round(float64(ss.Total / 25))) + for x := 0; x < totalfloat; x++ { if x <= 417 { ss.Pages = x } |
