gen with sqlc

This commit is contained in:
Pavel 2024-04-17 21:10:42 +03:00
parent b36797b22d
commit 2841043cde

@ -1015,13 +1015,28 @@ func (q *Queries) GetAllTokens(ctx context.Context) ([]Token, error) {
return items, nil
}
const getCurrentAccount = `-- name: GetCurrentAccount :exec
const getCurrentAccount = `-- name: GetCurrentAccount :one
SELECT id, accountid, amoid, name, email, role, "Group", deleted, createdat, subdomain, amouserid, country FROM users WHERE AccountID = $1
`
func (q *Queries) GetCurrentAccount(ctx context.Context, accountid string) error {
_, err := q.db.ExecContext(ctx, getCurrentAccount, accountid)
return err
func (q *Queries) GetCurrentAccount(ctx context.Context, accountid string) (User, error) {
row := q.db.QueryRowContext(ctx, getCurrentAccount, accountid)
var i User
err := row.Scan(
&i.ID,
&i.Accountid,
&i.Amoid,
&i.Name,
&i.Email,
&i.Role,
&i.Group,
&i.Deleted,
&i.Createdat,
&i.Subdomain,
&i.Amouserid,
&i.Country,
)
return i, err
}
const getExpiredPrivilege = `-- name: GetExpiredPrivilege :many