wp-go/internal/dao/users.go

24 lines
503 B
Go
Raw Normal View History

2023-01-12 12:42:16 +00:00
package common
import (
"context"
2023-01-13 06:04:32 +00:00
"github/fthvgb1/wp-go/internal/pkg/models"
2023-01-12 12:42:16 +00:00
"github/fthvgb1/wp-go/model"
)
func GetUserById(a ...any) (r models.Users, err error) {
ctx := a[0].(context.Context)
uid := a[1].(uint64)
r, err = model.FindOneById[models.Users](ctx, uid)
return
}
func GetUserByName(a ...any) (r models.Users, err error) {
u := a[1].(string)
ctx := a[0].(context.Context)
r, err = model.FirstOne[models.Users](ctx, model.SqlBuilder{{
"user_login", u,
}}, "*", nil)
return
}