mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
Projects become publicly browsable after admin approval; management and secret-adjacent reads (logs, variables, exec, connection URLs) require owner/member/admin auth, and platform controls sit behind RequireAdmin. - Backend: OptionalAuth middleware, read/authed/admin route groups, projects.is_approved + service_templates.owner_id migration, visibility-aware sqlc queries, admin overview/users/approval endpoints, EnsureAdminAccount bootstrap (ADMIN_* env), 30 seeded templates with owner CRUD, managed-database connection URLs gated owner+admin, fix DB.Stats() infinite recursion. - Frontend: expandable persisted sidebar + clickable user menu, public landing page with searchable docs browser (GitHub sync, bundled snapshot + localStorage fallback), DocsBrowser shared with /docs, template create/edit/JSON-upload for owned templates, database create dialog, admin console (stats, approvals, project edit/delete, user admin toggles), HA/Security/Usage polish with dead CSS tokens mapped to real theme vars, anonymous-safe gating on every mutation control. - Tests: safe window.localStorage access fixes happy-dom crashes in PlatformShell and canvas storage. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
589 lines
16 KiB
Go
589 lines
16 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: databases.sql
|
|
|
|
package sqlcdb
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
const countDatabaseServicesByUserAndName = `-- name: CountDatabaseServicesByUserAndName :one
|
|
SELECT COUNT(*)
|
|
FROM database_services
|
|
WHERE user_id = $1 AND LOWER(name) = LOWER($2)
|
|
`
|
|
|
|
type CountDatabaseServicesByUserAndNameParams struct {
|
|
UserID string `json:"user_id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
func (q *Queries) CountDatabaseServicesByUserAndName(ctx context.Context, arg CountDatabaseServicesByUserAndNameParams) (int64, error) {
|
|
row := q.db.QueryRowContext(ctx, countDatabaseServicesByUserAndName, arg.UserID, arg.Name)
|
|
var count int64
|
|
err := row.Scan(&count)
|
|
return count, err
|
|
}
|
|
|
|
const createDatabaseBackup = `-- name: CreateDatabaseBackup :exec
|
|
INSERT INTO database_backups (id, database_id, size, status, backup_path, created_at)
|
|
VALUES ($1, $2, $3, $4, $5, $6)
|
|
`
|
|
|
|
type CreateDatabaseBackupParams struct {
|
|
ID string `json:"id"`
|
|
DatabaseID string `json:"database_id"`
|
|
Size string `json:"size"`
|
|
Status string `json:"status"`
|
|
BackupPath sql.NullString `json:"backup_path"`
|
|
CreatedAt sql.NullTime `json:"created_at"`
|
|
}
|
|
|
|
func (q *Queries) CreateDatabaseBackup(ctx context.Context, arg CreateDatabaseBackupParams) error {
|
|
_, err := q.db.ExecContext(ctx, createDatabaseBackup,
|
|
arg.ID,
|
|
arg.DatabaseID,
|
|
arg.Size,
|
|
arg.Status,
|
|
arg.BackupPath,
|
|
arg.CreatedAt,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const createDatabaseService = `-- name: CreateDatabaseService :exec
|
|
INSERT INTO database_services (id, user_id, name, type, status, version, plan, region, created_at, updated_at)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
`
|
|
|
|
type CreateDatabaseServiceParams struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Status string `json:"status"`
|
|
Version string `json:"version"`
|
|
Plan string `json:"plan"`
|
|
Region string `json:"region"`
|
|
CreatedAt sql.NullTime `json:"created_at"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
}
|
|
|
|
func (q *Queries) CreateDatabaseService(ctx context.Context, arg CreateDatabaseServiceParams) error {
|
|
_, err := q.db.ExecContext(ctx, createDatabaseService,
|
|
arg.ID,
|
|
arg.UserID,
|
|
arg.Name,
|
|
arg.Type,
|
|
arg.Status,
|
|
arg.Version,
|
|
arg.Plan,
|
|
arg.Region,
|
|
arg.CreatedAt,
|
|
arg.UpdatedAt,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const databaseServiceExistsByIDAndUser = `-- name: DatabaseServiceExistsByIDAndUser :one
|
|
SELECT EXISTS(
|
|
SELECT 1 FROM database_services WHERE id = $1 AND user_id = $2
|
|
)
|
|
`
|
|
|
|
type DatabaseServiceExistsByIDAndUserParams struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) DatabaseServiceExistsByIDAndUser(ctx context.Context, arg DatabaseServiceExistsByIDAndUserParams) (bool, error) {
|
|
row := q.db.QueryRowContext(ctx, databaseServiceExistsByIDAndUser, arg.ID, arg.UserID)
|
|
var exists bool
|
|
err := row.Scan(&exists)
|
|
return exists, err
|
|
}
|
|
|
|
const deleteDatabaseServiceByIDAndUser = `-- name: DeleteDatabaseServiceByIDAndUser :exec
|
|
DELETE FROM database_services
|
|
WHERE id = $1 AND user_id = $2
|
|
`
|
|
|
|
type DeleteDatabaseServiceByIDAndUserParams struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) DeleteDatabaseServiceByIDAndUser(ctx context.Context, arg DeleteDatabaseServiceByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, deleteDatabaseServiceByIDAndUser, arg.ID, arg.UserID)
|
|
return err
|
|
}
|
|
|
|
const getDatabaseBackupByIDAndDatabaseAndUser = `-- name: GetDatabaseBackupByIDAndDatabaseAndUser :one
|
|
SELECT b.id, b.database_id, b.size, b.status, b.backup_path, b.created_at, b.completed_at
|
|
FROM database_backups b
|
|
JOIN database_services s ON s.id = b.database_id
|
|
WHERE b.id = $1 AND b.database_id = $2 AND s.user_id = $3
|
|
`
|
|
|
|
type GetDatabaseBackupByIDAndDatabaseAndUserParams struct {
|
|
ID string `json:"id"`
|
|
DatabaseID string `json:"database_id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) GetDatabaseBackupByIDAndDatabaseAndUser(ctx context.Context, arg GetDatabaseBackupByIDAndDatabaseAndUserParams) (DatabaseBackup, error) {
|
|
row := q.db.QueryRowContext(ctx, getDatabaseBackupByIDAndDatabaseAndUser, arg.ID, arg.DatabaseID, arg.UserID)
|
|
var i DatabaseBackup
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.DatabaseID,
|
|
&i.Size,
|
|
&i.Status,
|
|
&i.BackupPath,
|
|
&i.CreatedAt,
|
|
&i.CompletedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getDatabaseServiceByID = `-- name: GetDatabaseServiceByID :one
|
|
SELECT id, user_id, name, type, status, version, plan, region, connection_url, backup_schedule, next_backup_at, created_at, updated_at
|
|
FROM database_services
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetDatabaseServiceByID(ctx context.Context, id string) (DatabaseService, error) {
|
|
row := q.db.QueryRowContext(ctx, getDatabaseServiceByID, id)
|
|
var i DatabaseService
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.Name,
|
|
&i.Type,
|
|
&i.Status,
|
|
&i.Version,
|
|
&i.Plan,
|
|
&i.Region,
|
|
&i.ConnectionUrl,
|
|
&i.BackupSchedule,
|
|
&i.NextBackupAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getDatabaseServiceByIDAndUser = `-- name: GetDatabaseServiceByIDAndUser :one
|
|
SELECT id, user_id, name, type, status, version, plan, region, connection_url, backup_schedule, next_backup_at, created_at, updated_at
|
|
FROM database_services
|
|
WHERE id = $1 AND user_id = $2
|
|
`
|
|
|
|
type GetDatabaseServiceByIDAndUserParams struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) GetDatabaseServiceByIDAndUser(ctx context.Context, arg GetDatabaseServiceByIDAndUserParams) (DatabaseService, error) {
|
|
row := q.db.QueryRowContext(ctx, getDatabaseServiceByIDAndUser, arg.ID, arg.UserID)
|
|
var i DatabaseService
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.Name,
|
|
&i.Type,
|
|
&i.Status,
|
|
&i.Version,
|
|
&i.Plan,
|
|
&i.Region,
|
|
&i.ConnectionUrl,
|
|
&i.BackupSchedule,
|
|
&i.NextBackupAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getDatabaseServiceOwnerID = `-- name: GetDatabaseServiceOwnerID :one
|
|
SELECT user_id
|
|
FROM database_services
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetDatabaseServiceOwnerID(ctx context.Context, id string) (string, error) {
|
|
row := q.db.QueryRowContext(ctx, getDatabaseServiceOwnerID, id)
|
|
var user_id string
|
|
err := row.Scan(&user_id)
|
|
return user_id, err
|
|
}
|
|
|
|
const listAllDatabaseServices = `-- name: ListAllDatabaseServices :many
|
|
SELECT id, user_id, name, type, status, version, plan, region, connection_url, backup_schedule, next_backup_at, created_at, updated_at
|
|
FROM database_services
|
|
ORDER BY created_at DESC
|
|
`
|
|
|
|
func (q *Queries) ListAllDatabaseServices(ctx context.Context) ([]DatabaseService, error) {
|
|
rows, err := q.db.QueryContext(ctx, listAllDatabaseServices)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []DatabaseService{}
|
|
for rows.Next() {
|
|
var i DatabaseService
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.Name,
|
|
&i.Type,
|
|
&i.Status,
|
|
&i.Version,
|
|
&i.Plan,
|
|
&i.Region,
|
|
&i.ConnectionUrl,
|
|
&i.BackupSchedule,
|
|
&i.NextBackupAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
); 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 listDatabaseBackupsByDatabaseAndUser = `-- name: ListDatabaseBackupsByDatabaseAndUser :many
|
|
SELECT b.id, b.database_id, b.size, b.status, b.backup_path, b.created_at, b.completed_at
|
|
FROM database_backups b
|
|
JOIN database_services s ON s.id = b.database_id
|
|
WHERE b.database_id = $1 AND s.user_id = $2
|
|
ORDER BY b.created_at DESC
|
|
LIMIT $3
|
|
`
|
|
|
|
type ListDatabaseBackupsByDatabaseAndUserParams struct {
|
|
DatabaseID string `json:"database_id"`
|
|
UserID string `json:"user_id"`
|
|
Limit int32 `json:"limit"`
|
|
}
|
|
|
|
func (q *Queries) ListDatabaseBackupsByDatabaseAndUser(ctx context.Context, arg ListDatabaseBackupsByDatabaseAndUserParams) ([]DatabaseBackup, error) {
|
|
rows, err := q.db.QueryContext(ctx, listDatabaseBackupsByDatabaseAndUser, arg.DatabaseID, arg.UserID, arg.Limit)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []DatabaseBackup{}
|
|
for rows.Next() {
|
|
var i DatabaseBackup
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.DatabaseID,
|
|
&i.Size,
|
|
&i.Status,
|
|
&i.BackupPath,
|
|
&i.CreatedAt,
|
|
&i.CompletedAt,
|
|
); 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 listDatabaseServicesByUser = `-- name: ListDatabaseServicesByUser :many
|
|
SELECT id, user_id, name, type, status, version, plan, region, connection_url, backup_schedule, next_backup_at, created_at, updated_at
|
|
FROM database_services
|
|
WHERE user_id = $1
|
|
ORDER BY created_at DESC
|
|
`
|
|
|
|
func (q *Queries) ListDatabaseServicesByUser(ctx context.Context, userID string) ([]DatabaseService, error) {
|
|
rows, err := q.db.QueryContext(ctx, listDatabaseServicesByUser, userID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []DatabaseService{}
|
|
for rows.Next() {
|
|
var i DatabaseService
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.Name,
|
|
&i.Type,
|
|
&i.Status,
|
|
&i.Version,
|
|
&i.Plan,
|
|
&i.Region,
|
|
&i.ConnectionUrl,
|
|
&i.BackupSchedule,
|
|
&i.NextBackupAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
); 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 listDueDatabaseBackups = `-- name: ListDueDatabaseBackups :many
|
|
SELECT id, backup_schedule
|
|
FROM database_services
|
|
WHERE backup_schedule IS NOT NULL AND backup_schedule <> ''
|
|
AND next_backup_at IS NOT NULL AND next_backup_at <= NOW()
|
|
`
|
|
|
|
type ListDueDatabaseBackupsRow struct {
|
|
ID string `json:"id"`
|
|
BackupSchedule sql.NullString `json:"backup_schedule"`
|
|
}
|
|
|
|
func (q *Queries) ListDueDatabaseBackups(ctx context.Context) ([]ListDueDatabaseBackupsRow, error) {
|
|
rows, err := q.db.QueryContext(ctx, listDueDatabaseBackups)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
items := []ListDueDatabaseBackupsRow{}
|
|
for rows.Next() {
|
|
var i ListDueDatabaseBackupsRow
|
|
if err := rows.Scan(&i.ID, &i.BackupSchedule); 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 setDatabaseBackupScheduleByIDAndUser = `-- name: SetDatabaseBackupScheduleByIDAndUser :exec
|
|
UPDATE database_services
|
|
SET backup_schedule = $1, next_backup_at = $2, updated_at = $3
|
|
WHERE id = $4 AND user_id = $5
|
|
`
|
|
|
|
type SetDatabaseBackupScheduleByIDAndUserParams struct {
|
|
BackupSchedule sql.NullString `json:"backup_schedule"`
|
|
NextBackupAt sql.NullTime `json:"next_backup_at"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseBackupScheduleByIDAndUser(ctx context.Context, arg SetDatabaseBackupScheduleByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseBackupScheduleByIDAndUser,
|
|
arg.BackupSchedule,
|
|
arg.NextBackupAt,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
arg.UserID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const setDatabaseBackupStatusByID = `-- name: SetDatabaseBackupStatusByID :exec
|
|
UPDATE database_backups
|
|
SET status = $1, size = $2, completed_at = $3
|
|
WHERE id = $4
|
|
`
|
|
|
|
type SetDatabaseBackupStatusByIDParams struct {
|
|
Status string `json:"status"`
|
|
Size string `json:"size"`
|
|
CompletedAt sql.NullTime `json:"completed_at"`
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseBackupStatusByID(ctx context.Context, arg SetDatabaseBackupStatusByIDParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseBackupStatusByID,
|
|
arg.Status,
|
|
arg.Size,
|
|
arg.CompletedAt,
|
|
arg.ID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const setDatabaseNextBackupAt = `-- name: SetDatabaseNextBackupAt :exec
|
|
UPDATE database_services
|
|
SET next_backup_at = $1
|
|
WHERE id = $2
|
|
`
|
|
|
|
type SetDatabaseNextBackupAtParams struct {
|
|
NextBackupAt sql.NullTime `json:"next_backup_at"`
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseNextBackupAt(ctx context.Context, arg SetDatabaseNextBackupAtParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseNextBackupAt, arg.NextBackupAt, arg.ID)
|
|
return err
|
|
}
|
|
|
|
const setDatabaseServiceStatusAndConnectionByID = `-- name: SetDatabaseServiceStatusAndConnectionByID :exec
|
|
UPDATE database_services
|
|
SET status = $1, connection_url = $2, updated_at = $3
|
|
WHERE id = $4
|
|
`
|
|
|
|
type SetDatabaseServiceStatusAndConnectionByIDParams struct {
|
|
Status string `json:"status"`
|
|
ConnectionUrl sql.NullString `json:"connection_url"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseServiceStatusAndConnectionByID(ctx context.Context, arg SetDatabaseServiceStatusAndConnectionByIDParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseServiceStatusAndConnectionByID,
|
|
arg.Status,
|
|
arg.ConnectionUrl,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const setDatabaseServiceStatusByID = `-- name: SetDatabaseServiceStatusByID :exec
|
|
UPDATE database_services
|
|
SET status = $1, updated_at = $2
|
|
WHERE id = $3
|
|
`
|
|
|
|
type SetDatabaseServiceStatusByIDParams struct {
|
|
Status string `json:"status"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseServiceStatusByID(ctx context.Context, arg SetDatabaseServiceStatusByIDParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseServiceStatusByID, arg.Status, arg.UpdatedAt, arg.ID)
|
|
return err
|
|
}
|
|
|
|
const setDatabaseServiceStatusByIDAndUser = `-- name: SetDatabaseServiceStatusByIDAndUser :exec
|
|
UPDATE database_services
|
|
SET status = $1, updated_at = $2
|
|
WHERE id = $3 AND user_id = $4
|
|
`
|
|
|
|
type SetDatabaseServiceStatusByIDAndUserParams struct {
|
|
Status string `json:"status"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) SetDatabaseServiceStatusByIDAndUser(ctx context.Context, arg SetDatabaseServiceStatusByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, setDatabaseServiceStatusByIDAndUser,
|
|
arg.Status,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
arg.UserID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const updateDatabaseServiceNameAndPlanByIDAndUser = `-- name: UpdateDatabaseServiceNameAndPlanByIDAndUser :exec
|
|
UPDATE database_services
|
|
SET name = $1, plan = $2, updated_at = $3
|
|
WHERE id = $4 AND user_id = $5
|
|
`
|
|
|
|
type UpdateDatabaseServiceNameAndPlanByIDAndUserParams struct {
|
|
Name string `json:"name"`
|
|
Plan string `json:"plan"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) UpdateDatabaseServiceNameAndPlanByIDAndUser(ctx context.Context, arg UpdateDatabaseServiceNameAndPlanByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, updateDatabaseServiceNameAndPlanByIDAndUser,
|
|
arg.Name,
|
|
arg.Plan,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
arg.UserID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const updateDatabaseServiceNameByIDAndUser = `-- name: UpdateDatabaseServiceNameByIDAndUser :exec
|
|
UPDATE database_services
|
|
SET name = $1, updated_at = $2
|
|
WHERE id = $3 AND user_id = $4
|
|
`
|
|
|
|
type UpdateDatabaseServiceNameByIDAndUserParams struct {
|
|
Name string `json:"name"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) UpdateDatabaseServiceNameByIDAndUser(ctx context.Context, arg UpdateDatabaseServiceNameByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, updateDatabaseServiceNameByIDAndUser,
|
|
arg.Name,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
arg.UserID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const updateDatabaseServicePlanByIDAndUser = `-- name: UpdateDatabaseServicePlanByIDAndUser :exec
|
|
UPDATE database_services
|
|
SET plan = $1, updated_at = $2
|
|
WHERE id = $3 AND user_id = $4
|
|
`
|
|
|
|
type UpdateDatabaseServicePlanByIDAndUserParams struct {
|
|
Plan string `json:"plan"`
|
|
UpdatedAt sql.NullTime `json:"updated_at"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) UpdateDatabaseServicePlanByIDAndUser(ctx context.Context, arg UpdateDatabaseServicePlanByIDAndUserParams) error {
|
|
_, err := q.db.ExecContext(ctx, updateDatabaseServicePlanByIDAndUser,
|
|
arg.Plan,
|
|
arg.UpdatedAt,
|
|
arg.ID,
|
|
arg.UserID,
|
|
)
|
|
return err
|
|
}
|