update sqlc gen

This commit is contained in:
Pavel 2024-05-10 12:02:17 +03:00
parent 0c30ce306d
commit 6ff56437fd
2 changed files with 22 additions and 1 deletions

@ -1067,5 +1067,5 @@ SELECT ID,AccountID,AmoID,Name,Email,Role,"Group",Subdomain,AmoUserID,Country
FROM users
WHERE AmoUserID = $1 AND Deleted = false;
--name: GetFieldByAmoID :one
-- name: GetFieldByAmoID :one
SELECT * FROM fields WHERE AmoID = $1 AND Deleted = false;

@ -1532,6 +1532,27 @@ func (q *Queries) GetExpiredPrivilege(ctx context.Context, privilegeid sql.NullS
return items, nil
}
const getFieldByAmoID = `-- name: GetFieldByAmoID :one
SELECT id, amoid, code, accountid, name, entity, type, deleted, createdat FROM fields WHERE AmoID = $1 AND Deleted = false
`
func (q *Queries) GetFieldByAmoID(ctx context.Context, amoid int32) (Field, error) {
row := q.db.QueryRowContext(ctx, getFieldByAmoID, amoid)
var i Field
err := row.Scan(
&i.ID,
&i.Amoid,
&i.Code,
&i.Accountid,
&i.Name,
&i.Entity,
&i.Type,
&i.Deleted,
&i.Createdat,
)
return i, err
}
const getFieldsWithPagination = `-- name: GetFieldsWithPagination :many
SELECT f.id, f.amoid, f.code, f.accountid, f.name, f.entity, f.type, f.deleted, f.createdat, COUNT(*) OVER() as total_count
FROM fields f JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON f.AccountID = u.AmoID