Files
member-console/internal/integration/config_overrides.sql.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

80 lines
2.0 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: config_overrides.sql
package integration
import (
"context"
"database/sql"
)
const deleteConfigOverride = `-- name: DeleteConfigOverride :execrows
DELETE FROM core.integration_config_overrides
WHERE key = $1
`
func (q *Queries) DeleteConfigOverride(ctx context.Context, key string) (int64, error) {
result, err := q.db.ExecContext(ctx, deleteConfigOverride, key)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
const listConfigOverrides = `-- name: ListConfigOverrides :many
SELECT key, value, updated_by, updated_at
FROM core.integration_config_overrides
ORDER BY key
`
func (q *Queries) ListConfigOverrides(ctx context.Context) ([]ConfigOverride, error) {
rows, err := q.db.QueryContext(ctx, listConfigOverrides)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ConfigOverride{}
for rows.Next() {
var i ConfigOverride
if err := rows.Scan(
&i.Key,
&i.Value,
&i.UpdatedBy,
&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 upsertConfigOverride = `-- name: UpsertConfigOverride :exec
INSERT INTO core.integration_config_overrides (key, value, updated_by)
VALUES ($1, $2, $3)
ON CONFLICT (key) DO UPDATE
SET value = EXCLUDED.value, updated_by = EXCLUDED.updated_by, updated_at = NOW()
`
type UpsertConfigOverrideParams struct {
Key string `json:"key"`
Value string `json:"value"`
UpdatedBy sql.NullString `json:"updated_by"`
}
func (q *Queries) UpsertConfigOverride(ctx context.Context, arg UpsertConfigOverrideParams) error {
_, err := q.db.ExecContext(ctx, upsertConfigOverride, arg.Key, arg.Value, arg.UpdatedBy)
return err
}