database_queries

package
v0.0.0-...-52a538d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveGuestLoginIdentity

type ActiveGuestLoginIdentity struct {
	ID              int32              `json:"id"`
	LoginIdentityID int32              `json:"login_identity_id"`
	DeviceID        string             `json:"device_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
	DeletedAt       pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveLoginIdentity

type ActiveLoginIdentity struct {
	ID           int32              `json:"id"`
	UserID       int32              `json:"user_id"`
	IdentityType string             `json:"identity_type"`
	IsPrimary    pgtype.Bool        `json:"is_primary"`
	LastUsedAt   pgtype.Timestamptz `json:"last_used_at"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOauthConnection

type ActiveOauthConnection struct {
	ID           int32              `json:"id"`
	ProviderName string             `json:"provider_name"`
	Scopes       []string           `json:"scopes"`
	CreatedAt    pgtype.Timestamp   `json:"created_at"`
	UpdatedAt    pgtype.Timestamp   `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOauthIntegration

type ActiveOauthIntegration struct {
	ID                int32              `json:"id"`
	OauthConnectionID int32              `json:"oauth_connection_id"`
	IntegrationType   string             `json:"integration_type"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	DeletedAt         pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOauthProvider

type ActiveOauthProvider struct {
	Name          string             `json:"name"`
	IsOidcCapable bool               `json:"is_oidc_capable"`
	CreatedAt     pgtype.Timestamp   `json:"created_at"`
	UpdatedAt     pgtype.Timestamp   `json:"updated_at"`
	DeletedAt     pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOauthToken

type ActiveOauthToken struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	AccessToken        string             `json:"access_token"`
	RefreshToken       pgtype.Text        `json:"refresh_token"`
	TokenType          string             `json:"token_type"`
	ExpiresAt          pgtype.Timestamp   `json:"expires_at"`
	IssuedAt           pgtype.Timestamp   `json:"issued_at"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOidcLoginIdentity

type ActiveOidcLoginIdentity struct {
	ID                        int32              `json:"id"`
	LoginIdentityID           int32              `json:"login_identity_id"`
	OidcUserIntegrationDataID int32              `json:"oidc_user_integration_data_id"`
	CreatedAt                 pgtype.Timestamptz `json:"created_at"`
	UpdatedAt                 pgtype.Timestamptz `json:"updated_at"`
	DeletedAt                 pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveOidcUserIntegrationDatum

type ActiveOidcUserIntegrationDatum struct {
	ID                int32              `json:"id"`
	UserIntegrationID int32              `json:"user_integration_id"`
	Sub               string             `json:"sub"`
	Email             pgtype.Text        `json:"email"`
	Iss               string             `json:"iss"`
	Aud               string             `json:"aud"`
	GivenName         pgtype.Text        `json:"given_name"`
	FamilyName        pgtype.Text        `json:"family_name"`
	Name              pgtype.Text        `json:"name"`
	Picture           pgtype.Text        `json:"picture"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	DeletedAt         pgtype.Timestamptz `json:"deleted_at"`
}

type ActivePasswordLoginIdentity

type ActivePasswordLoginIdentity struct {
	ID              int32              `json:"id"`
	LoginIdentityID int32              `json:"login_identity_id"`
	Email           pgtype.Text        `json:"email"`
	Phone           pgtype.Text        `json:"phone"`
	HashedPass      string             `json:"hashed_pass"`
	PassSalt        string             `json:"pass_salt"`
	VerifiedAt      pgtype.Timestamptz `json:"verified_at"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
	DeletedAt       pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveSession

type ActiveSession struct {
	ID               int32              `json:"id"`
	Token            string             `json:"token"`
	IpAddress        netip.Addr         `json:"ip_address"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	UpdatedAt        pgtype.Timestamptz `json:"updated_at"`
	ExpiresAt        pgtype.Timestamptz `json:"expires_at"`
	DeletedAt        pgtype.Timestamptz `json:"deleted_at"`
	OriginatedFrom   int32              `json:"originated_from"`
	UsedInstallation int32              `json:"used_installation"`
}

type ActiveSystemIntegration

type ActiveSystemIntegration struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type ActiveUserIntegration

type ActiveUserIntegration struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	UserID             int32              `json:"user_id"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type GuestLoginIdentity

type GuestLoginIdentity struct {
	ID              int32              `json:"id"`
	LoginIdentityID int32              `json:"login_identity_id"`
	DeviceID        string             `json:"device_id"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
	DeletedAt       pgtype.Timestamptz `json:"deleted_at"`
}

type Installation

type Installation struct {
	ID                      int32              `json:"id"`
	InstallationToken       string             `json:"installation_token"`
	NotificationToken       pgtype.Text        `json:"notification_token"`
	Locale                  string             `json:"locale"`
	TimezoneOffsetInMinutes int32              `json:"timezone_offset_in_minutes"`
	DeviceManufacturer      pgtype.Text        `json:"device_manufacturer"`
	DeviceOs                string             `json:"device_os"`
	ClientType              string             `json:"client_type"`
	DeviceOsVersion         pgtype.Text        `json:"device_os_version"`
	AppVersion              string             `json:"app_version"`
	CreatedAt               pgtype.Timestamptz `json:"created_at"`
	UpdatedAt               pgtype.Timestamptz `json:"updated_at"`
	DeletedAt               pgtype.Timestamptz `json:"deleted_at"`
	AttachTo                pgtype.Int4        `json:"attach_to"`
	LastAttachTo            pgtype.Int4        `json:"last_attach_to"`
}

type InstallationAttachSessionToInstallationByIdParams

type InstallationAttachSessionToInstallationByIdParams struct {
	ID       int32       `json:"id"`
	AttachTo pgtype.Int4 `json:"attach_to"`
}

type InstallationAttachSessionToInstallationByTokenParams

type InstallationAttachSessionToInstallationByTokenParams struct {
	InstallationToken string      `json:"installation_token"`
	AttachTo          pgtype.Int4 `json:"attach_to"`
}

type InstallationCreateNewInstallationParams

type InstallationCreateNewInstallationParams struct {
	InstallationToken       string      `json:"installation_token"`
	NotificationToken       pgtype.Text `json:"notification_token"`
	Locale                  string      `json:"locale"`
	TimezoneOffsetInMinutes int32       `json:"timezone_offset_in_minutes"`
	DeviceManufacturer      pgtype.Text `json:"device_manufacturer"`
	DeviceOs                string      `json:"device_os"`
	ClientType              string      `json:"client_type"`
	DeviceOsVersion         pgtype.Text `json:"device_os_version"`
	AppVersion              string      `json:"app_version"`
}

type InstallationDetachSessionFromInstallationByIdParams

type InstallationDetachSessionFromInstallationByIdParams struct {
	ID           int32       `json:"id"`
	LastAttachTo pgtype.Int4 `json:"last_attach_to"`
}

type InstallationDetachSessionFromInstallationByTokenParams

type InstallationDetachSessionFromInstallationByTokenParams struct {
	InstallationToken string      `json:"installation_token"`
	LastAttachTo      pgtype.Int4 `json:"last_attach_to"`
}

type InstallationGetInstallationUsingTokenAndWhereAttachToParams

type InstallationGetInstallationUsingTokenAndWhereAttachToParams struct {
	InstallationToken string      `json:"installation_token"`
	AttachTo          pgtype.Int4 `json:"attach_to"`
}

type InstallationUpdateInstallationParams

type InstallationUpdateInstallationParams struct {
	InstallationToken       string      `json:"installation_token"`
	NotificationToken       pgtype.Text `json:"notification_token"`
	Locale                  string      `json:"locale"`
	TimezoneOffsetInMinutes int32       `json:"timezone_offset_in_minutes"`
	AppVersion              string      `json:"app_version"`
}

type LoginIdentity

type LoginIdentity struct {
	ID           int32              `json:"id"`
	UserID       int32              `json:"user_id"`
	IdentityType string             `json:"identity_type"`
	IsPrimary    pgtype.Bool        `json:"is_primary"`
	LastUsedAt   pgtype.Timestamptz `json:"last_used_at"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
}

type LoginIdentityChangePasswordLoginIdentityByUserIdParams

type LoginIdentityChangePasswordLoginIdentityByUserIdParams struct {
	UserID     int32  `json:"user_id"`
	HashedPass string `json:"hashed_pass"`
	PassSalt   string `json:"pass_salt"`
}

type LoginIdentityCreateNewPasswordLoginIdentityParams

type LoginIdentityCreateNewPasswordLoginIdentityParams struct {
	PasswordEmail      pgtype.Text        `json:"password_email"`
	PasswordPhone      pgtype.Text        `json:"password_phone"`
	PasswordHashedPass string             `json:"password_hashed_pass"`
	PasswordPassSalt   string             `json:"password_pass_salt"`
	PasswordVerifiedAt pgtype.Timestamptz `json:"password_verified_at"`
	IdentityUserID     int32              `json:"identity_user_id"`
	IdentityType       string             `json:"identity_type"`
}

type LoginIdentityCreateNewPasswordLoginIdentityRow

type LoginIdentityCreateNewPasswordLoginIdentityRow struct {
	PasswordLoginIdentityID int32 `json:"password_login_identity_id"`
	LoginIdentityID         int32 `json:"login_identity_id"`
}

type LoginIdentityCreateNewUserAndOIDCLoginIdentityParams

type LoginIdentityCreateNewUserAndOIDCLoginIdentityParams struct {
	UserUsername               string           `json:"user_username"`
	UserProfileImage           pgtype.Text      `json:"user_profile_image"`
	UserFirstName              string           `json:"user_first_name"`
	UserLastName               pgtype.Text      `json:"user_last_name"`
	UserRoleID                 pgtype.Int4      `json:"user_role_id"`
	OauthProviderName          string           `json:"oauth_provider_name"`
	OauthProviderIsOidcCapable bool             `json:"oauth_provider_is_oidc_capable"`
	OauthScopes                []string         `json:"oauth_scopes"`
	OauthAccessToken           string           `json:"oauth_access_token"`
	OauthRefreshToken          pgtype.Text      `json:"oauth_refresh_token"`
	OauthTokenType             pgtype.Text      `json:"oauth_token_type"`
	OauthTokenExpiresAt        pgtype.Timestamp `json:"oauth_token_expires_at"`
	OauthTokenIssuedAt         pgtype.Timestamp `json:"oauth_token_issued_at"`
	OidcSub                    string           `json:"oidc_sub"`
	OidcEmail                  pgtype.Text      `json:"oidc_email"`
	OidcIss                    string           `json:"oidc_iss"`
	OidcAud                    string           `json:"oidc_aud"`
	OidcGivenName              pgtype.Text      `json:"oidc_given_name"`
	OidcFamilyName             pgtype.Text      `json:"oidc_family_name"`
	OidcName                   pgtype.Text      `json:"oidc_name"`
	OidcPicture                pgtype.Text      `json:"oidc_picture"`
}

type LoginIdentityCreateNewUserAndOIDCLoginIdentityRow

type LoginIdentityCreateNewUserAndOIDCLoginIdentityRow struct {
	UserID             int32              `json:"user_id"`
	Username           string             `json:"username"`
	ProfileImage       pgtype.Text        `json:"profile_image"`
	FirstName          string             `json:"first_name"`
	MiddleName         pgtype.Text        `json:"middle_name"`
	LastName           pgtype.Text        `json:"last_name"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	BlockedAt          pgtype.Timestamptz `json:"blocked_at"`
	BlockedUntil       pgtype.Timestamptz `json:"blocked_until"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
	RoleID             pgtype.Int4        `json:"role_id"`
	NewLoginIdentityID int32              `json:"new_login_identity_id"`
}

type LoginIdentityCreateNewUserAndPasswordLoginIdentityParams

type LoginIdentityCreateNewUserAndPasswordLoginIdentityParams struct {
	UserUsername       string             `json:"user_username"`
	UserProfileImage   pgtype.Text        `json:"user_profile_image"`
	UserFirstName      string             `json:"user_first_name"`
	UserLastName       pgtype.Text        `json:"user_last_name"`
	UserRoleID         pgtype.Int4        `json:"user_role_id"`
	IdentityType       string             `json:"identity_type"`
	PasswordEmail      pgtype.Text        `json:"password_email"`
	PasswordPhone      pgtype.Text        `json:"password_phone"`
	PasswordHashedPass string             `json:"password_hashed_pass"`
	PasswordPassSalt   string             `json:"password_pass_salt"`
	PasswordVerifiedAt pgtype.Timestamptz `json:"password_verified_at"`
}

type LoginIdentityCreateNewUserAndPasswordLoginIdentityRow

type LoginIdentityCreateNewUserAndPasswordLoginIdentityRow struct {
	ID           int32              `json:"id"`
	Username     string             `json:"username"`
	ProfileImage pgtype.Text        `json:"profile_image"`
	FirstName    string             `json:"first_name"`
	MiddleName   pgtype.Text        `json:"middle_name"`
	LastName     pgtype.Text        `json:"last_name"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	BlockedAt    pgtype.Timestamptz `json:"blocked_at"`
	BlockedUntil pgtype.Timestamptz `json:"blocked_until"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
	RoleID       pgtype.Int4        `json:"role_id"`
}

type LoginIdentityGetAllByUserIdRow

type LoginIdentityGetAllByUserIdRow struct {
	LoginIdentityID           int32              `json:"login_identity_id"`
	LoginIdentityUserID       int32              `json:"login_identity_user_id"`
	LoginIdentityIdentityType string             `json:"login_identity_identity_type"`
	LoginIdentityIsPrimary    pgtype.Bool        `json:"login_identity_is_primary"`
	LoginIdentityLastUsedAt   pgtype.Timestamptz `json:"login_identity_last_used_at"`
	PasswordID                pgtype.Int4        `json:"password_id"`
	PasswordEmail             pgtype.Text        `json:"password_email"`
	PasswordPhone             pgtype.Text        `json:"password_phone"`
	PasswordHashedPass        pgtype.Text        `json:"password_hashed_pass"`
	PasswordPassSalt          pgtype.Text        `json:"password_pass_salt"`
	PasswordVerifiedAt        pgtype.Timestamptz `json:"password_verified_at"`
	GuestID                   pgtype.Int4        `json:"guest_id"`
	GuestDeviceID             pgtype.Text        `json:"guest_device_id"`
	OidcDataID                pgtype.Int4        `json:"oidc_data_id"`
	OidcDataSub               pgtype.Text        `json:"oidc_data_sub"`
	OidcDataEmail             pgtype.Text        `json:"oidc_data_email"`
	OidcDataIssuer            pgtype.Text        `json:"oidc_data_issuer"`
	OidcDataAudience          pgtype.Text        `json:"oidc_data_audience"`
	OidcDataGivenName         pgtype.Text        `json:"oidc_data_given_name"`
	OidcDataFamilyName        pgtype.Text        `json:"oidc_data_family_name"`
	OidcDataName              pgtype.Text        `json:"oidc_data_name"`
	OidcDataPicture           pgtype.Text        `json:"oidc_data_picture"`
	OauthProviderName         pgtype.Text        `json:"oauth_provider_name"`
}

type LoginIdentityGetAllPasswordLoginIdentitiesByUserIdRow

type LoginIdentityGetAllPasswordLoginIdentitiesByUserIdRow struct {
	LoginIdentityID           int32              `json:"login_identity_id"`
	LoginIdentityUserID       int32              `json:"login_identity_user_id"`
	LoginIdentityIdentityType string             `json:"login_identity_identity_type"`
	LoginIdentityIsPrimary    pgtype.Bool        `json:"login_identity_is_primary"`
	LoginIdentityLastUsedAt   pgtype.Timestamptz `json:"login_identity_last_used_at"`
	PasswordID                pgtype.Int4        `json:"password_id"`
	PasswordEmail             pgtype.Text        `json:"password_email"`
	PasswordPhone             pgtype.Text        `json:"password_phone"`
	PasswordHashedPass        pgtype.Text        `json:"password_hashed_pass"`
	PasswordPassSalt          pgtype.Text        `json:"password_pass_salt"`
	PasswordVerifiedAt        pgtype.Timestamptz `json:"password_verified_at"`
}

type LoginIdentityGetOIDCDataBySubParams

type LoginIdentityGetOIDCDataBySubParams struct {
	OidcSub          string `json:"oidc_sub"`
	OidcProviderName string `json:"oidc_provider_name"`
}

type LoginIdentityGetOIDCDataBySubRow

type LoginIdentityGetOIDCDataBySubRow struct {
	UserID                    int32              `json:"user_id"`
	UserUsername              string             `json:"user_username"`
	UserProfileImage          pgtype.Text        `json:"user_profile_image"`
	UserFirstName             string             `json:"user_first_name"`
	UserMiddleName            pgtype.Text        `json:"user_middle_name"`
	UserLastName              pgtype.Text        `json:"user_last_name"`
	UserBlockedAt             pgtype.Timestamptz `json:"user_blocked_at"`
	UserBlockedUntil          pgtype.Timestamptz `json:"user_blocked_until"`
	UserCreatedAt             pgtype.Timestamptz `json:"user_created_at"`
	UserUpdatedAt             pgtype.Timestamptz `json:"user_updated_at"`
	UserRoleID                pgtype.Int4        `json:"user_role_id"`
	LoginIdentityID           int32              `json:"login_identity_id"`
	OauthTokenID              int32              `json:"oauth_token_id"`
	OauthConnectionID         int32              `json:"oauth_connection_id"`
	OauthConnectionScopes     []string           `json:"oauth_connection_scopes"`
	OauthIntegrationID        int32              `json:"oauth_integration_id"`
	OidcUserIntegrationDataID int32              `json:"oidc_user_integration_data_id"`
}

type LoginIdentityGetOIDCLoginIdentityRow

type LoginIdentityGetOIDCLoginIdentityRow struct {
	LoginIdentityID           int32              `json:"login_identity_id"`
	UserID                    int32              `json:"user_id"`
	IdentityType              string             `json:"identity_type"`
	IsPrimary                 pgtype.Bool        `json:"is_primary"`
	LastUsedAt                pgtype.Timestamptz `json:"last_used_at"`
	OidcLoginIdentityID       int32              `json:"oidc_login_identity_id"`
	OidcDataID                int32              `json:"oidc_data_id"`
	OidcDataUserIntegrationID int32              `json:"oidc_data_user_integration_id"`
	OidcDataSub               string             `json:"oidc_data_sub"`
	OidcDataEmail             pgtype.Text        `json:"oidc_data_email"`
	OidcDataIss               string             `json:"oidc_data_iss"`
	OidcDataAud               string             `json:"oidc_data_aud"`
	OidcDataGivenName         pgtype.Text        `json:"oidc_data_given_name"`
	OidcDataFamilyName        pgtype.Text        `json:"oidc_data_family_name"`
	OidcDataName              pgtype.Text        `json:"oidc_data_name"`
	OidcDataPicture           pgtype.Text        `json:"oidc_data_picture"`
}

type LoginIdentityGetPasswordLoginIdentityParams

type LoginIdentityGetPasswordLoginIdentityParams struct {
	IdentityType  string `json:"identity_type"`
	IdentityValue string `json:"identity_value"`
}

type LoginIdentityGetPasswordLoginIdentityRow

type LoginIdentityGetPasswordLoginIdentityRow struct {
	LoginIdentityID         int32              `json:"login_identity_id"`
	UserID                  int32              `json:"user_id"`
	IdentityType            string             `json:"identity_type"`
	LoginIdentityIsPrimary  pgtype.Bool        `json:"login_identity_is_primary"`
	LoginIdentityLastUsedAt pgtype.Timestamptz `json:"login_identity_last_used_at"`
	PasswordLoginIdentityID int32              `json:"password_login_identity_id"`
	Email                   pgtype.Text        `json:"email"`
	Phone                   pgtype.Text        `json:"phone"`
	HashedPass              string             `json:"hashed_pass"`
	PassSalt                string             `json:"pass_salt"`
	VerifiedAt              pgtype.Timestamptz `json:"verified_at"`
}

type LoginIdentityGetPasswordLoginIdentityWithUserParams

type LoginIdentityGetPasswordLoginIdentityWithUserParams struct {
	IdentityType  string `json:"identity_type"`
	IdentityValue string `json:"identity_value"`
}

type LoginIdentityGetPasswordLoginIdentityWithUserRow

type LoginIdentityGetPasswordLoginIdentityWithUserRow struct {
	LoginIdentityID         int32              `json:"login_identity_id"`
	UserID                  int32              `json:"user_id"`
	IdentityType            string             `json:"identity_type"`
	IsPrimary               pgtype.Bool        `json:"is_primary"`
	LastUsedAt              pgtype.Timestamptz `json:"last_used_at"`
	PasswordLoginIdentityID int32              `json:"password_login_identity_id"`
	Email                   pgtype.Text        `json:"email"`
	Phone                   pgtype.Text        `json:"phone"`
	HashedPass              string             `json:"hashed_pass"`
	PassSalt                string             `json:"pass_salt"`
	VerifiedAt              pgtype.Timestamptz `json:"verified_at"`
	UserID_2                int32              `json:"user_id_2"`
	UserUsername            string             `json:"user_username"`
	UserProfileImage        pgtype.Text        `json:"user_profile_image"`
	UserFirstName           string             `json:"user_first_name"`
	UserMiddleName          pgtype.Text        `json:"user_middle_name"`
	UserLastName            pgtype.Text        `json:"user_last_name"`
	UserBlockedAt           pgtype.Timestamptz `json:"user_blocked_at"`
	UserBlockedUntil        pgtype.Timestamptz `json:"user_blocked_until"`
	UserRoleID              pgtype.Int4        `json:"user_role_id"`
}

type NotDeletedUser

type NotDeletedUser struct {
	ID           int32              `json:"id"`
	Username     string             `json:"username"`
	ProfileImage pgtype.Text        `json:"profile_image"`
	FirstName    string             `json:"first_name"`
	MiddleName   pgtype.Text        `json:"middle_name"`
	LastName     pgtype.Text        `json:"last_name"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	BlockedAt    pgtype.Timestamptz `json:"blocked_at"`
	BlockedUntil pgtype.Timestamptz `json:"blocked_until"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
	RoleID       pgtype.Int4        `json:"role_id"`
}

type OauthConnection

type OauthConnection struct {
	ID           int32              `json:"id"`
	ProviderName string             `json:"provider_name"`
	Scopes       []string           `json:"scopes"`
	CreatedAt    pgtype.Timestamp   `json:"created_at"`
	UpdatedAt    pgtype.Timestamp   `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
}

type OauthConnectionCreateParams

type OauthConnectionCreateParams struct {
	ProviderName string   `json:"provider_name"`
	Scopes       []string `json:"scopes"`
}

type OauthIntegration

type OauthIntegration struct {
	ID                int32              `json:"id"`
	OauthConnectionID int32              `json:"oauth_connection_id"`
	IntegrationType   string             `json:"integration_type"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	DeletedAt         pgtype.Timestamptz `json:"deleted_at"`
}

type OauthIntegrationUpdateToOauthConnectionBasedOnNewScopesParams

type OauthIntegrationUpdateToOauthConnectionBasedOnNewScopesParams struct {
	IntegrationID int32    `json:"integration_id"`
	ProviderName  string   `json:"provider_name"`
	OauthScopes   []string `json:"oauth_scopes"`
}

type OauthProvider

type OauthProvider struct {
	Name          string             `json:"name"`
	IsOidcCapable bool               `json:"is_oidc_capable"`
	CreatedAt     pgtype.Timestamp   `json:"created_at"`
	UpdatedAt     pgtype.Timestamp   `json:"updated_at"`
	DeletedAt     pgtype.Timestamptz `json:"deleted_at"`
}

type OauthToken

type OauthToken struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	AccessToken        string             `json:"access_token"`
	RefreshToken       pgtype.Text        `json:"refresh_token"`
	TokenType          string             `json:"token_type"`
	ExpiresAt          pgtype.Timestamp   `json:"expires_at"`
	IssuedAt           pgtype.Timestamp   `json:"issued_at"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type OauthTokenUpdateParams

type OauthTokenUpdateParams struct {
	AccessToken  string           `json:"access_token"`
	RefreshToken pgtype.Text      `json:"refresh_token"`
	TokenType    pgtype.Text      `json:"token_type"`
	ExpiresAt    pgtype.Timestamp `json:"expires_at"`
	IssuedAt     pgtype.Timestamp `json:"issued_at"`
	ID           int32            `json:"id"`
}

type OidcLoginIdentity

type OidcLoginIdentity struct {
	ID                        int32              `json:"id"`
	LoginIdentityID           int32              `json:"login_identity_id"`
	OidcUserIntegrationDataID int32              `json:"oidc_user_integration_data_id"`
	CreatedAt                 pgtype.Timestamptz `json:"created_at"`
	UpdatedAt                 pgtype.Timestamptz `json:"updated_at"`
	DeletedAt                 pgtype.Timestamptz `json:"deleted_at"`
}

type OidcUserIntegrationDataUpdateParams

type OidcUserIntegrationDataUpdateParams struct {
	Email      pgtype.Text `json:"email"`
	GivenName  pgtype.Text `json:"given_name"`
	FamilyName pgtype.Text `json:"family_name"`
	Name       pgtype.Text `json:"name"`
	Picture    pgtype.Text `json:"picture"`
	ID         int32       `json:"id"`
}

type OidcUserIntegrationDatum

type OidcUserIntegrationDatum struct {
	ID                int32              `json:"id"`
	UserIntegrationID int32              `json:"user_integration_id"`
	Sub               string             `json:"sub"`
	Email             pgtype.Text        `json:"email"`
	Iss               string             `json:"iss"`
	Aud               string             `json:"aud"`
	GivenName         pgtype.Text        `json:"given_name"`
	FamilyName        pgtype.Text        `json:"family_name"`
	Name              pgtype.Text        `json:"name"`
	Picture           pgtype.Text        `json:"picture"`
	CreatedAt         pgtype.Timestamptz `json:"created_at"`
	UpdatedAt         pgtype.Timestamptz `json:"updated_at"`
	DeletedAt         pgtype.Timestamptz `json:"deleted_at"`
}

type PasswordLoginIdentity

type PasswordLoginIdentity struct {
	ID              int32              `json:"id"`
	LoginIdentityID int32              `json:"login_identity_id"`
	Email           pgtype.Text        `json:"email"`
	Phone           pgtype.Text        `json:"phone"`
	HashedPass      string             `json:"hashed_pass"`
	PassSalt        string             `json:"pass_salt"`
	VerifiedAt      pgtype.Timestamptz `json:"verified_at"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
	DeletedAt       pgtype.Timestamptz `json:"deleted_at"`
}

type PerRollAddPermissionToRoleParams

type PerRollAddPermissionToRoleParams struct {
	RoleID       int32 `json:"role_id"`
	PermissionID int32 `json:"permission_id"`
}

type PerRollGetAllPermissionsRow

type PerRollGetAllPermissionsRow struct {
	ID        int32              `json:"id"`
	Name      string             `json:"name"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type PerRollGetAllRoleRow

type PerRollGetAllRoleRow struct {
	ID        int32              `json:"id"`
	Name      string             `json:"name"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}

type PerRollGetRoleWithItsPermissionsRow

type PerRollGetRoleWithItsPermissionsRow struct {
	RoleID         int32  `json:"role_id"`
	RoleName       string `json:"role_name"`
	PermissionID   int32  `json:"permission_id"`
	PermissionName string `json:"permission_name"`
}

type PerRollRemovePermissionFromRoleParams

type PerRollRemovePermissionFromRoleParams struct {
	RoleID       int32 `json:"role_id"`
	PermissionID int32 `json:"permission_id"`
}

type Permission

type Permission struct {
	ID        int32              `json:"id"`
	Name      string             `json:"name"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) InstallationAttachSessionToInstallationById

func (q *Queries) InstallationAttachSessionToInstallationById(ctx context.Context, arg InstallationAttachSessionToInstallationByIdParams) (int64, error)

InstallationAttachSessionToInstallationById

UPDATE installation
SET attach_to = $2,
    last_attach_to= NULL
WHERE id = $1
    AND attach_to IS NULL

func (*Queries) InstallationAttachSessionToInstallationByToken

func (q *Queries) InstallationAttachSessionToInstallationByToken(ctx context.Context, arg InstallationAttachSessionToInstallationByTokenParams) error

InstallationAttachSessionToInstallationByToken

UPDATE installation
SET attach_to = $2,
    last_attach_to= NULL
WHERE installation_token = $1
    AND attach_to IS NULL

func (*Queries) InstallationCreateNewInstallation

func (q *Queries) InstallationCreateNewInstallation(ctx context.Context, arg InstallationCreateNewInstallationParams) error

InstallationCreateNewInstallation

INSERT INTO installation (
        installation_token,
        notification_token,
        locale,
        timezone_offset_in_minutes,
        device_manufacturer,
        device_os,
        client_type,
        device_os_version,
        app_version
    )
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)

func (*Queries) InstallationDetachSessionFromInstallationById

func (q *Queries) InstallationDetachSessionFromInstallationById(ctx context.Context, arg InstallationDetachSessionFromInstallationByIdParams) error

InstallationDetachSessionFromInstallationById

UPDATE installation
SET attach_to = NULL,
    last_attach_to = $2
WHERE id = $1

func (*Queries) InstallationDetachSessionFromInstallationByToken

func (q *Queries) InstallationDetachSessionFromInstallationByToken(ctx context.Context, arg InstallationDetachSessionFromInstallationByTokenParams) error

InstallationDetachSessionFromInstallationByToken

UPDATE installation
SET attach_to = NULL,
        last_attach_to = $2
WHERE installation_token = $1

func (*Queries) InstallationDetachSessionFromInstallationByUserId

func (q *Queries) InstallationDetachSessionFromInstallationByUserId(ctx context.Context, userID int32) error

InstallationDetachSessionFromInstallationByUserId

UPDATE installation AS i
SET
    attach_to      = NULL,
    last_attach_to = s.id
FROM active_session AS s
JOIN active_login_identity AS li
    ON s.originated_from = li.id
WHERE
    li.user_id            = $1
    AND i.attach_to       = s.id
    AND i.last_attach_to IS NULL
    AND i.deleted_at     IS NULL

func (*Queries) InstallationGetInstallationUsingToken

func (q *Queries) InstallationGetInstallationUsingToken(ctx context.Context, installationToken string) (Installation, error)

InstallationGetInstallationUsingToken

SELECT id, installation_token, notification_token, locale, timezone_offset_in_minutes, device_manufacturer, device_os, client_type, device_os_version, app_version, created_at, updated_at, deleted_at, attach_to, last_attach_to
FROM installation
WHERE installation_token = $1
    AND deleted_at IS NULL
LIMIT 1

func (*Queries) InstallationGetInstallationUsingTokenAndWhereAttachTo

func (q *Queries) InstallationGetInstallationUsingTokenAndWhereAttachTo(ctx context.Context, arg InstallationGetInstallationUsingTokenAndWhereAttachToParams) (Installation, error)

InstallationGetInstallationUsingTokenAndWhereAttachTo

SELECT id, installation_token, notification_token, locale, timezone_offset_in_minutes, device_manufacturer, device_os, client_type, device_os_version, app_version, created_at, updated_at, deleted_at, attach_to, last_attach_to
FROM installation
WHERE installation_token = $1
    AND attach_to = $2
    AND deleted_at IS NULL
LIMIT 1

func (*Queries) InstallationSoftDeleteInstallation

func (q *Queries) InstallationSoftDeleteInstallation(ctx context.Context, id int32) error

InstallationSoftDeleteInstallation

UPDATE installation
SET deleted_at = NOW()
WHERE id = $1

func (*Queries) InstallationUpdateInstallation

func (q *Queries) InstallationUpdateInstallation(ctx context.Context, arg InstallationUpdateInstallationParams) error

InstallationUpdateInstallation

UPDATE installation
SET notification_token = $2,
    locale = $3,
    timezone_Offset_in_minutes = $4,
    app_version = $5
WHERE installation_token = $1
    AND deleted_at IS NULL

func (*Queries) LoginIdentityChangePasswordLoginIdentityByUserId

func (q *Queries) LoginIdentityChangePasswordLoginIdentityByUserId(ctx context.Context, arg LoginIdentityChangePasswordLoginIdentityByUserIdParams) error

LoginIdentityChangePasswordLoginIdentityByUserId

UPDATE password_login_identity pli
SET
    hashed_pass = $2,
    pass_salt = $3
FROM active_login_identity li
WHERE pli.login_identity_id = li.id
  AND li.user_id = $1

func (*Queries) LoginIdentityCreateNewPasswordLoginIdentity

LoginIdentityCreateNewPasswordLoginIdentity

WITH new_identity AS (
 INSERT INTO login_identity (
    user_id,
    identity_type
 )
 VALUES (
    $6::int,
    $7::text
 )
 RETURNING id
)
INSERT INTO password_login_identity (
    login_identity_id,
    email,
    phone,
    hashed_pass,
    pass_salt,
    verified_at
)
VALUES (
    (SELECT id FROM new_identity),
    $1::text,
    $2::text,
    $3::text,
    $4::text,
    $5::timestamptz
)
RETURNING id AS password_login_identity_id, (SELECT id AS login_identity_id FROM new_identity)

func (*Queries) LoginIdentityCreateNewUserAndOIDCLoginIdentity

LoginIdentityCreateNewUserAndOIDCLoginIdentity

WITH new_user AS (

INSERT INTO users (
  username,
  profile_image,
  first_name,
  last_name,
  role_id
)
VALUES (
  $1::text,
  $2::text,
  $3::text,
  $4::text,
  $5::int
)
RETURNING id AS user_id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id

), new_identity AS (

INSERT INTO login_identity (
  user_id,
  identity_type
)
VALUES (
  (SELECT user_id FROM new_user),
  'oidc'
)
RETURNING id

), oauth_provider_record AS (

SELECT
    $6::text AS provider_name,
    $7::bool AS is_oidc_capable

), oauth_provider_record_merge_op AS (

MERGE INTO oauth_provider AS target
USING oauth_provider_record AS r
ON target.name = r.provider_name AND target.is_oidc_capable = r.is_oidc_capable
WHEN NOT MATCHED THEN
    INSERT (name, is_oidc_capable)
    VALUES (r.provider_name, r.is_oidc_capable)

), oauth_connection_record AS (

SELECT
    (SELECT provider_name from oauth_provider_record) AS provider_name,
    $8::text[] AS scopes

), oauth_connection_record_merge_op AS (

MERGE INTO oauth_connection AS target
USING oauth_connection_record AS r
ON target.provider_name = r.provider_name AND target.scopes = r.scopes
WHEN NOT MATCHED THEN
    INSERT (provider_name, scopes)
    VALUES (r.provider_name, r.scopes)
RETURNING target.*

), oauth_connection_row AS (

SELECT * FROM oauth_connection_record_merge_op
UNION ALL
SELECT id, provider_name, scopes, created_at, updated_at, deleted_at from oauth_connection
    WHERE provider_name = (SELECT provider_name from oauth_provider_record)
        AND scopes = (SELECT scopes from oauth_connection_record)

), new_oauth_integration AS (

INSERT INTO oauth_integration (
    oauth_connection_id,
    integration_type
)
VALUES (
    (SELECT id FROM oauth_connection_row),
    'user'
)
RETURNING id

), new_oauth_token AS (

INSERT INTO oauth_token (
    oauth_integration_id,
    access_token,
    refresh_token,
    token_type,
    expires_at,
    issued_at
)
VALUES (
    (SELECT id FROM new_oauth_integration),
    $9::text,
    $10::text,
    $11::text,
    $12::timestamp,
    $13::timestamp
)

), new_user_integration AS (

INSERT INTO user_integration (
    oauth_integration_id,
    user_id
)
VALUES (
    (SELECT id FROM new_oauth_integration),
    (SELECT user_id FROM new_user)
)
RETURNING id

), new_oidc_user_integration_data AS (

INSERT INTO oidc_user_integration_data (
    user_integration_id,
    sub,
    email,
    iss,
    aud,
    given_name,
    family_name,
    name,
    picture
)
VALUES (
    (SELECT id FROM new_user_integration),
    $14::text,
    $15::text,
    $16::text,
    $17::text,
    $18::text,
    $19::text,
    $20::text,
    $21::text
)
RETURNING id

), new_oidc_login_identity AS (

INSERT INTO oidc_login_identity (
    login_identity_id,
    oidc_user_integration_data_id
)
VALUES (
    (SELECT id FROM new_identity),
    (SELECT id FROM new_oidc_user_integration_data)
)

) SELECT u.user_id, u.username, u.profile_image, u.first_name, u.middle_name, u.last_name, u.created_at, u.updated_at, u.blocked_at, u.blocked_until, u.deleted_at, u.role_id, i.id AS new_login_identity_id FROM new_user AS u, new_identity AS i

func (*Queries) LoginIdentityCreateNewUserAndPasswordLoginIdentity

LoginIdentityCreateNewUserAndPasswordLoginIdentity

WITH new_user AS (
  INSERT INTO users (
    username,
    profile_image,
    first_name,
    last_name,
    role_id
  )
  VALUES (
    $1::text,
    $2::text,
    $3::text,
    $4::text,
    $5::int
  )
  RETURNING id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id
),
new_identity AS (
  INSERT INTO login_identity (
    user_id,
    identity_type
  )
  VALUES (
    (SELECT id FROM new_user),
    $6::text
  )
  RETURNING id
),
final_insert AS (
  INSERT INTO password_login_identity (
    login_identity_id,
    email,
    phone,
    hashed_pass,
    pass_salt,
    verified_at
  )
  VALUES (
    (SELECT id FROM new_identity),
    $7::text,
    $8::text,
    $9::text,
    $10::text,
    $11::timestamptz
  )
)
SELECT id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id FROM new_user

func (*Queries) LoginIdentityGetAllByUserId

func (q *Queries) LoginIdentityGetAllByUserId(ctx context.Context, userID int32) ([]LoginIdentityGetAllByUserIdRow, error)

LoginIdentityGetAllByUserId

SELECT
  li.id AS login_identity_id,
  li.user_id AS login_identity_user_id,
  li.identity_type AS login_identity_identity_type,
  li.is_primary AS login_identity_is_primary,
  li.last_used_at AS login_identity_last_used_at,

  -- Password-based
  pli.id AS password_id,
  pli.email  AS password_email,
  pli.phone  AS password_phone,
  pli.hashed_pass  AS password_hashed_pass,
  pli.pass_salt  AS password_pass_salt,
  pli.verified_at AS password_verified_at,

  -- Guest-based
  gli.id AS guest_id,
  gli.device_id AS guest_device_id,

  -- OIDC-based
  oud.id AS oidc_data_id,
  oud.sub AS oidc_data_sub,
  oud.email AS oidc_data_email,
  oud.iss AS oidc_data_issuer,
  oud.aud AS oidc_data_audience,
  oud.given_name AS oidc_data_given_name,
  oud.family_name AS oidc_data_family_name,
  oud.name AS oidc_data_name,
  oud.picture AS oidc_data_picture,

  -- oauth_provider
  op.name AS oauth_provider_name

FROM active_login_identity AS li
LEFT JOIN active_password_login_identity AS pli
  ON li.id = pli.login_identity_id
LEFT JOIN active_guest_login_identity AS gli
  ON li.id = gli.login_identity_id
LEFT JOIN active_oidc_login_identity AS oli
  ON li.id = oli.login_identity_id
LEFT JOIN active_oidc_user_integration_data AS oud
  ON oli.oidc_user_integration_data_id = oud.id
LEFT JOIN user_integration AS ui
  ON oud.user_integration_id = ui.id
LEFT JOIN oauth_integration AS oi
  ON ui.oauth_integration_id = oi.id
LEFT JOIN oauth_connection AS oc
  ON oi.oauth_connection_id = oc.id
LEFT JOIN oauth_provider AS op
  ON oc.provider_name = op.name

WHERE li.user_id = $1
ORDER BY li.is_primary DESC, li.last_used_at DESC

func (*Queries) LoginIdentityGetAllPasswordLoginIdentitiesByUserId

func (q *Queries) LoginIdentityGetAllPasswordLoginIdentitiesByUserId(ctx context.Context, userID int32) ([]LoginIdentityGetAllPasswordLoginIdentitiesByUserIdRow, error)

LoginIdentityGetAllPasswordLoginIdentitiesByUserId

SELECT
  li.id AS login_identity_id,
  li.user_id AS login_identity_user_id,
  li.identity_type AS login_identity_identity_type,
  li.is_primary AS login_identity_is_primary,
  li.last_used_at AS login_identity_last_used_at,

  -- Password-based
  pli.id AS password_id,
  pli.email  AS password_email,
  pli.phone  AS password_phone,
  pli.hashed_pass  AS password_hashed_pass,
  pli.pass_salt  AS password_pass_salt,
  pli.verified_at AS password_verified_at
FROM active_login_identity AS li
LEFT JOIN active_password_login_identity AS pli
  ON li.id = pli.login_identity_id
WHERE li.user_id = $1
ORDER BY li.is_primary DESC, li.last_used_at DESC

func (*Queries) LoginIdentityGetOIDCDataBySub

LoginIdentityGetOIDCDataBySub

SELECT
    u.id AS user_id,
    u.username AS user_username,
    u.profile_image AS user_profile_image,
    u.first_name AS user_first_name,
    u.middle_name AS user_middle_name,
    u.last_name AS user_last_name,
    u.blocked_at AS user_blocked_at,
    u.blocked_until AS user_blocked_until,
    u.created_at AS user_created_at,
    u.updated_at AS user_updated_at,
    u.role_id as user_role_id,
    li.id AS login_identity_id,
    ot.id AS oauth_token_id,
    oc.id AS oauth_connection_id,
    oc.scopes AS oauth_connection_scopes,
    oi.id AS oauth_integration_id,
    ouid.id AS oidc_user_integration_data_id
from active_oidc_user_integration_data AS ouid
JOIN active_user_integration AS ui
    ON ouid.user_integration_id = ui.id
JOIN active_oauth_integration AS oi
    ON ui.oauth_integration_id = oi.id
JOIN active_oauth_token AS ot
    ON oi.id = ot.oauth_integration_id
JOIN active_oauth_connection AS oc
    ON oi.oauth_connection_id = oc.id
JOIN active_oauth_provider AS op
    ON oc.provider_name = op.name
JOIN active_oidc_login_identity AS oli
    ON ouid.id = oli.oidc_user_integration_data_id
JOIN active_login_identity AS li
    ON oli.login_identity_id = li.id
JOIN not_deleted_users AS u
    ON li.user_id = u.id
WHERE ouid.sub = $1::text
    AND li.identity_type = 'oidc'
    AND oi.integration_type = 'user'
    AND op.name = $2::text
LIMIT 1

func (*Queries) LoginIdentityGetOIDCLoginIdentity

func (q *Queries) LoginIdentityGetOIDCLoginIdentity(ctx context.Context, oidcSub string) (LoginIdentityGetOIDCLoginIdentityRow, error)

LoginIdentityGetOIDCLoginIdentity

SELECT
    li.id AS login_identity_id,
    li.user_id,
    li.identity_type,
    li.is_primary,
    li.last_used_at,

    oli.id AS oidc_login_identity_id,

    oidc_data.id AS oidc_data_id,
    oidc_data.user_integration_id AS oidc_data_user_integration_id,
    oidc_data.sub AS oidc_data_sub,
    oidc_data.email AS oidc_data_email,
    oidc_data.iss AS oidc_data_iss,
    oidc_data.aud AS oidc_data_aud,
    oidc_data.given_name AS oidc_data_given_name,
    oidc_data.family_name AS oidc_data_family_name,
    oidc_data.name AS oidc_data_name,
    oidc_data.picture AS oidc_data_picture
FROM active_login_identity AS li
    JOIN active_oidc_login_identity oli
        ON li.id = oli.login_identity_id
    JOIN active_oidc_user_integration_data AS oidc_data
        ON oli.oidc_user_integration_data_id = oidc_data.id
WHERE li.identity_type = 'oidc'
    AND oidc_data.sub = $1::text
LIMIT 1

func (*Queries) LoginIdentityGetPasswordLoginIdentity

LoginIdentityGetPasswordLoginIdentity

SELECT
    li.id AS login_identity_id,
    li.user_id,
    li.identity_type,
    li.is_primary AS login_identity_is_primary,
    li.last_used_at AS login_identity_last_used_at,

    pli.id AS password_login_identity_id,
    pli.email ,
    pli.phone,
    pli.hashed_pass,
    pli.pass_salt,
    pli.verified_at
FROM active_login_identity AS li
    JOIN active_password_login_identity pli
        ON li.id = pli.login_identity_id
WHERE li.identity_type = $1::text
    AND (
      ($1::text = 'email' AND pli.email = $2::text)
      OR
      ($1::text = 'phone' AND pli.phone = $2::text)
    )
LIMIT 1

func (*Queries) LoginIdentityGetPasswordLoginIdentityWithUser

LoginIdentityGetPasswordLoginIdentityWithUser

SELECT
    li.id AS login_identity_id,
    li.user_id,
    li.identity_type,
    li.is_primary,
    li.last_used_at,

    pli.id AS password_login_identity_id,
    pli.email,
    pli.phone,
    pli.hashed_pass,
    pli.pass_salt,
    pli.verified_at,

    u.id as user_id,
    u.username as user_username,
    u.profile_image as user_profile_image,
    u.first_name as user_first_name,
    u.middle_name as user_middle_name,
    u.last_name as user_last_name,
    u.blocked_at as user_blocked_at,
    u.blocked_until as user_blocked_until,
    u.role_id as user_role_id
FROM not_deleted_users AS u
    JOIN active_login_identity AS li
        ON u.id = li.user_id
    JOIN active_password_login_identity pli
        ON li.id = pli.login_identity_id
WHERE li.identity_type = $1::text
    AND (
      ($1::text = 'email' AND pli.email = $2::text)
      OR
      ($1::text = 'phone' AND pli.phone = $2::text)
    )
LIMIT 1

func (*Queries) LoginIdentityIsEmailUsed

func (q *Queries) LoginIdentityIsEmailUsed(ctx context.Context, email pgtype.Text) (int64, error)

LoginIdentityIsEmailUsed

SELECT COUNT(*) FROM active_password_login_identity WHERE email = $1

func (*Queries) LoginIdentityIsOidcEmailUsed

func (q *Queries) LoginIdentityIsOidcEmailUsed(ctx context.Context, email pgtype.Text) (int64, error)

LoginIdentityIsOidcEmailUsed

SELECT COUNT(*) FROM active_oidc_user_integration_data WHERE email = $1

func (*Queries) LoginIdentityIsPhoneUsed

func (q *Queries) LoginIdentityIsPhoneUsed(ctx context.Context, phone pgtype.Text) (int64, error)

LoginIdentityIsPhoneUsed

SELECT COUNT(*) FROM active_password_login_identity WHERE phone = $1

func (*Queries) LoginIdentityUpdateLastUsedAtToNow

func (q *Queries) LoginIdentityUpdateLastUsedAtToNow(ctx context.Context, id int32) error

LoginIdentityUpdateLastUsedAtToNow

UPDATE login_identity SET
last_used_at = NOW()
WHERE id = $1

func (*Queries) OauthConnectionCreate

func (q *Queries) OauthConnectionCreate(ctx context.Context, arg OauthConnectionCreateParams) (OauthConnection, error)

OauthConnectionCreate

INSERT INTO oauth_connection (
        provider_name,
        scopes
    )
VALUES (
    $1::text,
    $2::text[]
)
RETURNING id, provider_name, scopes, created_at, updated_at, deleted_at

func (*Queries) OauthIntegrationUpdateToOauthConnectionBasedOnNewScopes

func (q *Queries) OauthIntegrationUpdateToOauthConnectionBasedOnNewScopes(ctx context.Context, arg OauthIntegrationUpdateToOauthConnectionBasedOnNewScopesParams) error

OauthIntegrationUpdateToOauthConnectionBasedOnNewScopes

WITH oauth_connection_record AS (
    SELECT
        $2::text AS provider_name,
        $3::text[] AS scopes
),
oauth_connection_record_merge_op AS (
    MERGE INTO oauth_connection AS target
    USING oauth_connection_record AS r
    ON target.provider_name = r.provider_name AND target.scopes = r.scopes
    WHEN NOT MATCHED THEN
        INSERT (provider_name, scopes)
        VALUES (r.provider_name, r.scopes)
),
oauth_connection_row AS (
    SELECT id, provider_name, scopes, created_at, updated_at, deleted_at from oauth_connection
    WHERE provider_name = $2::text
        AND scopes = $3::text[]
)
UPDATE oauth_integration
SET oauth_connection_id = (SELECT id FROM oauth_connection_row)
WHERE id = $1::int

func (*Queries) OauthTokenUpdate

func (q *Queries) OauthTokenUpdate(ctx context.Context, arg OauthTokenUpdateParams) error

OauthTokenUpdate

UPDATE oauth_token
SET access_token = $1,
    refresh_token = $2::text,
    token_type = $3::text,
    expires_at = $4,
    issued_at = $5
WHERE id = $6

func (*Queries) OidcUserIntegrationDataUpdate

func (q *Queries) OidcUserIntegrationDataUpdate(ctx context.Context, arg OidcUserIntegrationDataUpdateParams) error

OidcUserIntegrationDataUpdate

UPDATE oidc_user_integration_data
SET email = $1::text,
    given_name = $2::text,
    family_name = $3::text,
    name = $4::text,
    picture = $5::text
WHERE id = $6

func (*Queries) PerRollAddPermissionToRole

func (q *Queries) PerRollAddPermissionToRole(ctx context.Context, arg PerRollAddPermissionToRoleParams) error

PerRollAddPermissionToRole

INSERT INTO role_permission(role_id, permission_id)
VALUES($1, $2)

func (*Queries) PerRollCreateNewPermission

func (q *Queries) PerRollCreateNewPermission(ctx context.Context, name string) (Permission, error)

PerRollCreateNewPermission

INSERT INTO permission(name)
VALUES($1)
RETURNING id, name, created_at, updated_at, deleted_at

func (*Queries) PerRollCreateNewRole

func (q *Queries) PerRollCreateNewRole(ctx context.Context, name string) (Role, error)

PerRollCreateNewRole

INSERT INTO role(name)
VALUES($1)
RETURNING id, name, created_at, updated_at, deleted_at

func (*Queries) PerRollGetAllPermissions

func (q *Queries) PerRollGetAllPermissions(ctx context.Context) ([]PerRollGetAllPermissionsRow, error)

PerRollGetAllPermissions

SELECT id,
    name,
    created_at,
    updated_at
FROM permission

func (*Queries) PerRollGetAllRole

func (q *Queries) PerRollGetAllRole(ctx context.Context) ([]PerRollGetAllRoleRow, error)

PerRollGetAllRole

SELECT id,
    name,
    created_at,
    updated_at
FROM role

func (*Queries) PerRollGetRoleWithItsPermissions

func (q *Queries) PerRollGetRoleWithItsPermissions(ctx context.Context, id int32) ([]PerRollGetRoleWithItsPermissionsRow, error)

PerRollGetRoleWithItsPermissions

SELECT r.id as role_id,
    r.name as role_name,
    p.id as permission_id,
    p.name as permission_name
FROM role AS r
    JOIN role_permission AS rp ON r.id = rp.role_id
    JOIN permission AS p ON p.id = rp.permission_id
WHERE r.id = $1

func (*Queries) PerRollRemovePermissionFromRole

func (q *Queries) PerRollRemovePermissionFromRole(ctx context.Context, arg PerRollRemovePermissionFromRoleParams) error

PerRollRemovePermissionFromRole

DELETE FROM role_permission
WHERE role_id = $1
    AND permission_id = $2

func (*Queries) PerRollSoftDeletePermission

func (q *Queries) PerRollSoftDeletePermission(ctx context.Context, id int32) error

PerRollSoftDeletePermission

UPDATE permission
SET deleted_at = NOW()
WHERE id = $1

func (*Queries) PerRollSoftDeleteRole

func (q *Queries) PerRollSoftDeleteRole(ctx context.Context, id int32) error

PerRollSoftDeleteRole

UPDATE role
SET deleted_at = NOW()
WHERE id = $1

func (*Queries) SessionCreateNewSession

func (q *Queries) SessionCreateNewSession(ctx context.Context, arg SessionCreateNewSessionParams) (int32, error)

SessionCreateNewSession

INSERT INTO session (
        token,
        originated_from,
        used_installation,
        expires_at,
        ip_address
    )
VALUES ($1, $2, $3, $4, $5)
RETURNING id

func (*Queries) SessionGetActiveSessionById

func (q *Queries) SessionGetActiveSessionById(ctx context.Context, id int32) (ActiveSession, error)

SessionGetActiveSessionById

SELECT id, token, ip_address, created_at, updated_at, expires_at, deleted_at, originated_from, used_installation
FROM active_session
WHERE id = $1
LIMIT 1

func (*Queries) SessionGetActiveSessionByToken

func (q *Queries) SessionGetActiveSessionByToken(ctx context.Context, token string) (ActiveSession, error)

SessionGetActiveSessionByToken

SELECT id, token, ip_address, created_at, updated_at, expires_at, deleted_at, originated_from, used_installation
FROM active_session
WHERE token = $1
LIMIT 1

func (*Queries) SessionSoftDeleteAllActiveSessionsForUser

func (q *Queries) SessionSoftDeleteAllActiveSessionsForUser(ctx context.Context, userID int32) error

SessionSoftDeleteAllActiveSessionsForUser

UPDATE active_session AS s
SET deleted_at = NOW()
FROM active_login_identity AS li
WHERE
    s.originated_from = li.id
    AND li.user_id    = $1

func (*Queries) SessionSoftDeleteSession

func (q *Queries) SessionSoftDeleteSession(ctx context.Context, id int32) error

SessionSoftDeleteSession

UPDATE session
SET deleted_at = NOW()
WHERE id = $1

func (*Queries) TodoCreateTodo

func (q *Queries) TodoCreateTodo(ctx context.Context, arg TodoCreateTodoParams) (Todo, error)

TodoCreateTodo

INSERT INTO
	todo (title, body, status, user_id)
VALUES
	($1, $2, $3, $4)
RETURNING
	id, title, body, status, created_at, updated_at, deleted_at, user_id

func (*Queries) TodoGetTodoLinkedToUser

func (q *Queries) TodoGetTodoLinkedToUser(ctx context.Context, arg TodoGetTodoLinkedToUserParams) (Todo, error)

TodoGetTodoLinkedToUser

SELECT id, title, body, status, created_at, updated_at, deleted_at, user_id FROM todo
WHERE id = $1
    AND user_id = $2
    AND deleted_at IS NULL
LIMIT 1

func (*Queries) TodoGetTodosForUser

func (q *Queries) TodoGetTodosForUser(ctx context.Context, arg TodoGetTodosForUserParams) ([]Todo, error)

TodoGetTodosForUser

SELECT
    id, title, body, status, created_at, updated_at, deleted_at, user_id
FROM todo
WHERE user_id = $1
   AND deleted_at IS NULL
ORDER BY created_at DESC
OFFSET $2
LIMIT $3

func (*Queries) TodoSoftDeleteTodoLinkedToUser

func (q *Queries) TodoSoftDeleteTodoLinkedToUser(ctx context.Context, arg TodoSoftDeleteTodoLinkedToUserParams) error

TodoSoftDeleteTodoLinkedToUser

UPDATE todo
SET deleted_at = NOW()
WHERE id = $1
    AND user_id = $2

func (*Queries) TodoUpdateTodo

func (q *Queries) TodoUpdateTodo(ctx context.Context, arg TodoUpdateTodoParams) (Todo, error)

TodoUpdateTodo

UPDATE todo
SET
	title = COALESCE($3, title),
	body = COALESCE($4, body),
	status = COALESCE($5, status)
WHERE
	id = $1
	AND user_id = $2
    AND deleted_at IS NULL
RETURNING
	id, title, body, status, created_at, updated_at, deleted_at, user_id

func (*Queries) UsersCreateNewUser

func (q *Queries) UsersCreateNewUser(ctx context.Context, arg UsersCreateNewUserParams) (User, error)

UsersCreateNewUser

INSERT INTO users (
        username,
        profile_image,
        first_name,
        last_name,
        role_id
    )
VALUES ($1, $2, $3, $4, $5)
RETURNING id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id

func (*Queries) UsersGetUserAndSessionDataBySessionToken

func (q *Queries) UsersGetUserAndSessionDataBySessionToken(ctx context.Context, token string) (UsersGetUserAndSessionDataBySessionTokenRow, error)

UsersGetUserAndSessionDataBySessionToken

SELECT s.id as session_id,
    s.token as session_token,
    s.originated_from as session_originated_from,
    s.used_installation as session_used_installation,

    u.id as user_id,
    u.username as user_username,
    u.profile_image as user_profile_image,
    u.first_name as user_first_name,
    u.middle_name as user_middle_name,
    u.last_name as user_last_name,
    u.blocked_at as user_blocked_at,
    u.blocked_until as user_blocked_until,
    u.role_id as user_role_id
FROM active_session AS s
    JOIN active_login_identity AS li ON s.originated_from = li.id
    JOIN not_deleted_users AS u ON u.id = li.user_id
WHERE s.token = $1
LIMIT 1

func (*Queries) UsersGetUserById

func (q *Queries) UsersGetUserById(ctx context.Context, id int32) (UsersGetUserByIdRow, error)

UsersGetUserById

SELECT
    u.id,
    u.username,
    u.profile_image,
    u.first_name,
    u.middle_name,
    u.last_name,
    u.blocked_at,
    u.blocked_until,
    u.created_at,
    u.updated_at,
    u.role_id
FROM not_deleted_users AS u
WHERE id = $1
LIMIT 1

func (*Queries) UsersIsUsernameUsed

func (q *Queries) UsersIsUsernameUsed(ctx context.Context, username string) (int64, error)

UsersIsUsernameUsed

SELECT COUNT(*)
FROM users
WHERE username = $1

func (*Queries) UsersSoftDeleteUser

func (q *Queries) UsersSoftDeleteUser(ctx context.Context, id int32) error

UsersSoftDeleteUser

UPDATE users
SET deleted_at = NOW()
WHERE id = $1

func (*Queries) UsersUpdateUserData

func (q *Queries) UsersUpdateUserData(ctx context.Context, arg UsersUpdateUserDataParams) (User, error)

UsersUpdateUserData

UPDATE users
SET username = $2,
    profile_image = $3,
    first_name = $4,
    last_name = $5,
    role_id = $6
WHERE id = $1
RETURNING id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id

func (*Queries) UsersUpdateUsernameForUser

func (q *Queries) UsersUpdateUsernameForUser(ctx context.Context, arg UsersUpdateUsernameForUserParams) error

UsersUpdateUsernameForUser

UPDATE users
SET username = $2
WHERE id = $1

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Role

type Role struct {
	ID        int32              `json:"id"`
	Name      string             `json:"name"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type RolePermission

type RolePermission struct {
	RoleID       int32              `json:"role_id"`
	PermissionID int32              `json:"permission_id"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
}

type Session

type Session struct {
	ID               int32              `json:"id"`
	Token            string             `json:"token"`
	IpAddress        netip.Addr         `json:"ip_address"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	UpdatedAt        pgtype.Timestamptz `json:"updated_at"`
	ExpiresAt        pgtype.Timestamptz `json:"expires_at"`
	DeletedAt        pgtype.Timestamptz `json:"deleted_at"`
	OriginatedFrom   int32              `json:"originated_from"`
	UsedInstallation int32              `json:"used_installation"`
}

type SessionCreateNewSessionParams

type SessionCreateNewSessionParams struct {
	Token            string             `json:"token"`
	OriginatedFrom   int32              `json:"originated_from"`
	UsedInstallation int32              `json:"used_installation"`
	ExpiresAt        pgtype.Timestamptz `json:"expires_at"`
	IpAddress        netip.Addr         `json:"ip_address"`
}

type SystemIntegration

type SystemIntegration struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type Todo

type Todo struct {
	ID        int32              `json:"id"`
	Title     string             `json:"title"`
	Body      string             `json:"body"`
	Status    string             `json:"status"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
	UserID    int32              `json:"user_id"`
}

type TodoCreateTodoParams

type TodoCreateTodoParams struct {
	Title  string `json:"title"`
	Body   string `json:"body"`
	Status string `json:"status"`
	UserID int32  `json:"user_id"`
}

type TodoGetTodoLinkedToUserParams

type TodoGetTodoLinkedToUserParams struct {
	ID     int32 `json:"id"`
	UserID int32 `json:"user_id"`
}

type TodoGetTodosForUserParams

type TodoGetTodosForUserParams struct {
	UserID int32 `json:"user_id"`
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
}

type TodoSoftDeleteTodoLinkedToUserParams

type TodoSoftDeleteTodoLinkedToUserParams struct {
	ID     int32 `json:"id"`
	UserID int32 `json:"user_id"`
}

type TodoUpdateTodoParams

type TodoUpdateTodoParams struct {
	ID     int32       `json:"id"`
	UserID int32       `json:"user_id"`
	Title  pgtype.Text `json:"title"`
	Body   pgtype.Text `json:"body"`
	Status pgtype.Text `json:"status"`
}

type User

type User struct {
	ID           int32              `json:"id"`
	Username     string             `json:"username"`
	ProfileImage pgtype.Text        `json:"profile_image"`
	FirstName    string             `json:"first_name"`
	MiddleName   pgtype.Text        `json:"middle_name"`
	LastName     pgtype.Text        `json:"last_name"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	BlockedAt    pgtype.Timestamptz `json:"blocked_at"`
	BlockedUntil pgtype.Timestamptz `json:"blocked_until"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
	RoleID       pgtype.Int4        `json:"role_id"`
}

type UserIntegration

type UserIntegration struct {
	ID                 int32              `json:"id"`
	OauthIntegrationID int32              `json:"oauth_integration_id"`
	UserID             int32              `json:"user_id"`
	CreatedAt          pgtype.Timestamptz `json:"created_at"`
	UpdatedAt          pgtype.Timestamptz `json:"updated_at"`
	DeletedAt          pgtype.Timestamptz `json:"deleted_at"`
}

type UsersCreateNewUserParams

type UsersCreateNewUserParams struct {
	Username     string      `json:"username"`
	ProfileImage pgtype.Text `json:"profile_image"`
	FirstName    string      `json:"first_name"`
	LastName     pgtype.Text `json:"last_name"`
	RoleID       pgtype.Int4 `json:"role_id"`
}

type UsersGetUserAndSessionDataBySessionTokenRow

type UsersGetUserAndSessionDataBySessionTokenRow struct {
	SessionID               int32              `json:"session_id"`
	SessionToken            string             `json:"session_token"`
	SessionOriginatedFrom   int32              `json:"session_originated_from"`
	SessionUsedInstallation int32              `json:"session_used_installation"`
	UserID                  int32              `json:"user_id"`
	UserUsername            string             `json:"user_username"`
	UserProfileImage        pgtype.Text        `json:"user_profile_image"`
	UserFirstName           string             `json:"user_first_name"`
	UserMiddleName          pgtype.Text        `json:"user_middle_name"`
	UserLastName            pgtype.Text        `json:"user_last_name"`
	UserBlockedAt           pgtype.Timestamptz `json:"user_blocked_at"`
	UserBlockedUntil        pgtype.Timestamptz `json:"user_blocked_until"`
	UserRoleID              pgtype.Int4        `json:"user_role_id"`
}

type UsersGetUserByIdRow

type UsersGetUserByIdRow struct {
	ID           int32              `json:"id"`
	Username     string             `json:"username"`
	ProfileImage pgtype.Text        `json:"profile_image"`
	FirstName    string             `json:"first_name"`
	MiddleName   pgtype.Text        `json:"middle_name"`
	LastName     pgtype.Text        `json:"last_name"`
	BlockedAt    pgtype.Timestamptz `json:"blocked_at"`
	BlockedUntil pgtype.Timestamptz `json:"blocked_until"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	RoleID       pgtype.Int4        `json:"role_id"`
}

type UsersUpdateUserDataParams

type UsersUpdateUserDataParams struct {
	ID           int32       `json:"id"`
	Username     string      `json:"username"`
	ProfileImage pgtype.Text `json:"profile_image"`
	FirstName    string      `json:"first_name"`
	LastName     pgtype.Text `json:"last_name"`
	RoleID       pgtype.Int4 `json:"role_id"`
}

type UsersUpdateUsernameForUserParams

type UsersUpdateUsernameForUserParams struct {
	ID       int32  `json:"id"`
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL