update sqlc gen

This commit is contained in:
Pavel 2024-04-21 18:18:53 +03:00
parent 134018576f
commit 30192e61cb
2 changed files with 41 additions and 24 deletions

@ -692,25 +692,25 @@ SELECT *, COUNT(*) OVER() as total_count FROM users WHERE Deleted = false AND Ac
-- name: GetTagsWithPagination :many -- name: GetTagsWithPagination :many
SELECT t.*, COUNT(*) OVER() as total_count SELECT t.*, COUNT(*) OVER() as total_count
FROM tags t JOIN (SELECT AmoID FROM users WHERE AccountID = $1) u ON t.AccountID = u.AmoID FROM tags t JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON t.AccountID = u.AmoID
WHERE t.Deleted = false WHERE t.Deleted = false
ORDER BY t.ID OFFSET ($2 - 1) * $3 LIMIT $3; ORDER BY t.ID OFFSET ($2 - 1) * $3 LIMIT $3;
-- name: GetStepsWithPagination :many -- name: GetStepsWithPagination :many
SELECT s.*, COUNT(*) OVER() as total_count SELECT s.*, COUNT(*) OVER() as total_count
FROM steps s JOIN (SELECT AmoID FROM users WHERE AccountID = $1) u ON s.AccountID = u.AmoID FROM steps s JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON s.AccountID = u.AmoID
WHERE s.Deleted = false WHERE s.Deleted = false
ORDER BY s.ID OFFSET ($2 - 1) * $3 LIMIT $3; ORDER BY s.ID OFFSET ($2 - 1) * $3 LIMIT $3;
-- name: GetPipelinesWithPagination :many -- name: GetPipelinesWithPagination :many
SELECT p.*, COUNT(*) OVER() as total_count SELECT p.*, COUNT(*) OVER() as total_count
FROM pipelines p JOIN (SELECT AmoID FROM users WHERE AccountID = $1) u ON p.AccountID = u.AmoID FROM pipelines p JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON p.AccountID = u.AmoID
WHERE p.Deleted = false WHERE p.Deleted = false
ORDER BY p.ID OFFSET ($2 - 1) * $3 LIMIT $3; ORDER BY p.ID OFFSET ($2 - 1) * $3 LIMIT $3;
-- name: GetFieldsWithPagination :many -- name: GetFieldsWithPagination :many
SELECT f.*, COUNT(*) OVER() as total_count SELECT f.*, COUNT(*) OVER() as total_count
FROM fields f JOIN (SELECT AmoID FROM users WHERE AccountID = $1) u ON f.AccountID = u.AmoID FROM fields f JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON f.AccountID = u.AmoID
WHERE f.Deleted = false WHERE f.Deleted = false
ORDER BY f.ID OFFSET ($2 - 1) * $3 LIMIT $3; ORDER BY f.ID OFFSET ($2 - 1) * $3 LIMIT $3;

@ -1396,12 +1396,16 @@ func (q *Queries) GetExpiredPrivilege(ctx context.Context, privilegeid sql.NullS
} }
const getFieldsWithPagination = `-- name: GetFieldsWithPagination :many const getFieldsWithPagination = `-- name: GetFieldsWithPagination :many
SELECT id, amoid, code, accountid, name, entity, type, deleted, createdat, COUNT(*) OVER() as total_count FROM fields WHERE Deleted = false ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2 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
WHERE f.Deleted = false
ORDER BY f.ID OFFSET ($2 - 1) * $3 LIMIT $3
` `
type GetFieldsWithPaginationParams struct { type GetFieldsWithPaginationParams struct {
Column1 interface{} `db:"column_1" json:"column_1"` Accountid string `db:"accountid" json:"accountid"`
Limit int32 `db:"limit" json:"limit"` Column2 interface{} `db:"column_2" json:"column_2"`
Limit int32 `db:"limit" json:"limit"`
} }
type GetFieldsWithPaginationRow struct { type GetFieldsWithPaginationRow struct {
@ -1418,7 +1422,7 @@ type GetFieldsWithPaginationRow struct {
} }
func (q *Queries) GetFieldsWithPagination(ctx context.Context, arg GetFieldsWithPaginationParams) ([]GetFieldsWithPaginationRow, error) { func (q *Queries) GetFieldsWithPagination(ctx context.Context, arg GetFieldsWithPaginationParams) ([]GetFieldsWithPaginationRow, error) {
rows, err := q.db.QueryContext(ctx, getFieldsWithPagination, arg.Column1, arg.Limit) rows, err := q.db.QueryContext(ctx, getFieldsWithPagination, arg.Accountid, arg.Column2, arg.Limit)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1452,12 +1456,16 @@ func (q *Queries) GetFieldsWithPagination(ctx context.Context, arg GetFieldsWith
} }
const getPipelinesWithPagination = `-- name: GetPipelinesWithPagination :many const getPipelinesWithPagination = `-- name: GetPipelinesWithPagination :many
SELECT id, amoid, accountid, name, isarchive, deleted, createdat, COUNT(*) OVER() as total_count FROM pipelines WHERE Deleted = false ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2 SELECT p.id, p.amoid, p.accountid, p.name, p.isarchive, p.deleted, p.createdat, COUNT(*) OVER() as total_count
FROM pipelines p JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON p.AccountID = u.AmoID
WHERE p.Deleted = false
ORDER BY p.ID OFFSET ($2 - 1) * $3 LIMIT $3
` `
type GetPipelinesWithPaginationParams struct { type GetPipelinesWithPaginationParams struct {
Column1 interface{} `db:"column_1" json:"column_1"` Accountid string `db:"accountid" json:"accountid"`
Limit int32 `db:"limit" json:"limit"` Column2 interface{} `db:"column_2" json:"column_2"`
Limit int32 `db:"limit" json:"limit"`
} }
type GetPipelinesWithPaginationRow struct { type GetPipelinesWithPaginationRow struct {
@ -1472,7 +1480,7 @@ type GetPipelinesWithPaginationRow struct {
} }
func (q *Queries) GetPipelinesWithPagination(ctx context.Context, arg GetPipelinesWithPaginationParams) ([]GetPipelinesWithPaginationRow, error) { func (q *Queries) GetPipelinesWithPagination(ctx context.Context, arg GetPipelinesWithPaginationParams) ([]GetPipelinesWithPaginationRow, error) {
rows, err := q.db.QueryContext(ctx, getPipelinesWithPagination, arg.Column1, arg.Limit) rows, err := q.db.QueryContext(ctx, getPipelinesWithPagination, arg.Accountid, arg.Column2, arg.Limit)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2009,12 +2017,16 @@ func (q *Queries) GetResultAnswers(ctx context.Context, id int64) ([]GetResultAn
} }
const getStepsWithPagination = `-- name: GetStepsWithPagination :many const getStepsWithPagination = `-- name: GetStepsWithPagination :many
SELECT id, amoid, pipelineid, accountid, name, color, deleted, createdat, COUNT(*) OVER() as total_count FROM steps WHERE Deleted = false ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2 SELECT s.id, s.amoid, s.pipelineid, s.accountid, s.name, s.color, s.deleted, s.createdat, COUNT(*) OVER() as total_count
FROM steps s JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON s.AccountID = u.AmoID
WHERE s.Deleted = false
ORDER BY s.ID OFFSET ($2 - 1) * $3 LIMIT $3
` `
type GetStepsWithPaginationParams struct { type GetStepsWithPaginationParams struct {
Column1 interface{} `db:"column_1" json:"column_1"` Accountid string `db:"accountid" json:"accountid"`
Limit int32 `db:"limit" json:"limit"` Column2 interface{} `db:"column_2" json:"column_2"`
Limit int32 `db:"limit" json:"limit"`
} }
type GetStepsWithPaginationRow struct { type GetStepsWithPaginationRow struct {
@ -2030,7 +2042,7 @@ type GetStepsWithPaginationRow struct {
} }
func (q *Queries) GetStepsWithPagination(ctx context.Context, arg GetStepsWithPaginationParams) ([]GetStepsWithPaginationRow, error) { func (q *Queries) GetStepsWithPagination(ctx context.Context, arg GetStepsWithPaginationParams) ([]GetStepsWithPaginationRow, error) {
rows, err := q.db.QueryContext(ctx, getStepsWithPagination, arg.Column1, arg.Limit) rows, err := q.db.QueryContext(ctx, getStepsWithPagination, arg.Accountid, arg.Column2, arg.Limit)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2063,12 +2075,16 @@ func (q *Queries) GetStepsWithPagination(ctx context.Context, arg GetStepsWithPa
} }
const getTagsWithPagination = `-- name: GetTagsWithPagination :many const getTagsWithPagination = `-- name: GetTagsWithPagination :many
SELECT id, amoid, accountid, entity, name, color, deleted, createdat, COUNT(*) OVER() as total_count FROM tags WHERE Deleted = false ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2 SELECT t.id, t.amoid, t.accountid, t.entity, t.name, t.color, t.deleted, t.createdat, COUNT(*) OVER() as total_count
FROM tags t JOIN (SELECT AmoID FROM users WHERE users.AccountID = $1) u ON t.AccountID = u.AmoID
WHERE t.Deleted = false
ORDER BY t.ID OFFSET ($2 - 1) * $3 LIMIT $3
` `
type GetTagsWithPaginationParams struct { type GetTagsWithPaginationParams struct {
Column1 interface{} `db:"column_1" json:"column_1"` Accountid string `db:"accountid" json:"accountid"`
Limit int32 `db:"limit" json:"limit"` Column2 interface{} `db:"column_2" json:"column_2"`
Limit int32 `db:"limit" json:"limit"`
} }
type GetTagsWithPaginationRow struct { type GetTagsWithPaginationRow struct {
@ -2084,7 +2100,7 @@ type GetTagsWithPaginationRow struct {
} }
func (q *Queries) GetTagsWithPagination(ctx context.Context, arg GetTagsWithPaginationParams) ([]GetTagsWithPaginationRow, error) { func (q *Queries) GetTagsWithPagination(ctx context.Context, arg GetTagsWithPaginationParams) ([]GetTagsWithPaginationRow, error) {
rows, err := q.db.QueryContext(ctx, getTagsWithPagination, arg.Column1, arg.Limit) rows, err := q.db.QueryContext(ctx, getTagsWithPagination, arg.Accountid, arg.Column2, arg.Limit)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2135,12 +2151,13 @@ func (q *Queries) GetTokenById(ctx context.Context, accountid string) (Token, er
} }
const getUsersWithPagination = `-- name: GetUsersWithPagination :many const getUsersWithPagination = `-- name: GetUsersWithPagination :many
SELECT id, accountid, amoid, name, email, role, "Group", deleted, createdat, subdomain, amouserid, country, COUNT(*) OVER() as total_count FROM users WHERE Deleted = false ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2 SELECT id, accountid, amoid, name, email, role, "Group", deleted, createdat, subdomain, amouserid, country, COUNT(*) OVER() as total_count FROM users WHERE Deleted = false AND AccountID = $3 ORDER BY ID OFFSET ($1 - 1) * $2 LIMIT $2
` `
type GetUsersWithPaginationParams struct { type GetUsersWithPaginationParams struct {
Column1 interface{} `db:"column_1" json:"column_1"` Column1 interface{} `db:"column_1" json:"column_1"`
Limit int32 `db:"limit" json:"limit"` Limit int32 `db:"limit" json:"limit"`
Accountid string `db:"accountid" json:"accountid"`
} }
type GetUsersWithPaginationRow struct { type GetUsersWithPaginationRow struct {
@ -2160,7 +2177,7 @@ type GetUsersWithPaginationRow struct {
} }
func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPaginationParams) ([]GetUsersWithPaginationRow, error) { func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPaginationParams) ([]GetUsersWithPaginationRow, error) {
rows, err := q.db.QueryContext(ctx, getUsersWithPagination, arg.Column1, arg.Limit) rows, err := q.db.QueryContext(ctx, getUsersWithPagination, arg.Column1, arg.Limit, arg.Accountid)
if err != nil { if err != nil {
return nil, err return nil, err
} }