Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
861 B
Go
29 lines
861 B
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package alias
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
|
|
)
|
|
|
|
// lookupAliasByValue returns the Alias for the provided value. Returns nil, nil
|
|
// if no Alias is found for the provided value. No Options are currently supported
|
|
func (r *Repository) lookupAliasByValue(ctx context.Context, value string) (*Alias, error) {
|
|
const op = "alias.(Repository).LookupAliasByValue"
|
|
if value == "" {
|
|
return nil, errors.New(ctx, errors.InvalidParameter, op, "value is empty")
|
|
}
|
|
a := allocAlias()
|
|
if err := r.reader.LookupWhere(ctx, a, "value = $1", []any{value}); err != nil {
|
|
if errors.IsNotFoundError(err) {
|
|
return nil, nil
|
|
}
|
|
return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("failed for %q", value)))
|
|
}
|
|
return a, nil
|
|
}
|