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.
46 lines
1.2 KiB
Go
46 lines
1.2 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: name_rules.sql
|
|
|
|
package domains
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const getNameRuleForLabel = `-- name: GetNameRuleForLabel :one
|
|
SELECT rule_id, root_claim_id, label, kind, note, created_at FROM domains.name_rules
|
|
WHERE label = $1
|
|
AND (root_claim_id = $2 OR root_claim_id IS NULL)
|
|
ORDER BY root_claim_id NULLS LAST
|
|
LIMIT 1
|
|
`
|
|
|
|
type GetNameRuleForLabelParams struct {
|
|
Label string `json:"label"`
|
|
RootClaimID uuid.NullUUID `json:"root_claim_id"`
|
|
}
|
|
|
|
// Exact-label policy lookup, root-scoped first then global (root_claim_id
|
|
// NULL). A NULL root_claim_id argument matches global rules only, since
|
|
// `root_claim_id = NULL` is never true.
|
|
func (q *Queries) GetNameRuleForLabel(ctx context.Context, arg GetNameRuleForLabelParams) (NameRule, error) {
|
|
row := q.db.QueryRowContext(ctx, getNameRuleForLabel, arg.Label, arg.RootClaimID)
|
|
var i NameRule
|
|
err := row.Scan(
|
|
&i.RuleID,
|
|
&i.RootClaimID,
|
|
&i.Label,
|
|
&i.Kind,
|
|
&i.Note,
|
|
&i.CreatedAt,
|
|
)
|
|
return i, err
|
|
}
|