16 lines
561 B
Go
16 lines
561 B
Go
package gmodel
|
|
|
|
import "context"
|
|
|
|
// TODO: 使用model的属性做你想做的
|
|
|
|
func (u *FsBackendUserModel) FindUserByEmail(ctx context.Context, emailname string) (resp FsBackendUser, err error) {
|
|
err = u.db.WithContext(ctx).Model(&FsBackendUser{}).Where("`email` = ?", emailname).Take(&resp).Error
|
|
return resp, err
|
|
}
|
|
|
|
func (u *FsBackendUserModel) FindUserById(ctx context.Context, Id int64) (resp FsBackendUser, err error) {
|
|
err = u.db.WithContext(ctx).Model(&FsBackendUser{}).Where("`id` = ? and status != ?", Id, 0).Take(&resp).Error
|
|
return resp, err
|
|
}
|