generate identity
This commit is contained in:
@@ -282,6 +282,29 @@ func (q *Queries) GetAccountByLoginKey(ctx context.Context, loginKey string) (Ac
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getClusterPrincipal = `-- name: GetClusterPrincipal :one
|
||||
SELECT id, kind, name, public_key, status, successor_id, created_at, disabled_at
|
||||
FROM principal
|
||||
WHERE kind = 'cluster'
|
||||
LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetClusterPrincipal(ctx context.Context) (Principal, error) {
|
||||
row := q.db.QueryRowContext(ctx, getClusterPrincipal)
|
||||
var i Principal
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Kind,
|
||||
&i.Name,
|
||||
&i.PublicKey,
|
||||
&i.Status,
|
||||
&i.SuccessorID,
|
||||
&i.CreatedAt,
|
||||
&i.DisabledAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getMembership = `-- name: GetMembership :one
|
||||
SELECT group_id, member_id, role, created_at
|
||||
FROM membership
|
||||
|
||||
@@ -40,6 +40,12 @@ FROM principal
|
||||
WHERE kind = sqlc.arg(kind)
|
||||
AND name = sqlc.arg(name);
|
||||
|
||||
-- name: GetClusterPrincipal :one
|
||||
SELECT *
|
||||
FROM principal
|
||||
WHERE kind = 'cluster'
|
||||
LIMIT 1;
|
||||
|
||||
-- name: ListPrincipals :many
|
||||
SELECT *
|
||||
FROM principal
|
||||
|
||||
Reference in New Issue
Block a user