update sqlc gen
This commit is contained in:
parent
0b2b219d97
commit
80771c0493
@ -1048,9 +1048,9 @@ RETURNING p.id, p.privilegeID, p.account_id, p.privilege_name, p.amount, p.creat
|
|||||||
|
|
||||||
-- name: GetExistingContactAmo :many
|
-- name: GetExistingContactAmo :many
|
||||||
WITH getAmoID AS (
|
WITH getAmoID AS (
|
||||||
SELECT AmoID FROM amoContact WHERE AccountID = $1 AND Field IN ($2)
|
SELECT AmoID FROM amoContact WHERE amoContact.AccountID = $1 AND amoContact.Field IN ($2)
|
||||||
) SELECT DISTINCT * FROM amoContact
|
) SELECT DISTINCT * FROM amoContact
|
||||||
WHERE AccountID = $1 AND AmoID IN (SELECT AmoID FROM getAmoID);
|
WHERE amoContact.AccountID = $1 AND amoContact.AmoID IN (SELECT AmoID FROM getAmoID);
|
||||||
|
|
||||||
-- name: InsertContactAmo :one
|
-- name: InsertContactAmo :one
|
||||||
INSERT INTO amoContact (AccountID, AmoID, Field) VALUES ($1, $2, $3) RETURNING AmoID;
|
INSERT INTO amoContact (AccountID, AmoID, Field) VALUES ($1, $2, $3) RETURNING AmoID;
|
||||||
|
@ -1449,9 +1449,11 @@ func (q *Queries) GetCurrentCompany(ctx context.Context, accountid string) (Acco
|
|||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const getExistingContactAmo = `-- name: GetExistingContactAmo :one
|
const getExistingContactAmo = `-- name: GetExistingContactAmo :many
|
||||||
SELECT ID, AccountID, AmoID, Field
|
WITH getAmoID AS (
|
||||||
FROM amoContact WHERE AccountID = $1 AND Field = $2
|
SELECT AmoID FROM amoContact WHERE amoContact.AccountID = $1 AND amoContact.Field IN ($2)
|
||||||
|
) SELECT DISTINCT id, accountid, amoid, field FROM amoContact
|
||||||
|
WHERE amoContact.AccountID = $1 AND amoContact.AmoID IN (SELECT AmoID FROM getAmoID)
|
||||||
`
|
`
|
||||||
|
|
||||||
type GetExistingContactAmoParams struct {
|
type GetExistingContactAmoParams struct {
|
||||||
@ -1459,16 +1461,32 @@ type GetExistingContactAmoParams struct {
|
|||||||
Field string `db:"field" json:"field"`
|
Field string `db:"field" json:"field"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) GetExistingContactAmo(ctx context.Context, arg GetExistingContactAmoParams) (Amocontact, error) {
|
func (q *Queries) GetExistingContactAmo(ctx context.Context, arg GetExistingContactAmoParams) ([]Amocontact, error) {
|
||||||
row := q.db.QueryRowContext(ctx, getExistingContactAmo, arg.Accountid, arg.Field)
|
rows, err := q.db.QueryContext(ctx, getExistingContactAmo, arg.Accountid, arg.Field)
|
||||||
var i Amocontact
|
if err != nil {
|
||||||
err := row.Scan(
|
return nil, err
|
||||||
&i.ID,
|
}
|
||||||
&i.Accountid,
|
defer rows.Close()
|
||||||
&i.Amoid,
|
var items []Amocontact
|
||||||
&i.Field,
|
for rows.Next() {
|
||||||
)
|
var i Amocontact
|
||||||
return i, err
|
if err := rows.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.Accountid,
|
||||||
|
&i.Amoid,
|
||||||
|
&i.Field,
|
||||||
|
); 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 getExpiredCountPrivilege = `-- name: GetExpiredCountPrivilege :many
|
const getExpiredCountPrivilege = `-- name: GetExpiredCountPrivilege :many
|
||||||
|
Loading…
Reference in New Issue
Block a user