mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Refactor auth package (#17962)
This commit is contained in:
parent
e61b390d54
commit
de8e3948a5
87 changed files with 2880 additions and 2770 deletions
|
@ -6,9 +6,12 @@ package db
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
|
@ -39,3 +42,16 @@ func ConvertUtf8ToUtf8mb4() error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Cell2Int64 converts a xorm.Cell type to int64,
|
||||
// and handles possible irregular cases.
|
||||
func Cell2Int64(val xorm.Cell) int64 {
|
||||
switch (*val).(type) {
|
||||
case []uint8:
|
||||
log.Trace("Cell2Int64 ([]uint8): %v", *val)
|
||||
|
||||
v, _ := strconv.ParseInt(string((*val).([]uint8)), 10, 64)
|
||||
return v
|
||||
}
|
||||
return (*val).(int64)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue