update sqlc gen
This commit is contained in:
parent
9803bbdff8
commit
ff9d34fa84
@ -960,7 +960,7 @@ FROM utms
|
||||
WHERE
|
||||
ID = ANY($1::int[]) AND Deleted = FALSE;
|
||||
|
||||
-- name: GetUserFieldsByID
|
||||
-- name: GetUserFieldsByID :many
|
||||
SELECT ID,AmoID,Code,AccountID,Name,Entity,Type
|
||||
FROM fields
|
||||
WHERE AccountID = $1;
|
||||
|
@ -600,55 +600,6 @@ func (q *Queries) CheckUsers(ctx context.Context, arg CheckUsersParams) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const checkUtms = `-- name: CheckUtms :many
|
||||
SELECT u.ID,u.AmoFieldID,u.QuizID,u.AccountID,u.Name,f.Name
|
||||
FROM
|
||||
utms u
|
||||
LEFT JOIN
|
||||
fields f ON u.Name = f.Name
|
||||
WHERE
|
||||
u.ID = ANY($1::int[]) AND u.Deleted = FALSE
|
||||
`
|
||||
|
||||
type CheckUtmsRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Amofieldid int32 `db:"amofieldid" json:"amofieldid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Name_2 sql.NullString `db:"name_2" json:"name_2"`
|
||||
}
|
||||
|
||||
func (q *Queries) CheckUtms(ctx context.Context, dollar_1 []int32) ([]CheckUtmsRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, checkUtms, pq.Array(dollar_1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []CheckUtmsRow
|
||||
for rows.Next() {
|
||||
var i CheckUtmsRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Amofieldid,
|
||||
&i.Quizid,
|
||||
&i.Accountid,
|
||||
&i.Name,
|
||||
&i.Name_2,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const copyQuestion = `-- name: CopyQuestion :one
|
||||
INSERT INTO question(
|
||||
quiz_id, title, description, questiontype, required,
|
||||
@ -2337,6 +2288,53 @@ func (q *Queries) GetUTMsWithPagination(ctx context.Context, arg GetUTMsWithPagi
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getUserFieldsByID = `-- name: GetUserFieldsByID :many
|
||||
SELECT ID,AmoID,Code,AccountID,Name,Entity,Type
|
||||
FROM fields
|
||||
WHERE AccountID = $1
|
||||
`
|
||||
|
||||
type GetUserFieldsByIDRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Code string `db:"code" json:"code"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Entity interface{} `db:"entity" json:"entity"`
|
||||
Type interface{} `db:"type" json:"type"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUserFieldsByID(ctx context.Context, accountid int32) ([]GetUserFieldsByIDRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getUserFieldsByID, accountid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetUserFieldsByIDRow
|
||||
for rows.Next() {
|
||||
var i GetUserFieldsByIDRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Amoid,
|
||||
&i.Code,
|
||||
&i.Accountid,
|
||||
&i.Name,
|
||||
&i.Entity,
|
||||
&i.Type,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getUsersWithPagination = `-- name: GetUsersWithPagination :many
|
||||
WITH user_data AS (
|
||||
SELECT AmoID FROM users WHERE users.AccountID = $1 AND Deleted = false
|
||||
@ -2407,6 +2405,50 @@ func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPa
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getUtmsByID = `-- name: GetUtmsByID :many
|
||||
SELECT ID,AmoFieldID,QuizID,AccountID,Name
|
||||
FROM utms
|
||||
WHERE
|
||||
ID = ANY($1::int[]) AND Deleted = FALSE
|
||||
`
|
||||
|
||||
type GetUtmsByIDRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Amofieldid int32 `db:"amofieldid" json:"amofieldid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUtmsByID(ctx context.Context, dollar_1 []int32) ([]GetUtmsByIDRow, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getUtmsByID, pq.Array(dollar_1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []GetUtmsByIDRow
|
||||
for rows.Next() {
|
||||
var i GetUtmsByIDRow
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Amofieldid,
|
||||
&i.Quizid,
|
||||
&i.Accountid,
|
||||
&i.Name,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const insertAnswers = `-- name: InsertAnswers :exec
|
||||
INSERT INTO answer(
|
||||
content,
|
||||
|
Loading…
Reference in New Issue
Block a user