-- name: CreateIdentity :one INSERT INTO "identity" ( "login", "passphrase", "is_admin", "is_disabled" ) VALUES ( $1, $2, $3, $4 ) RETURNING *; -- name: GetIdentityByID :one SELECT * FROM "identity" WHERE "id" = $1 LIMIT 1; -- name: GetIdentityByLogin :one SELECT * FROM "identity" WHERE "login" = $1 LIMIT 1; -- name: GetIdentityByPrimaryEmail :one SELECT * FROM "identity" INNER JOIN "email" ON "email"."identity_id" = "identity"."id" WHERE "email"."address" = $1 AND "email"."is_primary" LIMIT 1; -- name: UpdateIdentityPassphrase :exec UPDATE "identity" SET ( "passphrase" ) = ( $2 ) WHERE "id" = $1; -- name: UpdateIdentityLogin :exec UPDATE "identity" SET ( "login" ) = ( $2 ) WHERE "id" = $1; -- Name: DestroyIdentity :exec DELETE FROM "identity" WHERE "id" = $1;