1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-22 11:30:32 +08:00

finish getUserRegex

This commit is contained in:
源文雨
2023-04-21 01:11:46 +08:00
parent 155420d0a7
commit 282c9539ec
5 changed files with 32 additions and 12 deletions

View File

@@ -79,9 +79,9 @@ func (u *UserDatabase) GetUserRegex(id int) (*Regex, error) {
reg, _ := sql.Find[Regex](&u.db, UserTableRegex, "WHERE ID="+strconv.Itoa(id))
u.mu.RUnlock()
reg.ID = *user.ID
rf := reflect.ValueOf(reg)
rf := reflect.ValueOf(&reg).Elem()
defaultrf := reflect.ValueOf(GetDefaultRegex())
for i := 0; i < rf.NumField(); i++ {
for i := 1; i < rf.NumField(); i++ {
if rf.Field(i).IsZero() {
rf.Field(i).Set(defaultrf.Field(i))
}