Documentation ¶
Index ¶
- type AddPermissionToRoleParams
- type CreateNewInstallationParams
- type CreateNewLoginOptionParams
- type CreateNewOtpParams
- type CreateNewSessionParams
- type CreateNewUserParams
- type DBTX
- type GetActiveLoginOptionParams
- type GetActiveLoginOptionWithUserParams
- type GetActiveLoginOptionWithUserRow
- type GetActiveOtpByIdPairedWithSessionIdParams
- type GetAllPermissionsRow
- type GetAllRoleRow
- type GetRoleWithItsPermissionsRow
- type Installation
- type LoginOption
- type Otp
- type Permission
- type Queries
- func (q *Queries) AddPermissionToRole(ctx context.Context, arg AddPermissionToRoleParams) error
- func (q *Queries) CreateNewInstallation(ctx context.Context, arg CreateNewInstallationParams) (Installation, error)
- func (q *Queries) CreateNewLoginOption(ctx context.Context, arg CreateNewLoginOptionParams) (LoginOption, error)
- func (q *Queries) CreateNewOtp(ctx context.Context, arg CreateNewOtpParams) (Otp, error)
- func (q *Queries) CreateNewPermission(ctx context.Context, name string) (Permission, error)
- func (q *Queries) CreateNewRole(ctx context.Context, name string) (Role, error)
- func (q *Queries) CreateNewSession(ctx context.Context, arg CreateNewSessionParams) (Session, error)
- func (q *Queries) CreateNewUser(ctx context.Context, arg CreateNewUserParams) (User, error)
- func (q *Queries) GetActiveLoginOption(ctx context.Context, arg GetActiveLoginOptionParams) (LoginOption, error)
- func (q *Queries) GetActiveLoginOptionWithUser(ctx context.Context, arg GetActiveLoginOptionWithUserParams) (GetActiveLoginOptionWithUserRow, error)
- func (q *Queries) GetActiveOtpByIdPairedWithSessionId(ctx context.Context, arg GetActiveOtpByIdPairedWithSessionIdParams) (Otp, error)
- func (q *Queries) GetActiveSessionById(ctx context.Context, id int32) (Session, error)
- func (q *Queries) GetActiveSessionByToken(ctx context.Context, token string) (Session, error)
- func (q *Queries) GetAllPermissions(ctx context.Context) ([]GetAllPermissionsRow, error)
- func (q *Queries) GetAllRole(ctx context.Context) ([]GetAllRoleRow, error)
- func (q *Queries) GetRoleWithItsPermissions(ctx context.Context, id int32) ([]GetRoleWithItsPermissionsRow, error)
- func (q *Queries) GetUserById(ctx context.Context, id int32) (User, error)
- func (q *Queries) GetUserBySessionToken(ctx context.Context, token string) (User, error)
- func (q *Queries) IsUsernameUsed(ctx context.Context, username string) (int64, error)
- func (q *Queries) MarkUserLoginOptionAsVerified(ctx context.Context, id int32) error
- func (q *Queries) RecordHitForOtp(ctx context.Context, id int32) (Otp, error)
- func (q *Queries) RemovePermissionFromRole(ctx context.Context, arg RemovePermissionFromRoleParams) error
- func (q *Queries) SetPasswordForUserLoginOption(ctx context.Context, arg SetPasswordForUserLoginOptionParams) error
- func (q *Queries) SoftDeleteInstallation(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteOtp(ctx context.Context, id int32) error
- func (q *Queries) SoftDeletePermission(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteRole(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteSession(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteTodo(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteUser(ctx context.Context, id int32) error
- func (q *Queries) SoftDeleteUserLoginOption(ctx context.Context, id int32) error
- func (q *Queries) UpdateInstallation(ctx context.Context, arg UpdateInstallationParams) error
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RemovePermissionFromRoleParams
- type Role
- type RolePermission
- type Service
- type Session
- type SetPasswordForUserLoginOptionParams
- type Todo
- type UpdateInstallationParams
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateNewInstallationParams ¶
type CreateNewInstallationParams 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 CreateNewOtpParams ¶
type CreateNewSessionParams ¶
type CreateNewUserParams ¶
type GetActiveLoginOptionWithUserRow ¶
type GetActiveLoginOptionWithUserRow 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 GetAllPermissionsRow ¶
type GetAllPermissionsRow struct { ID int32 `json:"id"` Name string `json:"name"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` }
type GetAllRoleRow ¶
type GetAllRoleRow struct { ID int32 `json:"id"` Name string `json:"name"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` }
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"` }
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 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 int32 `json:"otp_for"` UsingSessionID int32 `json:"using_session_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 (*Queries) AddPermissionToRole ¶
func (q *Queries) AddPermissionToRole(ctx context.Context, arg AddPermissionToRoleParams) error
AddPermissionToRole
INSERT INTO role_permission(role_id, permission_id) VALUES($1, $2)
func (*Queries) CreateNewInstallation ¶
func (q *Queries) CreateNewInstallation(ctx context.Context, arg CreateNewInstallationParams) (Installation, error)
CreateNewInstallation
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
func (*Queries) CreateNewLoginOption ¶
func (q *Queries) CreateNewLoginOption(ctx context.Context, arg CreateNewLoginOptionParams) (LoginOption, error)
CreateNewLoginOption
INSERT INTO login_option( login_method, access_key, hashed_pass, pass_salt, user_id ) VALUES ($1, $2, $3, $4, $5) RETURNING id, login_method, access_key, hashed_pass, pass_salt, verified_at, created_at, updated_at, deleted_at, user_id
func (*Queries) CreateNewOtp ¶
CreateNewOtp
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) CreateNewPermission ¶
CreateNewPermission
INSERT INTO permission(name) VALUES($1) RETURNING id, name, created_at, updated_at, deleted_at
func (*Queries) CreateNewRole ¶
CreateNewRole
INSERT INTO role(name) VALUES($1) RETURNING id, name, created_at, updated_at, deleted_at
func (*Queries) CreateNewSession ¶
func (q *Queries) CreateNewSession(ctx context.Context, arg CreateNewSessionParams) (Session, error)
CreateNewSession
INSERT INTO session ( token, originated_from, installation_id, expires_at ) VALUES ($1, $2, $3, $4) RETURNING id, token, created_at, updated_at, expires_at, deleted_at, originated_from, installation_id
func (*Queries) CreateNewUser ¶
CreateNewUser
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, deleted_at, role_id
func (*Queries) GetActiveLoginOption ¶
func (q *Queries) GetActiveLoginOption(ctx context.Context, arg GetActiveLoginOptionParams) (LoginOption, error)
GetActiveLoginOption
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) GetActiveLoginOptionWithUser ¶
func (q *Queries) GetActiveLoginOptionWithUser(ctx context.Context, arg GetActiveLoginOptionWithUserParams) (GetActiveLoginOptionWithUserRow, error)
GetActiveLoginOptionWithUser
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) GetActiveOtpByIdPairedWithSessionId ¶
func (q *Queries) GetActiveOtpByIdPairedWithSessionId(ctx context.Context, arg GetActiveOtpByIdPairedWithSessionIdParams) (Otp, error)
GetActiveOtpByIdPairedWithSessionId
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) GetActiveSessionById ¶
GetActiveSessionById
SELECT id, token, created_at, updated_at, expires_at, deleted_at, originated_from, installation_id FROM session WHERE id = $1 AND expires_at > NOW() AND deleted_at IS NULL LIMIT 1
func (*Queries) GetActiveSessionByToken ¶
GetActiveSessionByToken
SELECT id, token, created_at, updated_at, expires_at, deleted_at, originated_from, installation_id FROM session WHERE token = $1 AND expires_at > NOW() AND deleted_at IS NULL LIMIT 1
func (*Queries) GetAllPermissions ¶
func (q *Queries) GetAllPermissions(ctx context.Context) ([]GetAllPermissionsRow, error)
GetAllPermissions
SELECT id, name, created_at, updated_at FROM permission
func (*Queries) GetAllRole ¶
func (q *Queries) GetAllRole(ctx context.Context) ([]GetAllRoleRow, error)
GetAllRole
SELECT id, name, created_at, updated_at FROM role
func (*Queries) GetRoleWithItsPermissions ¶
func (q *Queries) GetRoleWithItsPermissions(ctx context.Context, id int32) ([]GetRoleWithItsPermissionsRow, error)
GetRoleWithItsPermissions
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) GetUserById ¶
GetUserById
SELECT id, username, profile_image, first_name, middle_name, last_name, created_at, updated_at, blocked_at, deleted_at, role_id FROM users WHERE id = $1 AND deleted_at IS NULL LIMIT 1
func (*Queries) GetUserBySessionToken ¶
GetUserBySessionToken
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.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) MarkUserLoginOptionAsVerified ¶
MarkUserLoginOptionAsVerified
UPDATE login_option SET verified_at = NOW() WHERE id = $1
func (*Queries) RecordHitForOtp ¶
RecordHitForOtp
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) RemovePermissionFromRole ¶
func (q *Queries) RemovePermissionFromRole(ctx context.Context, arg RemovePermissionFromRoleParams) error
RemovePermissionFromRole
DELETE FROM role_permission WHERE role_id = $1 AND permission_id = $2
func (*Queries) SetPasswordForUserLoginOption ¶
func (q *Queries) SetPasswordForUserLoginOption(ctx context.Context, arg SetPasswordForUserLoginOptionParams) error
SetPasswordForUserLoginOption
UPDATE login_option SET hashed_pass = $2, pass_salt = $3 WHERE id = $1
func (*Queries) SoftDeleteInstallation ¶
SoftDeleteInstallation
UPDATE installation SET deleted_at = NOW() WHERE id = $1
func (*Queries) SoftDeletePermission ¶
SoftDeletePermission
UPDATE permission SET deleted_at = NOW() WHERE id = $1
func (*Queries) SoftDeleteSession ¶
SoftDeleteSession
UPDATE session SET deleted_at = NOW() WHERE id = $1
func (*Queries) SoftDeleteUserLoginOption ¶
SoftDeleteUserLoginOption
UPDATE login_option SET deleted_at = NOW() WHERE id = $1
func (*Queries) UpdateInstallation ¶
func (q *Queries) UpdateInstallation(ctx context.Context, arg UpdateInstallationParams) error
UpdateInstallation
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
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 ¶
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"` InstallationID pgtype.Int4 `json:"installation_id"` }
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"` DeletedAt pgtype.Timestamptz `json:"deleted_at"` RoleID pgtype.Int4 `json:"role_id"` }
Click to show internal directories.
Click to hide internal directories.