Documentation
¶
Index ¶
- type DBTX
- type Installation
- type InstallationCreateNewInstallationParams
- type InstallationGetInstallationUsingUUIdAndWhereAttachToParams
- type InstallationUpdateInstallationParams
- type LoginOption
- type LoginOptionChangeAllPasswordsByUserIdParams
- type LoginOptionCreateNewLoginOptionParams
- type LoginOptionGetActiveLoginOptionParams
- type LoginOptionGetActiveLoginOptionWithUserParams
- type LoginOptionGetActiveLoginOptionWithUserRow
- type LoginOptionGetAllActiveByUserIdAndLoginMethodParams
- type OTPCreateNewOtpParams
- type OTPGetActiveOtpByIdPairedWithSessionIdParams
- type Otp
- type PerRollAddPermissionToRoleParams
- type PerRollGetAllPermissionsRow
- type PerRollGetAllRoleRow
- type PerRollGetRoleWithItsPermissionsRow
- type PerRollRemovePermissionFromRoleParams
- type Permission
- type Queries
- func (q *Queries) InstallationCreateNewInstallation(ctx context.Context, arg InstallationCreateNewInstallationParams) (Installation, error)
- func (q *Queries) InstallationGetInstallationUsingUUID(ctx context.Context, installationID uuid.UUID) (Installation, error)
- func (q *Queries) InstallationGetInstallationUsingUUIdAndWhereAttachTo(ctx context.Context, ...) (Installation, error)
- func (q *Queries) InstallationSoftDeleteInstallation(ctx context.Context, id int32) error
- func (q *Queries) InstallationUpdateInstallation(ctx context.Context, arg InstallationUpdateInstallationParams) error
- func (q *Queries) LoginOptionChangeAllPasswordsByUserId(ctx context.Context, arg LoginOptionChangeAllPasswordsByUserIdParams) error
- func (q *Queries) LoginOptionCreateNewLoginOption(ctx context.Context, arg LoginOptionCreateNewLoginOptionParams) (LoginOption, error)
- func (q *Queries) LoginOptionGetActiveLoginOption(ctx context.Context, arg LoginOptionGetActiveLoginOptionParams) (LoginOption, error)
- func (q *Queries) LoginOptionGetActiveLoginOptionWithUser(ctx context.Context, arg LoginOptionGetActiveLoginOptionWithUserParams) (LoginOptionGetActiveLoginOptionWithUserRow, error)
- func (q *Queries) LoginOptionGetAllActiveByUserId(ctx context.Context, userID int32) ([]LoginOption, error)
- func (q *Queries) LoginOptionGetAllActiveByUserIdAndLoginMethod(ctx context.Context, arg LoginOptionGetAllActiveByUserIdAndLoginMethodParams) ([]LoginOption, error)
- func (q *Queries) LoginOptionGetAllActiveByUserIdAndSupportPassword(ctx context.Context, userID int32) ([]LoginOption, error)
- func (q *Queries) LoginOptionIsAccessKeyUsed(ctx context.Context, accessKey string) (int64, error)
- func (q *Queries) LoginOptionMarkUserLoginOptionAsVerified(ctx context.Context, id int32) error
- func (q *Queries) LoginOptionSoftDeleteUserLoginOption(ctx context.Context, id int32) error
- func (q *Queries) OTPCreateNewOtp(ctx context.Context, arg OTPCreateNewOtpParams) (Otp, error)
- func (q *Queries) OTPGetActiveOtpByIdPairedWithSessionId(ctx context.Context, arg OTPGetActiveOtpByIdPairedWithSessionIdParams) (Otp, error)
- func (q *Queries) OTPRecordHitForOtp(ctx context.Context, id int32) (Otp, error)
- func (q *Queries) OTPSoftDeleteOtp(ctx context.Context, id int32) error
- func (q *Queries) PerRollAddPermissionToRole(ctx context.Context, arg PerRollAddPermissionToRoleParams) error
- func (q *Queries) PerRollCreateNewPermission(ctx context.Context, name string) (Permission, error)
- func (q *Queries) PerRollCreateNewRole(ctx context.Context, name string) (Role, error)
- func (q *Queries) PerRollGetAllPermissions(ctx context.Context) ([]PerRollGetAllPermissionsRow, error)
- func (q *Queries) PerRollGetAllRole(ctx context.Context) ([]PerRollGetAllRoleRow, error)
- func (q *Queries) PerRollGetRoleWithItsPermissions(ctx context.Context, id int32) ([]PerRollGetRoleWithItsPermissionsRow, error)
- func (q *Queries) PerRollRemovePermissionFromRole(ctx context.Context, arg PerRollRemovePermissionFromRoleParams) error
- func (q *Queries) PerRollSoftDeletePermission(ctx context.Context, id int32) error
- func (q *Queries) PerRollSoftDeleteRole(ctx context.Context, id int32) error
- func (q *Queries) SessionCreateNewSession(ctx context.Context, arg SessionCreateNewSessionParams) error
- func (q *Queries) SessionGetActiveSessionById(ctx context.Context, id int32) (Session, error)
- func (q *Queries) SessionGetActiveSessionByToken(ctx context.Context, token string) (Session, error)
- func (q *Queries) SessionSoftDeleteSession(ctx context.Context, id int32) error
- func (q *Queries) TodoSoftDeleteTodo(ctx context.Context, id int32) error
- func (q *Queries) UsersCreateNewUser(ctx context.Context, arg UsersCreateNewUserParams) (User, error)
- func (q *Queries) UsersGetUserById(ctx context.Context, id int32) (User, error)
- func (q *Queries) UsersGetUserBySessionToken(ctx context.Context, token string) (User, error)
- func (q *Queries) UsersIsUsernameUsed(ctx context.Context, username string) (int64, error)
- func (q *Queries) UsersSoftDeleteUser(ctx context.Context, id int32) error
- func (q *Queries) UsersUpdateUserData(ctx context.Context, arg UsersUpdateUserDataParams) (User, error)
- func (q *Queries) UsersUpdateUsernameForUser(ctx context.Context, arg UsersUpdateUsernameForUserParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type Role
- type RolePermission
- type Service
- type Session
- type SessionCreateNewSessionParams
- type Todo
- type User
- type UsersCreateNewUserParams
- type UsersUpdateUserDataParams
- type UsersUpdateUsernameForUserParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Installation ¶
type Installation struct { ID int32 `json:"id"` InstallationID uuid.UUID `json:"installation_id"` NotificationToken pgtype.Text `json:"notification_token"` Locale string `json:"locale"` TimezoneOffsetInMinutes int32 `json:"timezone_offset_in_minutes"` DeviceManufacturer string `json:"device_manufacturer"` DeviceOs string `json:"device_os"` DeviceOsVersion string `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 InstallationCreateNewInstallationParams ¶
type InstallationCreateNewInstallationParams struct { InstallationID uuid.UUID `json:"installation_id"` NotificationToken pgtype.Text `json:"notification_token"` Locale string `json:"locale"` DeviceManufacturer string `json:"device_manufacturer"` DeviceOs string `json:"device_os"` DeviceOsVersion string `json:"device_os_version"` AppVersion string `json:"app_version"` }
type LoginOption ¶
type LoginOption struct { ID int32 `json:"id"` LoginMethod string `json:"login_method"` AccessKey string `json:"access_key"` HashedPass pgtype.Text `json:"hashed_pass"` PassSalt pgtype.Text `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"` UserID int32 `json:"user_id"` }
type LoginOptionGetActiveLoginOptionWithUserRow ¶
type LoginOptionGetActiveLoginOptionWithUserRow struct { LoginOptionID int32 `json:"login_option_id"` LoginOptionLoginMethod string `json:"login_option_login_method"` LoginOptionAccessKey string `json:"login_option_access_key"` LoginOptionHashedPass pgtype.Text `json:"login_option_hashed_pass"` LoginOptionPassSalt pgtype.Text `json:"login_option_pass_salt"` LoginOptionVerifiedAt pgtype.Timestamptz `json:"login_option_verified_at"` LoginOptionCreatedAt pgtype.Timestamptz `json:"login_option_created_at"` LoginOptionUpdatedAt pgtype.Timestamptz `json:"login_option_updated_at"` LoginOptionDeletedAt pgtype.Timestamptz `json:"login_option_deleted_at"` 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"` UserCreatedAt pgtype.Timestamptz `json:"user_created_at"` UserUpdatedAt pgtype.Timestamptz `json:"user_updated_at"` UserBlockedAt pgtype.Timestamptz `json:"user_blocked_at"` UserDeletedAt pgtype.Timestamptz `json:"user_deleted_at"` UserRoleID pgtype.Int4 `json:"user_role_id"` }
type OTPCreateNewOtpParams ¶
type Otp ¶
type Otp struct { ID int32 `json:"id"` Code string `json:"code"` HitCount int16 `json:"hit_count"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` ExpiresAt pgtype.Timestamptz `json:"expires_at"` DeletedAt pgtype.Timestamptz `json:"deleted_at"` Intent string `json:"intent"` OtpFor pgtype.Int4 `json:"otp_for"` UsingSessionID pgtype.Int4 `json:"using_session_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 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 (*Queries) InstallationCreateNewInstallation ¶
func (q *Queries) InstallationCreateNewInstallation(ctx context.Context, arg InstallationCreateNewInstallationParams) (Installation, error)
InstallationCreateNewInstallation
INSERT INTO installation ( installation_id, notification_token, locale, device_manufacturer, device_os, device_os_version, app_version ) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING id, installation_id, notification_token, locale, timezone_offset_in_minutes, device_manufacturer, device_os, device_os_version, app_version, created_at, updated_at, deleted_at, attach_to, last_attach_to
func (*Queries) InstallationGetInstallationUsingUUID ¶
func (q *Queries) InstallationGetInstallationUsingUUID(ctx context.Context, installationID uuid.UUID) (Installation, error)
InstallationGetInstallationUsingUUID
SELECT id, installation_id, notification_token, locale, timezone_offset_in_minutes, device_manufacturer, device_os, device_os_version, app_version, created_at, updated_at, deleted_at, attach_to, last_attach_to FROM installation WHERE installation_id = $1 AND deleted_at IS NULL LIMIT 1
func (*Queries) InstallationGetInstallationUsingUUIdAndWhereAttachTo ¶
func (q *Queries) InstallationGetInstallationUsingUUIdAndWhereAttachTo(ctx context.Context, arg InstallationGetInstallationUsingUUIdAndWhereAttachToParams) (Installation, error)
InstallationGetInstallationUsingUUIdAndWhereAttachTo
SELECT id, installation_id, notification_token, locale, timezone_offset_in_minutes, device_manufacturer, device_os, device_os_version, app_version, created_at, updated_at, deleted_at, attach_to, last_attach_to FROM installation WHERE installation_id = $1 AND attach_to = $2 AND deleted_at IS NULL LIMIT 1
func (*Queries) InstallationSoftDeleteInstallation ¶
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 = $3, locale = $4, timezone_Offset_in_minutes = $5 WHERE id = $1 AND installation_id = $2 AND deleted_at IS NULL
func (*Queries) LoginOptionChangeAllPasswordsByUserId ¶
func (q *Queries) LoginOptionChangeAllPasswordsByUserId(ctx context.Context, arg LoginOptionChangeAllPasswordsByUserIdParams) error
LoginOptionChangeAllPasswordsByUserId
UPDATE login_option SET hashed_pass = $2, pass_salt = $3 WHERE user_id = $1 AND hashed_pass IS NOT NULL
func (*Queries) LoginOptionCreateNewLoginOption ¶
func (q *Queries) LoginOptionCreateNewLoginOption(ctx context.Context, arg LoginOptionCreateNewLoginOptionParams) (LoginOption, error)
LoginOptionCreateNewLoginOption
INSERT INTO login_option( login_method, access_key, hashed_pass, pass_salt, verified_at, user_id ) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id
func (*Queries) LoginOptionGetActiveLoginOption ¶
func (q *Queries) LoginOptionGetActiveLoginOption(ctx context.Context, arg LoginOptionGetActiveLoginOptionParams) (LoginOption, error)
LoginOptionGetActiveLoginOption
SELECT id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id FROM login_option WHERE login_method = $1 AND access_key = $2 AND verified_at IS NOT NULL AND deleted_at IS NULL LIMIT 1
func (*Queries) LoginOptionGetActiveLoginOptionWithUser ¶
func (q *Queries) LoginOptionGetActiveLoginOptionWithUser(ctx context.Context, arg LoginOptionGetActiveLoginOptionWithUserParams) (LoginOptionGetActiveLoginOptionWithUserRow, error)
LoginOptionGetActiveLoginOptionWithUser
SELECT lo.id as login_option_id, lo.login_method as login_option_login_method, lo.access_key as login_option_access_key, lo.hashed_pass as login_option_hashed_pass, lo.pass_salt as login_option_pass_salt, lo.verified_at as login_option_verified_at, lo.created_at as login_option_created_at, lo.updated_at as login_option_updated_at, lo.deleted_at as login_option_deleted_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.created_at as user_created_at, u.updated_at as user_updated_at, u.blocked_at as user_blocked_at, u.deleted_at as user_deleted_at, u.role_id as user_role_id FROM login_option AS lo JOIN users AS u ON lo.user_id = u.id WHERE lo.login_method = $1 AND lo.access_key = $2 AND lo.verified_at IS NOT NULL AND lo.deleted_at IS NULL AND u.deleted_at IS NULL LIMIT 1
func (*Queries) LoginOptionGetAllActiveByUserId ¶
func (q *Queries) LoginOptionGetAllActiveByUserId(ctx context.Context, userID int32) ([]LoginOption, error)
LoginOptionGetAllActiveByUserId
SELECT id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id FROM login_option WHERE user_id = $1 AND verified_at IS NOT NULL AND deleted_at IS NULL
func (*Queries) LoginOptionGetAllActiveByUserIdAndLoginMethod ¶
func (q *Queries) LoginOptionGetAllActiveByUserIdAndLoginMethod(ctx context.Context, arg LoginOptionGetAllActiveByUserIdAndLoginMethodParams) ([]LoginOption, error)
LoginOptionGetAllActiveByUserIdAndLoginMethod
SELECT id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id FROM login_option WHERE login_method = $1 AND user_id = $2 AND verified_at IS NOT NULL AND deleted_at IS NULL
func (*Queries) LoginOptionGetAllActiveByUserIdAndSupportPassword ¶
func (q *Queries) LoginOptionGetAllActiveByUserIdAndSupportPassword(ctx context.Context, userID int32) ([]LoginOption, error)
LoginOptionGetAllActiveByUserIdAndSupportPassword
SELECT id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id FROM login_option WHERE user_id = $1 AND hashed_pass IS NOT NULL AND verified_at IS NOT NULL AND deleted_at IS NULL
func (*Queries) LoginOptionIsAccessKeyUsed ¶
LoginOptionIsAccessKeyUsed
SELECT COUNT(*) FROM login_option WHERE access_key = $1 AND deleted_at IS NULL AND verified_at IS NULL
func (*Queries) LoginOptionMarkUserLoginOptionAsVerified ¶
LoginOptionMarkUserLoginOptionAsVerified
UPDATE login_option SET verified_at = NOW() WHERE id = $1
func (*Queries) LoginOptionSoftDeleteUserLoginOption ¶
LoginOptionSoftDeleteUserLoginOption
UPDATE login_option SET deleted_at = NOW() WHERE id = $1
func (*Queries) OTPCreateNewOtp ¶
OTPCreateNewOtp
INSERT INTO otp ( code, intent, otp_for, using_session_id, expires_at ) VALUES ($1, $2, $3, $4, $5) RETURNING id, code, hit_count, created_at, updated_at, expires_at, deleted_at, intent, otp_for, using_session_id
func (*Queries) OTPGetActiveOtpByIdPairedWithSessionId ¶
func (q *Queries) OTPGetActiveOtpByIdPairedWithSessionId(ctx context.Context, arg OTPGetActiveOtpByIdPairedWithSessionIdParams) (Otp, error)
OTPGetActiveOtpByIdPairedWithSessionId
SELECT id, code, hit_count, created_at, updated_at, expires_at, deleted_at, intent, otp_for, using_session_id FROM otp WHERE id = $1 AND using_session_id = $2 AND hit_count < 3 AND expires_at > NOW() AND deleted_at IS NULL LIMIT 1
func (*Queries) OTPRecordHitForOtp ¶
OTPRecordHitForOtp
UPDATE otp SET hit_count = hit_count + 1 WHERE id = $1 RETURNING id, code, hit_count, created_at, updated_at, expires_at, deleted_at, intent, otp_for, using_session_id
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 ¶
PerRollCreateNewPermission
INSERT INTO permission(name) VALUES($1) RETURNING id, name, created_at, updated_at, deleted_at
func (*Queries) PerRollCreateNewRole ¶
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 ¶
PerRollSoftDeletePermission
UPDATE permission SET deleted_at = NOW() WHERE id = $1
func (*Queries) PerRollSoftDeleteRole ¶
PerRollSoftDeleteRole
UPDATE role SET deleted_at = NOW() WHERE id = $1
func (*Queries) SessionCreateNewSession ¶
func (q *Queries) SessionCreateNewSession(ctx context.Context, arg SessionCreateNewSessionParams) error
SessionCreateNewSession
INSERT INTO session ( token, originated_from, used_installation, expires_at ) VALUES ($1, $2, $3, $4)
func (*Queries) SessionGetActiveSessionById ¶
SessionGetActiveSessionById
SELECT id, token, created_at, updated_at, expires_at, deleted_at, originated_from, used_installation FROM session WHERE id = $1 AND expires_at > NOW() AND deleted_at IS NULL LIMIT 1
func (*Queries) SessionGetActiveSessionByToken ¶
func (q *Queries) SessionGetActiveSessionByToken(ctx context.Context, token string) (Session, error)
SessionGetActiveSessionByToken
SELECT id, token, created_at, updated_at, expires_at, deleted_at, originated_from, used_installation FROM session WHERE token = $1 AND expires_at > NOW() AND deleted_at IS NULL LIMIT 1
func (*Queries) SessionSoftDeleteSession ¶
SessionSoftDeleteSession
UPDATE session SET deleted_at = NOW() WHERE id = $1
func (*Queries) TodoSoftDeleteTodo ¶
TodoSoftDeleteTodo
UPDATE todo SET deleted_at = NOW() WHERE id = $1
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) UsersGetUserById ¶
UsersGetUserById
SELECT id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, blocked_until, deleted_at, role_id FROM users WHERE id = $1 AND deleted_at IS NULL LIMIT 1
func (*Queries) UsersGetUserBySessionToken ¶
UsersGetUserBySessionToken
SELECT u.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 FROM session AS s JOIN login_option AS lo ON s.originated_from = lo.id JOIN users AS u ON u.id = lo.user_id WHERE s.token = $1 AND s.deleted_at IS NULL AND u.deleted_at IS NULL AND lo.deleted_at IS NULL AND s.expires_at > NOW() LIMIT 1
func (*Queries) UsersIsUsernameUsed ¶
UsersIsUsernameUsed
SELECT COUNT(*) FROM users WHERE username = $1
func (*Queries) UsersSoftDeleteUser ¶
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
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 Service ¶
func NewConnection ¶
type Session ¶
type Session struct { ID int32 `json:"id"` Token string `json:"token"` 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"` }
type Todo ¶
type Todo struct { ID int32 `json:"id"` Title string `json:"title"` Body pgtype.Text `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 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"` }