test
This commit is contained in:
parent
bf42f210db
commit
d6268acc60
2
job.go
2
job.go
@ -20,7 +20,7 @@ func jobRescan(j Job) {
|
|||||||
if len(ids) > 1 {
|
if len(ids) > 1 {
|
||||||
for i := 1; i <= (len(ids)/SQLMsgRescanJobSize)+1; i++ {
|
for i := 1; i <= (len(ids)/SQLMsgRescanJobSize)+1; i++ {
|
||||||
var s string
|
var s string
|
||||||
for _, id := range ids[((i - 1) * SQLMsgRescanJobSize):(i*SQLMsgRescanJobSize - 1)] {
|
for _, id := range ids[((i - 1) * SQLMsgRescanJobSize) : Min((i*SQLMsgRescanJobSize), len(ids))-1] {
|
||||||
s = s + fmt.Sprintf("SELECT %d id FROM DUAL UNION\n", id)
|
s = s + fmt.Sprintf("SELECT %d id FROM DUAL UNION\n", id)
|
||||||
}
|
}
|
||||||
s = s + `SELECT 0 id FROM DUAL WHERE 1 = 2;`
|
s = s + `SELECT 0 id FROM DUAL WHERE 1 = 2;`
|
||||||
|
16
utils.go
16
utils.go
@ -20,6 +20,22 @@ func logOnError(err error, msg string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Min(int a, int b) int {
|
||||||
|
if a < b {
|
||||||
|
return a
|
||||||
|
} else {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Max(int a, int b) int {
|
||||||
|
if a > b {
|
||||||
|
return a
|
||||||
|
} else {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func fromChatWarsDate(d string) (t time.Time, err error) {
|
func fromChatWarsDate(d string) (t time.Time, err error) {
|
||||||
r := regexp.MustCompile(`(?P<Day>[0-9]{2}) (?P<Month>(Wintar|Hornung|Lenzin|Ōstar|Winni|Brāh|Hewi|Aran|Witu|Wīndume|Herbist|Hailag)) (?P<Year>[0-9]{4})( (?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})){0,1}`)
|
r := regexp.MustCompile(`(?P<Day>[0-9]{2}) (?P<Month>(Wintar|Hornung|Lenzin|Ōstar|Winni|Brāh|Hewi|Aran|Witu|Wīndume|Herbist|Hailag)) (?P<Year>[0-9]{4})( (?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})){0,1}`)
|
||||||
if r.FindStringSubmatch(d) != nil {
|
if r.FindStringSubmatch(d) != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user