update sqlc gen
This commit is contained in:
parent
775d9d32cf
commit
9a0b7b45cf
@ -10,7 +10,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/sqlc-dev/pqtype"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
@ -154,16 +153,16 @@ type Token struct {
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role string `db:"role" json:"role"`
|
||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lib/pq"
|
||||
"github.com/sqlc-dev/pqtype"
|
||||
)
|
||||
|
||||
const accountPagination = `-- name: AccountPagination :many
|
||||
@ -247,6 +246,29 @@ func (q *Queries) CheckFields(ctx context.Context, arg CheckFieldsParams) ([]Che
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const checkMainUser = `-- name: CheckMainUser :exec
|
||||
UPDATE users SET Name = $1, "Group" = $2, Email = $3, Role = $4 WHERE AmoID = $5
|
||||
`
|
||||
|
||||
type CheckMainUserParams struct {
|
||||
Name string `db:"name" json:"name"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
}
|
||||
|
||||
func (q *Queries) CheckMainUser(ctx context.Context, arg CheckMainUserParams) error {
|
||||
_, err := q.db.ExecContext(ctx, checkMainUser,
|
||||
arg.Name,
|
||||
arg.Group,
|
||||
arg.Email,
|
||||
arg.Role,
|
||||
arg.Amoid,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const checkPipelines = `-- name: CheckPipelines :many
|
||||
WITH new_pipelines AS (
|
||||
SELECT (pipeline->>'AmoID')::INT AS amoID,
|
||||
@ -499,24 +521,28 @@ func (q *Queries) CheckTags(ctx context.Context, arg CheckTagsParams) ([]CheckTa
|
||||
}
|
||||
|
||||
const checkUsers = `-- name: CheckUsers :exec
|
||||
UPDATE users SET Name = $1, "Group" = $2, Email = $3, Role = $4 WHERE AmoID = $5
|
||||
INSERT INTO users (AmoID, Name, Email, Role, "Group", AmoUserID)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (AmoID) DO NOTHING
|
||||
`
|
||||
|
||||
type CheckUsersParams struct {
|
||||
Name string `db:"name" json:"name"`
|
||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role string `db:"role" json:"role"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
}
|
||||
|
||||
func (q *Queries) CheckUsers(ctx context.Context, arg CheckUsersParams) error {
|
||||
_, err := q.db.ExecContext(ctx, checkUsers,
|
||||
arg.Amoid,
|
||||
arg.Name,
|
||||
arg.Group,
|
||||
arg.Email,
|
||||
arg.Role,
|
||||
arg.Amoid,
|
||||
arg.Group,
|
||||
arg.Amouserid,
|
||||
)
|
||||
return err
|
||||
}
|
||||
@ -663,17 +689,17 @@ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
||||
`
|
||||
|
||||
type CreateAmoAccountParams struct {
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role string `db:"role" json:"role"`
|
||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
}
|
||||
|
||||
// amo methods:
|
||||
@ -2100,19 +2126,19 @@ type GetUsersWithPaginationParams struct {
|
||||
}
|
||||
|
||||
type GetUsersWithPaginationRow struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role string `db:"role" json:"role"`
|
||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
Country string `db:"country" json:"country"`
|
||||
TotalCount int64 `db:"total_count" json:"total_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUsersWithPagination(ctx context.Context, arg GetUsersWithPaginationParams) ([]GetUsersWithPaginationRow, error) {
|
||||
@ -2720,6 +2746,31 @@ func (q *Queries) UpdateTags(ctx context.Context, dollar_1 json.RawMessage) erro
|
||||
return err
|
||||
}
|
||||
|
||||
const updateUsers = `-- name: UpdateUsers :exec
|
||||
UPDATE users SET Name = $2, Email = $3, Role = $4, "Group" = $5, AmoUserID = $6 WHERE AmoID = $1
|
||||
`
|
||||
|
||||
type UpdateUsersParams struct {
|
||||
Amoid int32 `db:"amoid" json:"amoid"`
|
||||
Name string `db:"name" json:"name"`
|
||||
Email string `db:"email" json:"email"`
|
||||
Role int32 `db:"role" json:"role"`
|
||||
Group int32 `db:"Group" json:"Group"`
|
||||
Amouserid int32 `db:"amouserid" json:"amouserid"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateUsers(ctx context.Context, arg UpdateUsersParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateUsers,
|
||||
arg.Amoid,
|
||||
arg.Name,
|
||||
arg.Email,
|
||||
arg.Role,
|
||||
arg.Group,
|
||||
arg.Amouserid,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const webhookDelete = `-- name: WebhookDelete :exec
|
||||
DELETE FROM tokens WHERE AccountID = $1
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user