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
|
||||
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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
const getExistingContactAmo = `-- name: GetExistingContactAmo :one
|
||||
SELECT ID, AccountID, AmoID, Field
|
||||
FROM amoContact WHERE AccountID = $1 AND Field = $2
|
||||
const getExistingContactAmo = `-- name: GetExistingContactAmo :many
|
||||
WITH getAmoID AS (
|
||||
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 {
|
||||
@ -1459,16 +1461,32 @@ type GetExistingContactAmoParams struct {
|
||||
Field string `db:"field" json:"field"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetExistingContactAmo(ctx context.Context, arg GetExistingContactAmoParams) (Amocontact, error) {
|
||||
row := q.db.QueryRowContext(ctx, getExistingContactAmo, arg.Accountid, arg.Field)
|
||||
var i Amocontact
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Accountid,
|
||||
&i.Amoid,
|
||||
&i.Field,
|
||||
)
|
||||
return i, err
|
||||
func (q *Queries) GetExistingContactAmo(ctx context.Context, arg GetExistingContactAmoParams) ([]Amocontact, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getExistingContactAmo, arg.Accountid, arg.Field)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Amocontact
|
||||
for rows.Next() {
|
||||
var i Amocontact
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user