sqlx
This commit is contained in:
@@ -10,25 +10,21 @@ import (
|
||||
type LoginLogRepository interface {
|
||||
Create(ctx context.Context, obj *LoginLog) error
|
||||
GetLatest(ctx context.Context, email string) ([]*LoginLog, error)
|
||||
List(ctx context.Context, q dto.SearchDto) ([]*LoginLog, int64, error)
|
||||
Count(ctx context.Context, email string) (int64, error)
|
||||
Count(ctx context.Context, filter dto.SearchDto) (int64, error)
|
||||
List(ctx context.Context, filter dto.SearchDto) ([]*LoginLog, error)
|
||||
}
|
||||
|
||||
type LoginLog struct {
|
||||
ID int64 `json:"id" gorm:"primaryKey;autoIncrement;not null"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"type:timestamptz;not null;default:'now()'"`
|
||||
Email string `json:"email" gorm:"type:varchar(100);not null;"`
|
||||
IsSuccess bool `json:"is_success" gorm:"type:boolean;not null;"`
|
||||
Message string `json:"message" gorm:"type:varchar(300);not null;"`
|
||||
RefererUrl string `json:"referer_url" gorm:"type:varchar(500);not null;"`
|
||||
Url string `json:"url" gorm:"type:varchar(500);not null;"`
|
||||
Os string `json:"os" gorm:"type:varchar(50);not null;"`
|
||||
Ip string `json:"ip" gorm:"type:varchar(20);not null;"`
|
||||
Browser string `json:"browser" gorm:"type:varchar(100);not null;"`
|
||||
}
|
||||
|
||||
func (*LoginLog) TableName() string {
|
||||
return "sys_user_login_log"
|
||||
ID int64 `db:"id" json:"id"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
||||
Email string `db:"email" json:"email"`
|
||||
IsSuccess bool `db:"is_success" json:"is_success"`
|
||||
Message string `db:"message" json:"message"`
|
||||
RefererUrl string `db:"referer_url" json:"referer_url"`
|
||||
Url string `db:"url" json:"url"`
|
||||
Os string `db:"os" json:"os"`
|
||||
Ip string `db:"ip" json:"ip"`
|
||||
Browser string `db:"browser" json:"browser"`
|
||||
}
|
||||
|
||||
func NewLoginLog(email, os, ip, browser, url, referer string) *LoginLog {
|
||||
|
||||
Reference in New Issue
Block a user