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.
52 lines
1.3 KiB
Go
52 lines
1.3 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: instance_settings.sql
|
|
|
|
package instance
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"encoding/json"
|
|
)
|
|
|
|
const getInstanceSetting = `-- name: GetInstanceSetting :one
|
|
SELECT key, value, updated_at, updated_by
|
|
FROM core.instance_settings
|
|
WHERE key = $1
|
|
`
|
|
|
|
func (q *Queries) GetInstanceSetting(ctx context.Context, key string) (CoreInstanceSetting, error) {
|
|
row := q.db.QueryRowContext(ctx, getInstanceSetting, key)
|
|
var i CoreInstanceSetting
|
|
err := row.Scan(
|
|
&i.Key,
|
|
&i.Value,
|
|
&i.UpdatedAt,
|
|
&i.UpdatedBy,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const upsertInstanceSetting = `-- name: UpsertInstanceSetting :exec
|
|
INSERT INTO core.instance_settings (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 UpsertInstanceSettingParams struct {
|
|
Key string `json:"key"`
|
|
Value json.RawMessage `json:"value"`
|
|
UpdatedBy sql.NullString `json:"updated_by"`
|
|
}
|
|
|
|
func (q *Queries) UpsertInstanceSetting(ctx context.Context, arg UpsertInstanceSettingParams) error {
|
|
_, err := q.db.ExecContext(ctx, upsertInstanceSetting, arg.Key, arg.Value, arg.UpdatedBy)
|
|
return err
|
|
}
|