update sqlc gen
This commit is contained in:
parent
775d9d32cf
commit
9a0b7b45cf
@ -10,7 +10,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/sqlc-dev/pqtype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Account struct {
|
type Account struct {
|
||||||
@ -159,8 +158,8 @@ type User struct {
|
|||||||
Amoid int32 `db:"amoid" json:"amoid"`
|
Amoid int32 `db:"amoid" json:"amoid"`
|
||||||
Name string `db:"name" json:"name"`
|
Name string `db:"name" json:"name"`
|
||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Role string `db:"role" json:"role"`
|
Role int32 `db:"role" json:"role"`
|
||||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
Group int32 `db:"Group" json:"Group"`
|
||||||
Deleted bool `db:"deleted" json:"deleted"`
|
Deleted bool `db:"deleted" json:"deleted"`
|
||||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/lib/pq"
|
"github.com/lib/pq"
|
||||||
"github.com/sqlc-dev/pqtype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const accountPagination = `-- name: AccountPagination :many
|
const accountPagination = `-- name: AccountPagination :many
|
||||||
@ -247,6 +246,29 @@ func (q *Queries) CheckFields(ctx context.Context, arg CheckFieldsParams) ([]Che
|
|||||||
return items, nil
|
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
|
const checkPipelines = `-- name: CheckPipelines :many
|
||||||
WITH new_pipelines AS (
|
WITH new_pipelines AS (
|
||||||
SELECT (pipeline->>'AmoID')::INT AS amoID,
|
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
|
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 {
|
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 {
|
func (q *Queries) CheckUsers(ctx context.Context, arg CheckUsersParams) error {
|
||||||
_, err := q.db.ExecContext(ctx, checkUsers,
|
_, err := q.db.ExecContext(ctx, checkUsers,
|
||||||
|
arg.Amoid,
|
||||||
arg.Name,
|
arg.Name,
|
||||||
arg.Group,
|
|
||||||
arg.Email,
|
arg.Email,
|
||||||
arg.Role,
|
arg.Role,
|
||||||
arg.Amoid,
|
arg.Group,
|
||||||
|
arg.Amouserid,
|
||||||
)
|
)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -667,8 +693,8 @@ type CreateAmoAccountParams struct {
|
|||||||
Amoid int32 `db:"amoid" json:"amoid"`
|
Amoid int32 `db:"amoid" json:"amoid"`
|
||||||
Name string `db:"name" json:"name"`
|
Name string `db:"name" json:"name"`
|
||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Role string `db:"role" json:"role"`
|
Role int32 `db:"role" json:"role"`
|
||||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
Group int32 `db:"Group" json:"Group"`
|
||||||
Deleted bool `db:"deleted" json:"deleted"`
|
Deleted bool `db:"deleted" json:"deleted"`
|
||||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||||
@ -2105,8 +2131,8 @@ type GetUsersWithPaginationRow struct {
|
|||||||
Amoid int32 `db:"amoid" json:"amoid"`
|
Amoid int32 `db:"amoid" json:"amoid"`
|
||||||
Name string `db:"name" json:"name"`
|
Name string `db:"name" json:"name"`
|
||||||
Email string `db:"email" json:"email"`
|
Email string `db:"email" json:"email"`
|
||||||
Role string `db:"role" json:"role"`
|
Role int32 `db:"role" json:"role"`
|
||||||
Group pqtype.NullRawMessage `db:"Group" json:"Group"`
|
Group int32 `db:"Group" json:"Group"`
|
||||||
Deleted bool `db:"deleted" json:"deleted"`
|
Deleted bool `db:"deleted" json:"deleted"`
|
||||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||||
@ -2720,6 +2746,31 @@ func (q *Queries) UpdateTags(ctx context.Context, dollar_1 json.RawMessage) erro
|
|||||||
return err
|
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
|
const webhookDelete = `-- name: WebhookDelete :exec
|
||||||
DELETE FROM tokens WHERE AccountID = $1
|
DELETE FROM tokens WHERE AccountID = $1
|
||||||
`
|
`
|
||||||
|
Loading…
Reference in New Issue
Block a user