u
This commit is contained in:
1 parent
500fab7a80
commit
8f3f6982db
54 files changed
+2076
-1877
No files matched your search
@@ -7,8 +7,6 @@ package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const getUserByAccount = `-- name: GetUserByAccount :one
|
||||
@@ -95,32 +93,6 @@ func (q *Queries) GetUserForLogin(ctx context.Context, arg GetUserForLoginParams
|
||||
return i, err
|
||||
}
|
||||
|
||||
const insertUser = `-- name: InsertUser :execrows
|
||||
INSERT INTO user_info (id, account, password,username)
|
||||
VALUES ($1, $2, $3,$4)
|
||||
`
|
||||
|
||||
type InsertUserParams struct {
|
||||
ID int64
|
||||
Account string
|
||||
Password string
|
||||
Username pgtype.Text
|
||||
}
|
||||
|
||||
// 插入用户并返回刚创建的记录
|
||||
func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) (int64, error) {
|
||||
result, err := q.db.Exec(ctx, insertUser,
|
||||
arg.ID,
|
||||
arg.Account,
|
||||
arg.Password,
|
||||
arg.Username,
|
||||
)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return result.RowsAffected(), nil
|
||||
}
|
||||
|
||||
const updateUserActiveTime = `-- name: UpdateUserActiveTime :exec
|
||||
UPDATE user_info
|
||||
SET active_time = now()
|
||||
|
||||
Reference in new issue
Block a user