update sqlc gen

This commit is contained in:
Pavel 2024-04-22 11:37:07 +03:00
parent c17fb92c50
commit b6e53fdff7
2 changed files with 10 additions and 8 deletions

@ -691,8 +691,7 @@ UPDATE users SET Name = $1, "Group" = $2, Email = $3, Role = $4 WHERE AmoID = $5
WITH user_data AS ( WITH user_data AS (
SELECT AmoID FROM users WHERE users.AccountID = $1 AND Deleted = false SELECT AmoID FROM users WHERE users.AccountID = $1 AND Deleted = false
) )
SELECT u.ID, u.Name, u.Email, u.Role, u."Group", u.CreatedAt, u.Subdomain, u.Country, u.AmoUserID, u.AmoID, SELECT u.*, COUNT(*) OVER() as total_count
COUNT(*) OVER() as total_count
FROM users u FROM users u
JOIN user_data a ON u.AmoUserID = a.AmoID JOIN user_data a ON u.AmoUserID = a.AmoID
WHERE u.Deleted = false WHERE u.Deleted = false

@ -2154,8 +2154,7 @@ const getUsersWithPagination = `-- name: GetUsersWithPagination :many
WITH user_data AS ( WITH user_data AS (
SELECT AmoID FROM users WHERE users.AccountID = $1 AND Deleted = false SELECT AmoID FROM users WHERE users.AccountID = $1 AND Deleted = false
) )
SELECT u.ID, u.Name, u.Email, u.Role, u."Group", u.CreatedAt, u.Subdomain, u.Country, u.AmoUserID, u.AmoID, SELECT u.id, u.accountid, u.amoid, u.name, u.email, u.role, u."Group", u.deleted, u.createdat, u.subdomain, u.amouserid, u.country, COUNT(*) OVER() as total_count
COUNT(*) OVER() as total_count
FROM users u FROM users u
JOIN user_data a ON u.AmoUserID = a.AmoID JOIN user_data a ON u.AmoUserID = a.AmoID
WHERE u.Deleted = false WHERE u.Deleted = false
@ -2170,15 +2169,17 @@ type GetUsersWithPaginationParams struct {
type GetUsersWithPaginationRow struct { type GetUsersWithPaginationRow struct {
ID int64 `db:"id" json:"id"` ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
Amoid int32 `db:"amoid" json:"amoid"`
Name string `db:"name" json:"name"` Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"` Email string `db:"email" json:"email"`
Role int32 `db:"role" json:"role"` Role int32 `db:"role" json:"role"`
Group int32 `db:"Group" json:"Group"` Group int32 `db:"Group" json:"Group"`
Deleted bool `db:"deleted" json:"deleted"`
Createdat sql.NullTime `db:"createdat" json:"createdat"` Createdat sql.NullTime `db:"createdat" json:"createdat"`
Subdomain string `db:"subdomain" json:"subdomain"` Subdomain string `db:"subdomain" json:"subdomain"`
Country string `db:"country" json:"country"`
Amouserid int32 `db:"amouserid" json:"amouserid"` Amouserid int32 `db:"amouserid" json:"amouserid"`
Amoid int32 `db:"amoid" json:"amoid"` Country string `db:"country" json:"country"`
TotalCount int64 `db:"total_count" json:"total_count"` TotalCount int64 `db:"total_count" json:"total_count"`
} }
@ -2193,15 +2194,17 @@ func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPa
var i GetUsersWithPaginationRow var i GetUsersWithPaginationRow
if err := rows.Scan( if err := rows.Scan(
&i.ID, &i.ID,
&i.Accountid,
&i.Amoid,
&i.Name, &i.Name,
&i.Email, &i.Email,
&i.Role, &i.Role,
&i.Group, &i.Group,
&i.Deleted,
&i.Createdat, &i.Createdat,
&i.Subdomain, &i.Subdomain,
&i.Country,
&i.Amouserid, &i.Amouserid,
&i.Amoid, &i.Country,
&i.TotalCount, &i.TotalCount,
); err != nil { ); err != nil {
return nil, err return nil, err