remove unndeeded function
This commit is contained in:
+7
-10
@@ -63,9 +63,14 @@ func runKeygen(ctx context.Context, args []string) error {
|
|||||||
|
|
||||||
owner, err := q.OwnerByEmail(ctx, normEmail)
|
owner, err := q.OwnerByEmail(ctx, normEmail)
|
||||||
if errors.Is(err, pgx.ErrNoRows) {
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
var callsignArg any
|
||||||
|
if normCall != "" {
|
||||||
|
callsignArg = normCall
|
||||||
|
}
|
||||||
|
|
||||||
created, cerr := q.CreateOwner(ctx, db.CreateOwnerParams{
|
created, cerr := q.CreateOwner(ctx, db.CreateOwnerParams{
|
||||||
Email: normEmail,
|
Email: normEmail,
|
||||||
Callsign: nullableCallsign(normCall),
|
Callsign: callsignArg,
|
||||||
})
|
})
|
||||||
if cerr != nil {
|
if cerr != nil {
|
||||||
return fmt.Errorf("keygen: creating owner: %w", cerr)
|
return fmt.Errorf("keygen: creating owner: %w", cerr)
|
||||||
@@ -97,7 +102,7 @@ func runKeygen(ctx context.Context, args []string) error {
|
|||||||
Label: nullableString(*label),
|
Label: nullableString(*label),
|
||||||
Scopes: scopeList,
|
Scopes: scopeList,
|
||||||
QuotaTier: *tier,
|
QuotaTier: *tier,
|
||||||
ExpiresAt: expiresAt,
|
ExpiresAt: db.Timestamptz(expiresAt),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The keys_scopes_known CHECK rejects unknown scopes, which is the
|
// The keys_scopes_known CHECK rejects unknown scopes, which is the
|
||||||
@@ -149,11 +154,3 @@ func nullableString(s string) *string {
|
|||||||
|
|
||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
||||||
func nullableCallsign(s string) *string {
|
|
||||||
if s == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return &s
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user