models

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package models contains the database models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acl

type Acl struct {
	AclID         pgtype.Int4 `json:"acl_id"`
	UserID        int32       `json:"user_id"`
	Isstaff       int16       `json:"isstaff"`
	Flags         flags.ACL   `json:"flags"`
	Xtra          int32       `json:"xtra"`
	LastUpdated   int32       `json:"last_updated"`
	LastUpdatedBy int32       `json:"last_updated_by"`
	SuspendExpire int32       `json:"suspend_expire"`
	SuspendBy     int32       `json:"suspend_by"`
	Deleted       int16       `json:"deleted"`
}

type AddChannelMemberParams added in v0.3.0

type AddChannelMemberParams struct {
	ChannelID int32       `json:"channel_id"`
	UserID    int32       `json:"user_id"`
	Access    int32       `json:"access"`
	AddedBy   pgtype.Text `json:"added_by"`
}

type AddChannelMemberRow added in v0.3.0

type AddChannelMemberRow struct {
	ChannelID int32       `json:"channel_id"`
	UserID    int32       `json:"user_id"`
	Access    int32       `json:"access"`
	Added     pgtype.Int4 `json:"added"`
}

type AddUsersToRoleParams added in v0.0.6

type AddUsersToRoleParams struct {
	UserID    int32  `json:"user_id"`
	RoleID    int32  `json:"role_id"`
	CreatedBy string `json:"created_by"`
}

type Adminlog

type Adminlog struct {
	ID        int32       `json:"id"`
	UserID    int32       `json:"user_id"`
	Cmd       pgtype.Text `json:"cmd"`
	Args      pgtype.Text `json:"args"`
	Timestamp int32       `json:"timestamp"`
	IssueBy   pgtype.Text `json:"issue_by"`
}

type ApiKey added in v0.5.2

type ApiKey struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	// SHA-256 hash of the API key (plain key never stored)
	KeyHash string `json:"key_hash"`
	// JSON array of permission scopes (e.g., ["channels:read", "users:write"])
	Scopes      []byte      `json:"scopes"`
	CreatedBy   int32       `json:"created_by"`
	CreatedAt   int32       `json:"created_at"`
	LastUsedAt  pgtype.Int4 `json:"last_used_at"`
	ExpiresAt   pgtype.Int4 `json:"expires_at"`
	LastUpdated int32       `json:"last_updated"`
	// Soft delete flag: 0=active, 1=deleted
	Deleted pgtype.Int2 `json:"deleted"`
	// Array of CIDR ranges (IPv4/IPv6) allowed to use this API key. Empty array means no restrictions.
	IpRestrictions []byte `json:"ip_restrictions"`
}

Service-to-service authentication keys with scoped permissions

type Ban

type Ban struct {
	ID          pgtype.Int4 `json:"id"`
	ChannelID   int32       `json:"channel_id"`
	Banmask     string      `json:"banmask"`
	SetBy       pgtype.Text `json:"set_by"`
	SetTs       pgtype.Int4 `json:"set_ts"`
	Level       pgtype.Int2 `json:"level"`
	Expires     pgtype.Int4 `json:"expires"`
	Reason      pgtype.Text `json:"reason"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type Channel

type Channel struct {
	ID           int32             `json:"id"`
	Name         string            `json:"name"`
	Flags        flags.Channel     `json:"flags"`
	MassDeopPro  int16             `json:"mass_deop_pro"`
	FloodPro     int32             `json:"flood_pro"`
	Url          pgtype.Text       `json:"url"`
	Description  pgtype.Text       `json:"description"`
	Comment      pgtype.Text       `json:"comment"`
	Keywords     pgtype.Text       `json:"keywords"`
	RegisteredTs pgtype.Int4       `json:"registered_ts"`
	ChannelTs    int32             `json:"channel_ts"`
	ChannelMode  pgtype.Text       `json:"channel_mode"`
	Userflags    flags.ChannelUser `json:"userflags"`
	LimitOffset  pgtype.Int4       `json:"limit_offset"`
	LimitPeriod  pgtype.Int4       `json:"limit_period"`
	LimitGrace   pgtype.Int4       `json:"limit_grace"`
	LimitMax     pgtype.Int4       `json:"limit_max"`
	NoTake       pgtype.Int4       `json:"no_take"`
	LastUpdated  int32             `json:"last_updated"`
	Deleted      pgtype.Int2       `json:"deleted"`
	MaxBans      pgtype.Int4       `json:"max_bans"`
	Welcome      pgtype.Text       `json:"welcome"`
}

type Channellog

type Channellog struct {
	Ts          pgtype.Int4 `json:"ts"`
	Channelid   pgtype.Int4 `json:"channelid"`
	Event       pgtype.Int2 `json:"event"`
	Message     pgtype.Text `json:"message"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type CheckChannelExistsAndRegisteredRow added in v0.4.1

type CheckChannelExistsAndRegisteredRow struct {
	ID           int32       `json:"id"`
	Name         string      `json:"name"`
	RegisteredTs pgtype.Int4 `json:"registered_ts"`
}

type CheckChannelExistsRow added in v0.3.0

type CheckChannelExistsRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
}

type CheckChannelMemberExistsRow added in v0.3.0

type CheckChannelMemberExistsRow struct {
	ChannelID int32 `json:"channel_id"`
	UserID    int32 `json:"user_id"`
	Access    int32 `json:"access"`
}

type CheckChannelNameExistsRow added in v0.4.0

type CheckChannelNameExistsRow struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
}

type CheckChannelNoregStatusRow added in v0.4.0

type CheckChannelNoregStatusRow struct {
	IsNoreg    bool        `json:"is_noreg"`
	NoregType  interface{} `json:"noreg_type"`
	Reason     interface{} `json:"reason"`
	NeverReg   interface{} `json:"never_reg"`
	ExpireTime interface{} `json:"expire_time"`
}

type CheckExistingPendingRequestsRow added in v0.4.1

type CheckExistingPendingRequestsRow struct {
	ID         pgtype.Int4 `json:"id"`
	ChannelID  int32       `json:"channel_id"`
	Confirmed  pgtype.Int2 `json:"confirmed"`
	ChangeType pgtype.Int2 `json:"change_type"`
}

type CheckMultipleSupportersConcurrentSupportsRow added in v0.4.0

type CheckMultipleSupportersConcurrentSupportsRow struct {
	ID           int32  `json:"id"`
	Username     string `json:"user_name"`
	SupportCount int64  `json:"support_count"`
	ExceedsLimit bool   `json:"exceeds_limit"`
}

type CheckMultipleSupportersNoregStatusRow added in v0.4.0

type CheckMultipleSupportersNoregStatusRow struct {
	Username interface{} `json:"user_name"`
	IsNoreg  bool        `json:"is_noreg"`
}

type CheckNewManagerChannelAccessRow added in v0.4.1

type CheckNewManagerChannelAccessRow struct {
	Username string      `json:"user_name"`
	ID       int32       `json:"id"`
	SignupTs pgtype.Int4 `json:"signup_ts"`
}

type CheckPendingChannelNameConflictRow added in v0.4.0

type CheckPendingChannelNameConflictRow struct {
	CreatedTs   int32       `json:"created_ts"`
	ManagerID   pgtype.Int4 `json:"manager_id"`
	ManagerName string      `json:"manager_name"`
}

type CheckUserChannelOwnershipRow added in v0.4.1

type CheckUserChannelOwnershipRow struct {
	Name         string      `json:"name"`
	ID           int32       `json:"id"`
	RegisteredTs pgtype.Int4 `json:"registered_ts"`
}

type CheckUserCooldownStatusRow added in v0.4.1

type CheckUserCooldownStatusRow struct {
	PostForms        int32       `json:"post_forms"`
	Verificationdata pgtype.Text `json:"verificationdata"`
	Email            pgtype.Text `json:"email"`
}

type Complaint

type Complaint struct {
	ID                    int32  `json:"id"`
	FromID                int32  `json:"from_id"`
	FromEmail             string `json:"from_email"`
	InrecEmail            string `json:"inrec_email"`
	ComplaintType         int32  `json:"complaint_type"`
	ComplaintText         string `json:"complaint_text"`
	ComplaintLogs         string `json:"complaint_logs"`
	ComplaintChannel1ID   int32  `json:"complaint_channel1_id"`
	ComplaintChannel1Name string `json:"complaint_channel1_name"`
	ComplaintChannel2ID   int32  `json:"complaint_channel2_id"`
	ComplaintChannel2Name string `json:"complaint_channel2_name"`
	ComplaintUsersID      int32  `json:"complaint_users_id"`
	Status                int32  `json:"status"`
	Nicelevel             int32  `json:"nicelevel"`
	ReviewedByID          int32  `json:"reviewed_by_id"`
	ReviewedTs            int32  `json:"reviewed_ts"`
	CreatedTs             int32  `json:"created_ts"`
	CreatedIp             string `json:"created_ip"`
	CreatedCrc            string `json:"created_crc"`
	CrcExpiration         int32  `json:"crc_expiration"`
	TicketNumber          string `json:"ticket_number"`
	CurrentOwner          int32  `json:"current_owner"`
}

type ComplaintType

type ComplaintType struct {
	ID             int32  `json:"id"`
	ComplaintLabel string `json:"complaint_label"`
}

type ComplaintsReference

type ComplaintsReference struct {
	ComplaintsRef int32 `json:"complaints_ref"`
	ReferencedBy  int32 `json:"referenced_by"`
	ReferencedTo  int32 `json:"referenced_to"`
	ReferenceTs   int32 `json:"reference_ts"`
	IsNew         int32 `json:"is_new"`
}

type ComplaintsThread

type ComplaintsThread struct {
	ID           int32  `json:"id"`
	ComplaintRef int32  `json:"complaint_ref"`
	ReplyBy      int32  `json:"reply_by"`
	ReplyTs      int32  `json:"reply_ts"`
	ReplyText    string `json:"reply_text"`
	ActionsText  string `json:"actions_text"`
	InReplyTo    int32  `json:"in_reply_to"`
}

type Count

type Count struct {
	CountType  pgtype.Int2 `json:"count_type"`
	CountCount pgtype.Int4 `json:"count_count"`
}

type CreateAPIKeyParams added in v0.5.2

type CreateAPIKeyParams struct {
	Name           string      `json:"name"`
	Description    pgtype.Text `json:"description"`
	KeyHash        string      `json:"key_hash"`
	Scopes         []byte      `json:"scopes"`
	IpRestrictions []byte      `json:"ip_restrictions"`
	CreatedBy      int32       `json:"created_by"`
	CreatedAt      int32       `json:"created_at"`
	LastUpdated    int32       `json:"last_updated"`
}

type CreateChannelForInstantRegistrationRow added in v0.4.0

type CreateChannelForInstantRegistrationRow struct {
	ID           int32       `json:"id"`
	Name         string      `json:"name"`
	RegisteredTs pgtype.Int4 `json:"registered_ts"`
}

type CreateChannelForRegistrationRow added in v0.4.0

type CreateChannelForRegistrationRow struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
}

type CreateChannelParams added in v0.4.0

type CreateChannelParams struct {
	Name        string        `json:"name"`
	Flags       flags.Channel `json:"flags"`
	Description pgtype.Text   `json:"description"`
}

type CreateChannelRow added in v0.4.0

type CreateChannelRow struct {
	ID           int32       `json:"id"`
	Name         string      `json:"name"`
	Description  pgtype.Text `json:"description"`
	RegisteredTs pgtype.Int4 `json:"registered_ts"`
}

type CreateInstantRegistrationParams added in v0.4.0

type CreateInstantRegistrationParams struct {
	ChannelID   int32       `json:"channel_id"`
	ManagerID   pgtype.Int4 `json:"manager_id"`
	Managername pgtype.Text `json:"managername"`
	Description pgtype.Text `json:"description"`
}

type CreateInstantRegistrationRow added in v0.4.0

type CreateInstantRegistrationRow struct {
	ChannelID int32       `json:"channel_id"`
	ManagerID pgtype.Int4 `json:"manager_id"`
	CreatedTs int32       `json:"created_ts"`
}

type CreatePasswordResetTokenParams added in v0.3.0

type CreatePasswordResetTokenParams struct {
	UserID      pgtype.Int4 `json:"user_id"`
	Token       string      `json:"token"`
	CreatedAt   int32       `json:"created_at"`
	ExpiresAt   int32       `json:"expires_at"`
	LastUpdated int32       `json:"last_updated"`
}

type CreatePendingChannelParams added in v0.4.0

type CreatePendingChannelParams struct {
	ChannelID   int32       `json:"channel_id"`
	ManagerID   pgtype.Int4 `json:"manager_id"`
	Managername pgtype.Text `json:"managername"`
	Description pgtype.Text `json:"description"`
}

type CreatePendingChannelRow added in v0.4.0

type CreatePendingChannelRow struct {
	ChannelID int32       `json:"channel_id"`
	ManagerID pgtype.Int4 `json:"manager_id"`
	CreatedTs int32       `json:"created_ts"`
}

type CreatePendingUserParams

type CreatePendingUserParams struct {
	Username         pgtype.Text       `json:"user_name"`
	Password         password.Password `json:"password"`
	Cookie           pgtype.Text       `json:"cookie"`
	Expire           pgtype.Int4       `json:"expire"`
	Email            pgtype.Text       `json:"email"`
	Language         pgtype.Int4       `json:"language"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	PosterIp         pgtype.Text       `json:"poster_ip"`
}

type CreateRoleParams added in v0.0.6

type CreateRoleParams struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	CreatedBy   string `json:"created_by"`
}

type CreateUserParams

type CreateUserParams struct {
	Username         string            `json:"user_name"`
	Password         password.Password `json:"password"`
	Flags            flags.User        `json:"flags"`
	Email            pgtype.Text       `json:"email"`
	LastUpdated      int32             `json:"last_updated"`
	LastUpdatedBy    pgtype.Text       `json:"last_updated_by"`
	LanguageID       pgtype.Int4       `json:"language_id"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	PostForms        int32             `json:"post_forms"`
	SignupTs         pgtype.Int4       `json:"signup_ts"`
	SignupIp         pgtype.Text       `json:"signup_ip"`
	Maxlogins        pgtype.Int4       `json:"maxlogins"`
}

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
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type DefaultMsg

type DefaultMsg struct {
	ID      pgtype.Int4 `json:"id"`
	Type    int32       `json:"type"`
	Label   string      `json:"label"`
	Content string      `json:"content"`
}

type DeletionTransaction

type DeletionTransaction struct {
	Tableid     pgtype.Int4 `json:"tableid"`
	Key1        pgtype.Int4 `json:"key1"`
	Key2        pgtype.Int4 `json:"key2"`
	Key3        pgtype.Int4 `json:"key3"`
	LastUpdated int32       `json:"last_updated"`
}

type Domain

type Domain struct {
	ID          int32       `json:"id"`
	Domain      string      `json:"domain"`
	Flags       int16       `json:"flags"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type FraudList

type FraudList struct {
	ID   pgtype.Int4 `json:"id"`
	Name string      `json:"name"`
}

type FraudListDatum

type FraudListDatum struct {
	ListID int32 `json:"list_id"`
	UserID int32 `json:"user_id"`
}

type GetAdminLevelRow added in v0.0.6

type GetAdminLevelRow struct {
	Access         int32       `json:"access"`
	SuspendExpires pgtype.Int4 `json:"suspend_expires"`
}

type GetChannelByIDRow added in v0.3.0

type GetChannelByIDRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
	CreatedAt   pgtype.Int4 `json:"created_at"`
	MemberCount int64       `json:"member_count"`
}

type GetChannelByNameRow added in v0.3.0

type GetChannelByNameRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
}

type GetChannelDetailsRow added in v0.3.0

type GetChannelDetailsRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
	CreatedAt   pgtype.Int4 `json:"created_at"`
	LastUpdated int32       `json:"last_updated"`
	MemberCount int64       `json:"member_count"`
}

type GetChannelMembersByAccessLevelRow added in v0.3.0

type GetChannelMembersByAccessLevelRow struct {
	UserID int32 `json:"user_id"`
	Access int32 `json:"access"`
}

type GetChannelUserAccessRow added in v0.3.0

type GetChannelUserAccessRow struct {
	Access    int32 `json:"access"`
	UserID    int32 `json:"user_id"`
	ChannelID int32 `json:"channel_id"`
}

type GetManagerChangeRequestByTokenRow added in v0.4.1

type GetManagerChangeRequestByTokenRow struct {
	ID           pgtype.Int4 `json:"id"`
	ChannelID    int32       `json:"channel_id"`
	ManagerID    int32       `json:"manager_id"`
	NewManagerID int32       `json:"new_manager_id"`
	ChangeType   pgtype.Int2 `json:"change_type"`
	OptDuration  pgtype.Int4 `json:"opt_duration"`
	Reason       pgtype.Text `json:"reason"`
	Expiration   pgtype.Int4 `json:"expiration"`
	Crc          pgtype.Text `json:"crc"`
	Confirmed    pgtype.Int2 `json:"confirmed"`
	FromHost     pgtype.Text `json:"from_host"`
	ChannelName  string      `json:"channel_name"`
}

type GetManagerChangeRequestStatusRow added in v0.4.1

type GetManagerChangeRequestStatusRow struct {
	ID                 pgtype.Int4 `json:"id"`
	ChannelID          int32       `json:"channel_id"`
	ChangeType         pgtype.Int2 `json:"change_type"`
	Confirmed          pgtype.Int2 `json:"confirmed"`
	Expiration         pgtype.Int4 `json:"expiration"`
	Reason             pgtype.Text `json:"reason"`
	OptDuration        pgtype.Int4 `json:"opt_duration"`
	NewManagerUsername string      `json:"new_manager_username"`
}

type GetPasswordResetTokenStatsRow added in v0.3.0

type GetPasswordResetTokenStatsRow struct {
	TotalTokens   int64 `json:"total_tokens"`
	UsedTokens    int64 `json:"used_tokens"`
	ExpiredTokens int64 `json:"expired_tokens"`
	ActiveTokens  int64 `json:"active_tokens"`
}

type GetSupportersByUsernamesRow added in v0.4.0

type GetSupportersByUsernamesRow struct {
	ID           int32       `json:"id"`
	Username     string      `json:"user_name"`
	Flags        flags.User  `json:"flags"`
	Email        pgtype.Text `json:"email"`
	SignupTs     pgtype.Int4 `json:"signup_ts"`
	LastSeen     pgtype.Int4 `json:"last_seen"`
	IsOldEnough  bool        `json:"is_old_enough"`
	DaysOld      interface{} `json:"days_old"`
	HasFraudFlag bool        `json:"has_fraud_flag"`
}

type GetUserBackupCodesRow added in v0.4.1

type GetUserBackupCodesRow struct {
	BackupCodes     []byte      `json:"backup_codes"`
	BackupCodesRead pgtype.Bool `json:"backup_codes_read"`
}

type GetUserChannelLimitParams added in v0.4.0

type GetUserChannelLimitParams struct {
	ID      int32 `json:"id"`
	Column2 int32 `json:"column_2"`
	Column3 int32 `json:"column_3"`
	Column4 int32 `json:"column_4"`
}

type GetUserChannelMembershipsRow added in v0.3.0

type GetUserChannelMembershipsRow struct {
	ChannelID   int32       `json:"channel_id"`
	ChannelName string      `json:"channel_name"`
	AccessLevel int32       `json:"access_level"`
	JoinedAt    pgtype.Int4 `json:"joined_at"`
	MemberCount int64       `json:"member_count"`
}

type GetUserChannelsRow

type GetUserChannelsRow struct {
	Name           string      `json:"name"`
	ChannelID      int32       `json:"channel_id"`
	UserID         int32       `json:"user_id"`
	Access         int32       `json:"access"`
	Flags          int16       `json:"flags"`
	LastModif      pgtype.Int4 `json:"last_modif"`
	SuspendExpires pgtype.Int4 `json:"suspend_expires"`
	SuspendBy      pgtype.Text `json:"suspend_by"`
}

type GetUserNoregDetailsRow added in v0.4.0

type GetUserNoregDetailsRow struct {
	Type       int32       `json:"type"`
	Reason     pgtype.Text `json:"reason"`
	NeverReg   int32       `json:"never_reg"`
	ExpireTime pgtype.Int4 `json:"expire_time"`
}

type GetUserParams added in v0.0.6

type GetUserParams struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	ID       int32  `json:"id"`
}

type GetUserRow added in v0.0.6

type GetUserRow struct {
	ID               int32             `json:"id"`
	Username         string            `json:"user_name"`
	Password         password.Password `json:"password"`
	Email            pgtype.Text       `json:"email"`
	Url              pgtype.Text       `json:"url"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	LanguageID       pgtype.Int4       `json:"language_id"`
	PublicKey        pgtype.Text       `json:"public_key"`
	PostForms        int32             `json:"post_forms"`
	Flags            flags.User        `json:"flags"`
	LastUpdatedBy    pgtype.Text       `json:"last_updated_by"`
	LastUpdated      int32             `json:"last_updated"`
	Deleted          pgtype.Int2       `json:"deleted"`
	TzSetting        pgtype.Text       `json:"tz_setting"`
	SignupCookie     pgtype.Text       `json:"signup_cookie"`
	SignupTs         pgtype.Int4       `json:"signup_ts"`
	SignupIp         pgtype.Text       `json:"signup_ip"`
	Maxlogins        pgtype.Int4       `json:"maxlogins"`
	TotpKey          pgtype.Text       `json:"totp_key"`
	BackupCodes      []byte            `json:"backup_codes"`
	BackupCodesRead  pgtype.Bool       `json:"backup_codes_read"`
	LastSeen         pgtype.Int4       `json:"last_seen"`
	LanguageCode     pgtype.Text       `json:"language_code"`
	LanguageName     pgtype.Text       `json:"language_name"`
}

type GetUsersByUsernamesRow added in v0.0.6

type GetUsersByUsernamesRow struct {
	ID               int32             `json:"id"`
	Username         string            `json:"user_name"`
	Password         password.Password `json:"password"`
	Email            pgtype.Text       `json:"email"`
	Url              pgtype.Text       `json:"url"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	LanguageID       pgtype.Int4       `json:"language_id"`
	PublicKey        pgtype.Text       `json:"public_key"`
	PostForms        int32             `json:"post_forms"`
	Flags            flags.User        `json:"flags"`
	LastUpdatedBy    pgtype.Text       `json:"last_updated_by"`
	LastUpdated      int32             `json:"last_updated"`
	Deleted          pgtype.Int2       `json:"deleted"`
	TzSetting        pgtype.Text       `json:"tz_setting"`
	SignupCookie     pgtype.Text       `json:"signup_cookie"`
	SignupTs         pgtype.Int4       `json:"signup_ts"`
	SignupIp         pgtype.Text       `json:"signup_ip"`
	Maxlogins        pgtype.Int4       `json:"maxlogins"`
	TotpKey          pgtype.Text       `json:"totp_key"`
	BackupCodes      []byte            `json:"backup_codes"`
	BackupCodesRead  pgtype.Bool       `json:"backup_codes_read"`
	LastSeen         pgtype.Int4       `json:"last_seen"`
	LanguageCode     pgtype.Text       `json:"language_code"`
	LanguageName     pgtype.Text       `json:"language_name"`
}

type Gline

type Gline struct {
	ID          pgtype.Int4 `json:"id"`
	Host        string      `json:"host"`
	Addedby     string      `json:"addedby"`
	Addedon     int32       `json:"addedon"`
	Expiresat   int32       `json:"expiresat"`
	Lastupdated int32       `json:"lastupdated"`
	Reason      pgtype.Text `json:"reason"`
}

type Help

type Help struct {
	Topic      string      `json:"topic"`
	LanguageID pgtype.Int4 `json:"language_id"`
	Contents   pgtype.Text `json:"contents"`
}

type InsertManagerChangeRequestParams added in v0.4.1

type InsertManagerChangeRequestParams struct {
	ChannelID    int32       `json:"channel_id"`
	ManagerID    int32       `json:"manager_id"`
	NewManagerID int32       `json:"new_manager_id"`
	ChangeType   pgtype.Int2 `json:"change_type"`
	OptDuration  pgtype.Int4 `json:"opt_duration"`
	Reason       pgtype.Text `json:"reason"`
	Expiration   pgtype.Int4 `json:"expiration"`
	Crc          pgtype.Text `json:"crc"`
	FromHost     pgtype.Text `json:"from_host"`
}

type IpRestrict

type IpRestrict struct {
	ID          pgtype.Int4 `json:"id"`
	UserID      int32       `json:"user_id"`
	Added       int32       `json:"added"`
	AddedBy     int32       `json:"added_by"`
	Type        int32       `json:"type"`
	Value       netip.Addr  `json:"value"`
	LastUpdated int32       `json:"last_updated"`
	LastUsed    int32       `json:"last_used"`
	Expiry      int32       `json:"expiry"`
	Description pgtype.Text `json:"description"`
}

type Language

type Language struct {
	ID          int32       `json:"id"`
	Code        pgtype.Text `json:"code"`
	Name        pgtype.Text `json:"name"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type Lastrequest

type Lastrequest struct {
	Ip            pgtype.Text `json:"ip"`
	LastRequestTs pgtype.Int4 `json:"last_request_ts"`
}

type Level

type Level struct {
	ChannelID      int32       `json:"channel_id"`
	UserID         int32       `json:"user_id"`
	Access         int32       `json:"access"`
	Flags          int16       `json:"flags"`
	SuspendExpires pgtype.Int4 `json:"suspend_expires"`
	SuspendLevel   pgtype.Int4 `json:"suspend_level"`
	SuspendBy      pgtype.Text `json:"suspend_by"`
	SuspendReason  pgtype.Text `json:"suspend_reason"`
	Added          pgtype.Int4 `json:"added"`
	AddedBy        pgtype.Text `json:"added_by"`
	LastModif      pgtype.Int4 `json:"last_modif"`
	LastModifBy    pgtype.Text `json:"last_modif_by"`
	LastUpdated    int32       `json:"last_updated"`
	Deleted        pgtype.Int2 `json:"deleted"`
}

type Lock

type Lock struct {
	Section pgtype.Int2 `json:"section"`
	Since   pgtype.Int4 `json:"since"`
	By      pgtype.Int4 `json:"by"`
}

type MarkBackupCodesAsReadParams added in v0.4.1

type MarkBackupCodesAsReadParams struct {
	ID            int32       `json:"id"`
	LastUpdated   int32       `json:"last_updated"`
	LastUpdatedBy pgtype.Text `json:"last_updated_by"`
}

type MarkPasswordResetTokenAsUsedParams added in v0.3.0

type MarkPasswordResetTokenAsUsedParams struct {
	Token       string      `json:"token"`
	UsedAt      pgtype.Int4 `json:"used_at"`
	LastUpdated int32       `json:"last_updated"`
}

type Noreg

type Noreg struct {
	ID          pgtype.Int4 `json:"id"`
	Username    pgtype.Text `json:"user_name"`
	Email       pgtype.Text `json:"email"`
	ChannelName pgtype.Text `json:"channel_name"`
	Type        int32       `json:"type"`
	NeverReg    int32       `json:"never_reg"`
	ForReview   int32       `json:"for_review"`
	ExpireTime  pgtype.Int4 `json:"expire_time"`
	CreatedTs   pgtype.Int4 `json:"created_ts"`
	SetBy       pgtype.Text `json:"set_by"`
	Reason      pgtype.Text `json:"reason"`
}

type Note

type Note struct {
	MessageID   int32       `json:"message_id"`
	UserID      int32       `json:"user_id"`
	FromUserID  pgtype.Int4 `json:"from_user_id"`
	Message     pgtype.Text `json:"message"`
	LastUpdated int32       `json:"last_updated"`
}

type Notice

type Notice struct {
	MessageID   int32       `json:"message_id"`
	UserID      int32       `json:"user_id"`
	Message     pgtype.Text `json:"message"`
	LastUpdated int32       `json:"last_updated"`
}

type Objection

type Objection struct {
	ChannelID int32       `json:"channel_id"`
	UserID    int32       `json:"user_id"`
	Comment   string      `json:"comment"`
	CreatedTs int32       `json:"created_ts"`
	AdminOnly pgtype.Text `json:"admin_only"`
}

type PasswordResetToken added in v0.3.0

type PasswordResetToken struct {
	ID          int32       `json:"id"`
	UserID      pgtype.Int4 `json:"user_id"`
	Token       string      `json:"token"`
	CreatedAt   int32       `json:"created_at"`
	ExpiresAt   int32       `json:"expires_at"`
	UsedAt      pgtype.Int4 `json:"used_at"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type Pending

type Pending struct {
	ChannelID       int32       `json:"channel_id"`
	ManagerID       pgtype.Int4 `json:"manager_id"`
	CreatedTs       int32       `json:"created_ts"`
	CheckStartTs    int32       `json:"check_start_ts"`
	Status          pgtype.Int4 `json:"status"`
	JoinCount       pgtype.Int4 `json:"join_count"`
	UniqueJoinCount pgtype.Int4 `json:"unique_join_count"`
	DecisionTs      pgtype.Int4 `json:"decision_ts"`
	Decision        pgtype.Text `json:"decision"`
	Managername     pgtype.Text `json:"managername"`
	RegAcknowledged pgtype.Text `json:"reg_acknowledged"`
	Comments        pgtype.Text `json:"comments"`
	LastUpdated     int32       `json:"last_updated"`
	Description     pgtype.Text `json:"description"`
	Reviewed        string      `json:"reviewed"`
	FirstInit       string      `json:"first_init"`
	ReviewedByID    pgtype.Int4 `json:"reviewed_by_id"`
}

type PendingChanfixScore

type PendingChanfixScore struct {
	ChannelID   pgtype.Int4 `json:"channel_id"`
	UserID      string      `json:"user_id"`
	Rank        int32       `json:"rank"`
	Score       int32       `json:"score"`
	Account     string      `json:"account"`
	FirstOpped  pgtype.Text `json:"first_opped"`
	LastOpped   pgtype.Text `json:"last_opped"`
	LastUpdated int32       `json:"last_updated"`
	First       string      `json:"first"`
}

type PendingEmailchange

type PendingEmailchange struct {
	Cookie     string `json:"cookie"`
	UserID     int32  `json:"user_id"`
	OldEmail   string `json:"old_email"`
	NewEmail   string `json:"new_email"`
	Expiration int32  `json:"expiration"`
	Phase      int32  `json:"phase"`
}

type PendingMgrchange

type PendingMgrchange struct {
	ID           pgtype.Int4 `json:"id"`
	ChannelID    int32       `json:"channel_id"`
	ManagerID    int32       `json:"manager_id"`
	NewManagerID int32       `json:"new_manager_id"`
	ChangeType   pgtype.Int2 `json:"change_type"`
	OptDuration  pgtype.Int4 `json:"opt_duration"`
	Reason       pgtype.Text `json:"reason"`
	Expiration   pgtype.Int4 `json:"expiration"`
	Crc          pgtype.Text `json:"crc"`
	Confirmed    pgtype.Int2 `json:"confirmed"`
	FromHost     pgtype.Text `json:"from_host"`
}

type PendingPasswordchange

type PendingPasswordchange struct {
	Cookie     string `json:"cookie"`
	UserID     int32  `json:"user_id"`
	OldCrypt   string `json:"old_crypt"`
	NewCrypt   string `json:"new_crypt"`
	NewClrpass string `json:"new_clrpass"`
	CreatedTs  int32  `json:"created_ts"`
}

type PendingPwreset

type PendingPwreset struct {
	Cookie           string `json:"cookie"`
	UserID           int32  `json:"user_id"`
	QuestionID       int16  `json:"question_id"`
	Verificationdata string `json:"verificationdata"`
	Expiration       int32  `json:"expiration"`
}

type PendingTraffic

type PendingTraffic struct {
	ChannelID int32       `json:"channel_id"`
	IpNumber  netip.Addr  `json:"ip_number"`
	JoinCount pgtype.Int4 `json:"join_count"`
}

type Pendinguser

type Pendinguser struct {
	Username         pgtype.Text       `json:"user_name"`
	Cookie           pgtype.Text       `json:"cookie"`
	Email            pgtype.Text       `json:"email"`
	Expire           pgtype.Int4       `json:"expire"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	PosterIp         pgtype.Text       `json:"poster_ip"`
	Language         pgtype.Int4       `json:"language"`
	Password         password.Password `json:"password"`
}

type Querier

type Querier interface {
	AddChannelMember(ctx context.Context, arg AddChannelMemberParams) (AddChannelMemberRow, error)
	// Adds the manager as owner (access 500) for instant registration
	AddChannelOwner(ctx context.Context, channelID int32, userID int32) error
	AddUserRole(ctx context.Context, userID int32, roleID int32) error
	AddUsersToRole(ctx context.Context, arg []AddUsersToRoleParams) (int64, error)
	CheckChannelExists(ctx context.Context, id int32) (CheckChannelExistsRow, error)
	// Validate channel exists and is registered (managerchange.php:197)
	CheckChannelExistsAndRegistered(ctx context.Context, id int32) (CheckChannelExistsAndRegisteredRow, error)
	CheckChannelMemberExists(ctx context.Context, channelID int32, userID int32) (CheckChannelMemberExistsRow, error)
	// Checks if a channel name already exists
	CheckChannelNameExists(ctx context.Context, lower string) (CheckChannelNameExistsRow, error)
	// Checks if a channel name is in NOREG
	CheckChannelNoregStatus(ctx context.Context, lower string) (CheckChannelNoregStatusRow, error)
	// Ensure channel has only one manager (managerchange.php:295)
	CheckChannelSingleManager(ctx context.Context, id int32) (int64, error)
	CheckEmailExists(ctx context.Context, email string) ([]pgtype.Text, error)
	// Manager Change SQL Queries
	// Based on legacy PHP implementation with optimizations
	// Check for existing pending requests (managerchange.php:206,217)
	CheckExistingPendingRequests(ctx context.Context, channelID int32) ([]CheckExistingPendingRequestsRow, error)
	// Efficiently checks concurrent supports for multiple supporters at once
	CheckMultipleSupportersConcurrentSupports(ctx context.Context, column1 []string, column2 int32) ([]CheckMultipleSupportersConcurrentSupportsRow, error)
	// Efficiently checks NOREG status for multiple supporters at once
	CheckMultipleSupportersNoregStatus(ctx context.Context, dollar_1 []string) ([]CheckMultipleSupportersNoregStatusRow, error)
	// Check new manager has level 499 on channel (managerchange.php:433)
	CheckNewManagerChannelAccess(ctx context.Context, channelID int32, iD int32) (CheckNewManagerChannelAccessRow, error)
	// Checks if there's already a pending registration for this channel name
	CheckPendingChannelNameConflict(ctx context.Context, lower string) (CheckPendingChannelNameConflictRow, error)
	// Checks how many channels a supporter is currently supporting
	CheckSupporterConcurrentSupports(ctx context.Context, userID int32) (int64, error)
	// Checks if a supporter has NOREG status
	CheckSupporterNoregStatus(ctx context.Context, lower string) (bool, error)
	// Check if user has level 500 access on channel (managerchange.php:362)
	CheckUserChannelOwnership(ctx context.Context, userID int32, iD int32) (CheckUserChannelOwnershipRow, error)
	// Check user form submission cooldown status
	CheckUserCooldownStatus(ctx context.Context, id int32) (CheckUserCooldownStatusRow, error)
	// NOREG table queries for checking user restrictions
	// Checks if a user has NOREG status
	CheckUserNoregStatus(ctx context.Context, lower string) (bool, error)
	// Check if user already owns other channels (managerchange.php:443)
	CheckUserOwnsOtherChannels(ctx context.Context, id int32) (bool, error)
	CheckUsernameExists(ctx context.Context, username string) ([]string, error)
	// Clean up expired unconfirmed requests (confirm_mgrchange.php:16)
	CleanupExpiredManagerChangeRequests(ctx context.Context) error
	// Removes expired NOREG entries (matches PHP cleanup)
	CleanupExpiredNoreg(ctx context.Context) error
	CleanupExpiredPasswordResetTokens(ctx context.Context, expiresAt int32, lastUpdated int32) error
	// Mark request as confirmed (confirm_mgrchange.php:25)
	ConfirmManagerChangeRequest(ctx context.Context, crc pgtype.Text) error
	CountChannelOwners(ctx context.Context, channelID int32) (int64, error)
	CreateAPIKey(ctx context.Context, arg CreateAPIKeyParams) (ApiKey, error)
	// Channel Registration INSERT queries
	// Creates a new channel entry (when registration is approved)
	CreateChannel(ctx context.Context, arg CreateChannelParams) (CreateChannelRow, error)
	// Creates a new channel entry for instant registration (no supporters required)
	CreateChannelForInstantRegistration(ctx context.Context, name string) (CreateChannelForInstantRegistrationRow, error)
	// Creates a new channel entry for pending registration
	CreateChannelForRegistration(ctx context.Context, name string) (CreateChannelForRegistrationRow, error)
	// Supporters table queries for channel registration
	// Adds a supporter to a pending channel registration
	CreateChannelSupporter(ctx context.Context, channelID int32, userID int32) error
	// Creates an instant registration (when no supporters required)
	CreateInstantRegistration(ctx context.Context, arg CreateInstantRegistrationParams) (CreateInstantRegistrationRow, error)
	CreatePasswordResetToken(ctx context.Context, arg CreatePasswordResetTokenParams) (PasswordResetToken, error)
	// Creates a new pending channel registration
	CreatePendingChannel(ctx context.Context, arg CreatePendingChannelParams) (CreatePendingChannelRow, error)
	CreatePendingUser(ctx context.Context, arg CreatePendingUserParams) (pgtype.Text, error)
	CreateRole(ctx context.Context, arg CreateRoleParams) (Role, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	DeleteAPIKey(ctx context.Context, iD int32, lastUpdated int32) error
	// Removes all supporters for a pending channel
	DeleteChannelSupporters(ctx context.Context, channelID int32) error
	DeleteExpiredPasswordResetTokens(ctx context.Context, expiresAt int32) error
	// Removes a pending channel registration
	DeletePendingChannel(ctx context.Context, channelID int32) error
	DeletePendingUserByCookie(ctx context.Context, cookie pgtype.Text) error
	DeleteRole(ctx context.Context, id int32) error
	// Removes a specific supporter from a pending channel
	DeleteSpecificChannelSupporter(ctx context.Context, channelID int32, userID int32) error
	GetAPIKey(ctx context.Context, id int32) (ApiKey, error)
	GetAPIKeyByHash(ctx context.Context, keyHash string) (ApiKey, error)
	GetAPIKeysExpiringSoon(ctx context.Context, expiresAt pgtype.Int4) ([]ApiKey, error)
	GetActivePasswordResetTokensByUserID(ctx context.Context, userID pgtype.Int4, expiresAt int32) ([]PasswordResetToken, error)
	GetAdminLevel(ctx context.Context, userID int32) (GetAdminLevelRow, error)
	GetChannelByID(ctx context.Context, id int32) (GetChannelByIDRow, error)
	GetChannelByName(ctx context.Context, name string) (GetChannelByNameRow, error)
	GetChannelDetails(ctx context.Context, id int32) (GetChannelDetailsRow, error)
	GetChannelMembersByAccessLevel(ctx context.Context, channelID int32, access int32) ([]GetChannelMembersByAccessLevelRow, error)
	GetChannelUserAccess(ctx context.Context, channelID int32, userID int32) (GetChannelUserAccessRow, error)
	GetGlineByIP(ctx context.Context, host string) (Gline, error)
	// Returns the timestamp of the user's last successful channel registration
	GetLastChannelRegistration(ctx context.Context, userID int32) (pgtype.Int4, error)
	// Validate confirmation token (confirm_mgrchange.php:17)
	GetManagerChangeRequestByToken(ctx context.Context, crc pgtype.Text) (GetManagerChangeRequestByTokenRow, error)
	// Get status of pending manager change requests for a channel
	GetManagerChangeRequestStatus(ctx context.Context, channelID int32) (GetManagerChangeRequestStatusRow, error)
	GetPasswordResetTokenByToken(ctx context.Context, token string) (PasswordResetToken, error)
	GetPasswordResetTokenStats(ctx context.Context, expiresAt int32) (GetPasswordResetTokenStatsRow, error)
	GetPendingUserByCookie(ctx context.Context, cookie pgtype.Text) (Pendinguser, error)
	GetRoleByID(ctx context.Context, id int32) (Role, error)
	GetRoleByName(ctx context.Context, name string) (Role, error)
	// Gets all supporter information in one query for efficient validation
	// This replaces multiple individual supporter validation queries
	GetSupportersByUsernames(ctx context.Context, column1 []string, column2 int32) ([]GetSupportersByUsernamesRow, error)
	GetUser(ctx context.Context, arg GetUserParams) (GetUserRow, error)
	// Gets user's backup codes and read status
	GetUserBackupCodes(ctx context.Context, id int32) (GetUserBackupCodesRow, error)
	// Channel Registration SELECT queries
	// Returns the count of channels owned by a user
	GetUserChannelCount(ctx context.Context, userID int32) (int64, error)
	// Channel Registration related user queries
	// Gets the channel limit for a user based on their flags
	GetUserChannelLimit(ctx context.Context, arg GetUserChannelLimitParams) (int32, error)
	GetUserChannelMemberships(ctx context.Context, userID int32) ([]GetUserChannelMembershipsRow, error)
	GetUserChannels(ctx context.Context, userID int32) ([]GetUserChannelsRow, error)
	// Gets detailed NOREG information for a user
	GetUserNoregDetails(ctx context.Context, lower string) (GetUserNoregDetailsRow, error)
	// Pending table queries for channel registration
	// Returns the count of pending channel registrations for a user
	GetUserPendingRegistrations(ctx context.Context, managerID pgtype.Int4) (int64, error)
	GetUsersByUsernames(ctx context.Context, userids []string) ([]GetUsersByUsernamesRow, error)
	GetWhiteListByIP(ctx context.Context, ip netip.Addr) (Whitelist, error)
	// Create pending manager change request (managerchange.php:327-328)
	InsertManagerChangeRequest(ctx context.Context, arg InsertManagerChangeRequestParams) (pgtype.Int4, error)
	InvalidateUserPasswordResetTokens(ctx context.Context, userID pgtype.Int4, lastUpdated int32) error
	ListAPIKeys(ctx context.Context) ([]ApiKey, error)
	ListPendingUsers(ctx context.Context) ([]Pendinguser, error)
	ListRoles(ctx context.Context) ([]Role, error)
	ListUserRoles(ctx context.Context, userID int32) ([]Role, error)
	// Marks backup codes as read after user has seen them
	MarkBackupCodesAsRead(ctx context.Context, arg MarkBackupCodesAsReadParams) error
	MarkPasswordResetTokenAsUsed(ctx context.Context, arg MarkPasswordResetTokenAsUsedParams) error
	RemoveChannelMember(ctx context.Context, arg RemoveChannelMemberParams) (RemoveChannelMemberRow, error)
	RemoveUserRole(ctx context.Context, userID int32, roleID int32) error
	RemoveUsersFromRole(ctx context.Context, userIds []int32, roleID int32) error
	SearchChannels(ctx context.Context, arg SearchChannelsParams) ([]SearchChannelsRow, error)
	SearchChannelsCount(ctx context.Context, name string) (int64, error)
	// Channel Registration DELETE queries
	// Soft deletes a channel by setting registered_ts to 0
	SoftDeleteChannel(ctx context.Context, id int32) error
	UpdateAPIKeyIPRestrictions(ctx context.Context, arg UpdateAPIKeyIPRestrictionsParams) error
	UpdateAPIKeyLastUsed(ctx context.Context, iD int32, lastUsedAt pgtype.Int4) error
	UpdateAPIKeyScopes(ctx context.Context, arg UpdateAPIKeyScopesParams) error
	// Channel Registration UPDATE queries
	// Updates channel registration related timestamps and status
	UpdateChannelRegistrationStatus(ctx context.Context, id int32) error
	UpdateChannelSettings(ctx context.Context, arg UpdateChannelSettingsParams) (UpdateChannelSettingsRow, error)
	// Updates the description of a pending channel registration
	UpdatePendingChannelDescription(ctx context.Context, channelID int32, description pgtype.Text) error
	// Updates the status of a pending channel registration
	UpdatePendingChannelStatus(ctx context.Context, arg UpdatePendingChannelStatusParams) (UpdatePendingChannelStatusRow, error)
	UpdateRole(ctx context.Context, arg UpdateRoleParams) error
	// Backup codes related queries
	// Updates user's backup codes and marks them as unread
	UpdateUserBackupCodes(ctx context.Context, arg UpdateUserBackupCodesParams) error
	// Set user form submission cooldown (managerchange.php:352)
	UpdateUserCooldown(ctx context.Context, iD int32, column2 interface{}) error
	UpdateUserFlags(ctx context.Context, arg UpdateUserFlagsParams) error
	// Updates user's last seen timestamp (used for instant registration)
	UpdateUserLastSeen(ctx context.Context, userID int32) error
	UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
	UpdateUserTotpKey(ctx context.Context, arg UpdateUserTotpKeyParams) error
	ValidatePasswordResetToken(ctx context.Context, token string, expiresAt int32) (PasswordResetToken, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddChannelMember added in v0.3.0

func (q *Queries) AddChannelMember(ctx context.Context, arg AddChannelMemberParams) (AddChannelMemberRow, error)

func (*Queries) AddChannelOwner added in v0.4.0

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

Adds the manager as owner (access 500) for instant registration

func (*Queries) AddUserRole added in v0.0.6

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

func (*Queries) AddUsersToRole added in v0.0.6

func (q *Queries) AddUsersToRole(ctx context.Context, arg []AddUsersToRoleParams) (int64, error)

func (*Queries) CheckChannelExists added in v0.3.0

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

func (*Queries) CheckChannelExistsAndRegistered added in v0.4.1

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

Validate channel exists and is registered (managerchange.php:197)

func (*Queries) CheckChannelMemberExists added in v0.3.0

func (q *Queries) CheckChannelMemberExists(ctx context.Context, channelID int32, userID int32) (CheckChannelMemberExistsRow, error)

func (*Queries) CheckChannelNameExists added in v0.4.0

func (q *Queries) CheckChannelNameExists(ctx context.Context, lower string) (CheckChannelNameExistsRow, error)

Checks if a channel name already exists

func (*Queries) CheckChannelNoregStatus added in v0.4.0

func (q *Queries) CheckChannelNoregStatus(ctx context.Context, lower string) (CheckChannelNoregStatusRow, error)

Checks if a channel name is in NOREG

func (*Queries) CheckChannelSingleManager added in v0.4.1

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

Ensure channel has only one manager (managerchange.php:295)

func (*Queries) CheckEmailExists added in v0.0.4

func (q *Queries) CheckEmailExists(ctx context.Context, email string) ([]pgtype.Text, error)

func (*Queries) CheckExistingPendingRequests added in v0.4.1

func (q *Queries) CheckExistingPendingRequests(ctx context.Context, channelID int32) ([]CheckExistingPendingRequestsRow, error)

Manager Change SQL Queries Based on legacy PHP implementation with optimizations Check for existing pending requests (managerchange.php:206,217)

func (*Queries) CheckMultipleSupportersConcurrentSupports added in v0.4.0

func (q *Queries) CheckMultipleSupportersConcurrentSupports(ctx context.Context, column1 []string, column2 int32) ([]CheckMultipleSupportersConcurrentSupportsRow, error)

Efficiently checks concurrent supports for multiple supporters at once

func (*Queries) CheckMultipleSupportersNoregStatus added in v0.4.0

func (q *Queries) CheckMultipleSupportersNoregStatus(ctx context.Context, dollar_1 []string) ([]CheckMultipleSupportersNoregStatusRow, error)

Efficiently checks NOREG status for multiple supporters at once

func (*Queries) CheckNewManagerChannelAccess added in v0.4.1

func (q *Queries) CheckNewManagerChannelAccess(ctx context.Context, channelID int32, iD int32) (CheckNewManagerChannelAccessRow, error)

Check new manager has level 499 on channel (managerchange.php:433)

func (*Queries) CheckPendingChannelNameConflict added in v0.4.0

func (q *Queries) CheckPendingChannelNameConflict(ctx context.Context, lower string) (CheckPendingChannelNameConflictRow, error)

Checks if there's already a pending registration for this channel name

func (*Queries) CheckSupporterConcurrentSupports added in v0.4.0

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

Checks how many channels a supporter is currently supporting

func (*Queries) CheckSupporterNoregStatus added in v0.4.0

func (q *Queries) CheckSupporterNoregStatus(ctx context.Context, lower string) (bool, error)

Checks if a supporter has NOREG status

func (*Queries) CheckUserChannelOwnership added in v0.4.1

func (q *Queries) CheckUserChannelOwnership(ctx context.Context, userID int32, iD int32) (CheckUserChannelOwnershipRow, error)

Check if user has level 500 access on channel (managerchange.php:362)

func (*Queries) CheckUserCooldownStatus added in v0.4.1

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

Check user form submission cooldown status

func (*Queries) CheckUserNoregStatus added in v0.4.0

func (q *Queries) CheckUserNoregStatus(ctx context.Context, lower string) (bool, error)

NOREG table queries for checking user restrictions Checks if a user has NOREG status

func (*Queries) CheckUserOwnsOtherChannels added in v0.4.1

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

Check if user already owns other channels (managerchange.php:443)

func (*Queries) CheckUsernameExists added in v0.0.4

func (q *Queries) CheckUsernameExists(ctx context.Context, username string) ([]string, error)

func (*Queries) CleanupExpiredManagerChangeRequests added in v0.4.1

func (q *Queries) CleanupExpiredManagerChangeRequests(ctx context.Context) error

Clean up expired unconfirmed requests (confirm_mgrchange.php:16)

func (*Queries) CleanupExpiredNoreg added in v0.4.0

func (q *Queries) CleanupExpiredNoreg(ctx context.Context) error

Removes expired NOREG entries (matches PHP cleanup)

func (*Queries) CleanupExpiredPasswordResetTokens added in v0.3.0

func (q *Queries) CleanupExpiredPasswordResetTokens(ctx context.Context, expiresAt int32, lastUpdated int32) error

func (*Queries) ConfirmManagerChangeRequest added in v0.4.1

func (q *Queries) ConfirmManagerChangeRequest(ctx context.Context, crc pgtype.Text) error

Mark request as confirmed (confirm_mgrchange.php:25)

func (*Queries) CountChannelOwners added in v0.3.0

func (q *Queries) CountChannelOwners(ctx context.Context, channelID int32) (int64, error)

func (*Queries) CreateAPIKey added in v0.5.2

func (q *Queries) CreateAPIKey(ctx context.Context, arg CreateAPIKeyParams) (ApiKey, error)

func (*Queries) CreateChannel added in v0.4.0

func (q *Queries) CreateChannel(ctx context.Context, arg CreateChannelParams) (CreateChannelRow, error)

Channel Registration INSERT queries Creates a new channel entry (when registration is approved)

func (*Queries) CreateChannelForInstantRegistration added in v0.4.0

func (q *Queries) CreateChannelForInstantRegistration(ctx context.Context, name string) (CreateChannelForInstantRegistrationRow, error)

Creates a new channel entry for instant registration (no supporters required)

func (*Queries) CreateChannelForRegistration added in v0.4.0

func (q *Queries) CreateChannelForRegistration(ctx context.Context, name string) (CreateChannelForRegistrationRow, error)

Creates a new channel entry for pending registration

func (*Queries) CreateChannelSupporter added in v0.4.0

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

Supporters table queries for channel registration Adds a supporter to a pending channel registration

func (*Queries) CreateInstantRegistration added in v0.4.0

Creates an instant registration (when no supporters required)

func (*Queries) CreatePasswordResetToken added in v0.3.0

func (q *Queries) CreatePasswordResetToken(ctx context.Context, arg CreatePasswordResetTokenParams) (PasswordResetToken, error)

func (*Queries) CreatePendingChannel added in v0.4.0

func (q *Queries) CreatePendingChannel(ctx context.Context, arg CreatePendingChannelParams) (CreatePendingChannelRow, error)

Creates a new pending channel registration

func (*Queries) CreatePendingUser

func (q *Queries) CreatePendingUser(ctx context.Context, arg CreatePendingUserParams) (pgtype.Text, error)

func (*Queries) CreateRole added in v0.0.6

func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) (Role, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteAPIKey added in v0.5.2

func (q *Queries) DeleteAPIKey(ctx context.Context, iD int32, lastUpdated int32) error

func (*Queries) DeleteChannelSupporters added in v0.4.0

func (q *Queries) DeleteChannelSupporters(ctx context.Context, channelID int32) error

Removes all supporters for a pending channel

func (*Queries) DeleteExpiredPasswordResetTokens added in v0.3.0

func (q *Queries) DeleteExpiredPasswordResetTokens(ctx context.Context, expiresAt int32) error

func (*Queries) DeletePendingChannel added in v0.4.0

func (q *Queries) DeletePendingChannel(ctx context.Context, channelID int32) error

Removes a pending channel registration

func (*Queries) DeletePendingUserByCookie

func (q *Queries) DeletePendingUserByCookie(ctx context.Context, cookie pgtype.Text) error

func (*Queries) DeleteRole added in v0.0.6

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

func (*Queries) DeleteSpecificChannelSupporter added in v0.4.0

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

Removes a specific supporter from a pending channel

func (*Queries) GetAPIKey added in v0.5.2

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

func (*Queries) GetAPIKeyByHash added in v0.5.2

func (q *Queries) GetAPIKeyByHash(ctx context.Context, keyHash string) (ApiKey, error)

func (*Queries) GetAPIKeysExpiringSoon added in v0.5.2

func (q *Queries) GetAPIKeysExpiringSoon(ctx context.Context, expiresAt pgtype.Int4) ([]ApiKey, error)

func (*Queries) GetActivePasswordResetTokensByUserID added in v0.3.0

func (q *Queries) GetActivePasswordResetTokensByUserID(ctx context.Context, userID pgtype.Int4, expiresAt int32) ([]PasswordResetToken, error)

func (*Queries) GetAdminLevel added in v0.0.6

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

func (*Queries) GetChannelByID added in v0.3.0

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

func (*Queries) GetChannelByName added in v0.3.0

func (q *Queries) GetChannelByName(ctx context.Context, name string) (GetChannelByNameRow, error)

func (*Queries) GetChannelDetails added in v0.3.0

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

func (*Queries) GetChannelMembersByAccessLevel added in v0.3.0

func (q *Queries) GetChannelMembersByAccessLevel(ctx context.Context, channelID int32, access int32) ([]GetChannelMembersByAccessLevelRow, error)

func (*Queries) GetChannelUserAccess added in v0.3.0

func (q *Queries) GetChannelUserAccess(ctx context.Context, channelID int32, userID int32) (GetChannelUserAccessRow, error)

func (*Queries) GetGlineByIP added in v0.0.3

func (q *Queries) GetGlineByIP(ctx context.Context, host string) (Gline, error)

func (*Queries) GetLastChannelRegistration added in v0.4.0

func (q *Queries) GetLastChannelRegistration(ctx context.Context, userID int32) (pgtype.Int4, error)

Returns the timestamp of the user's last successful channel registration

func (*Queries) GetManagerChangeRequestByToken added in v0.4.1

func (q *Queries) GetManagerChangeRequestByToken(ctx context.Context, crc pgtype.Text) (GetManagerChangeRequestByTokenRow, error)

Validate confirmation token (confirm_mgrchange.php:17)

func (*Queries) GetManagerChangeRequestStatus added in v0.4.1

func (q *Queries) GetManagerChangeRequestStatus(ctx context.Context, channelID int32) (GetManagerChangeRequestStatusRow, error)

Get status of pending manager change requests for a channel

func (*Queries) GetPasswordResetTokenByToken added in v0.3.0

func (q *Queries) GetPasswordResetTokenByToken(ctx context.Context, token string) (PasswordResetToken, error)

func (*Queries) GetPasswordResetTokenStats added in v0.3.0

func (q *Queries) GetPasswordResetTokenStats(ctx context.Context, expiresAt int32) (GetPasswordResetTokenStatsRow, error)

func (*Queries) GetPendingUserByCookie added in v0.1.0

func (q *Queries) GetPendingUserByCookie(ctx context.Context, cookie pgtype.Text) (Pendinguser, error)

func (*Queries) GetRoleByID added in v0.0.6

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

func (*Queries) GetRoleByName added in v0.0.6

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

func (*Queries) GetSupportersByUsernames added in v0.4.0

func (q *Queries) GetSupportersByUsernames(ctx context.Context, column1 []string, column2 int32) ([]GetSupportersByUsernamesRow, error)

Gets all supporter information in one query for efficient validation This replaces multiple individual supporter validation queries

func (*Queries) GetUser added in v0.0.6

func (q *Queries) GetUser(ctx context.Context, arg GetUserParams) (GetUserRow, error)

func (*Queries) GetUserBackupCodes added in v0.4.1

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

Gets user's backup codes and read status

func (*Queries) GetUserChannelCount added in v0.4.0

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

Channel Registration SELECT queries Returns the count of channels owned by a user

func (*Queries) GetUserChannelLimit added in v0.4.0

func (q *Queries) GetUserChannelLimit(ctx context.Context, arg GetUserChannelLimitParams) (int32, error)

Channel Registration related user queries Gets the channel limit for a user based on their flags

func (*Queries) GetUserChannelMemberships added in v0.3.0

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

func (*Queries) GetUserChannels

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

func (*Queries) GetUserNoregDetails added in v0.4.0

func (q *Queries) GetUserNoregDetails(ctx context.Context, lower string) (GetUserNoregDetailsRow, error)

Gets detailed NOREG information for a user

func (*Queries) GetUserPendingRegistrations added in v0.4.0

func (q *Queries) GetUserPendingRegistrations(ctx context.Context, managerID pgtype.Int4) (int64, error)

Pending table queries for channel registration Returns the count of pending channel registrations for a user

func (*Queries) GetUsersByUsernames added in v0.0.6

func (q *Queries) GetUsersByUsernames(ctx context.Context, userids []string) ([]GetUsersByUsernamesRow, error)

func (*Queries) GetWhiteListByIP added in v0.0.3

func (q *Queries) GetWhiteListByIP(ctx context.Context, ip netip.Addr) (Whitelist, error)

func (*Queries) InsertManagerChangeRequest added in v0.4.1

func (q *Queries) InsertManagerChangeRequest(ctx context.Context, arg InsertManagerChangeRequestParams) (pgtype.Int4, error)

Create pending manager change request (managerchange.php:327-328)

func (*Queries) InvalidateUserPasswordResetTokens added in v0.3.0

func (q *Queries) InvalidateUserPasswordResetTokens(ctx context.Context, userID pgtype.Int4, lastUpdated int32) error

func (*Queries) ListAPIKeys added in v0.5.2

func (q *Queries) ListAPIKeys(ctx context.Context) ([]ApiKey, error)

func (*Queries) ListPendingUsers

func (q *Queries) ListPendingUsers(ctx context.Context) ([]Pendinguser, error)

func (*Queries) ListRoles added in v0.0.6

func (q *Queries) ListRoles(ctx context.Context) ([]Role, error)

func (*Queries) ListUserRoles added in v0.0.6

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

func (*Queries) MarkBackupCodesAsRead added in v0.4.1

func (q *Queries) MarkBackupCodesAsRead(ctx context.Context, arg MarkBackupCodesAsReadParams) error

Marks backup codes as read after user has seen them

func (*Queries) MarkPasswordResetTokenAsUsed added in v0.3.0

func (q *Queries) MarkPasswordResetTokenAsUsed(ctx context.Context, arg MarkPasswordResetTokenAsUsedParams) error

func (*Queries) RemoveChannelMember added in v0.3.0

func (q *Queries) RemoveChannelMember(ctx context.Context, arg RemoveChannelMemberParams) (RemoveChannelMemberRow, error)

func (*Queries) RemoveUserRole added in v0.0.6

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

func (*Queries) RemoveUsersFromRole added in v0.0.6

func (q *Queries) RemoveUsersFromRole(ctx context.Context, userIds []int32, roleID int32) error

func (*Queries) SearchChannels added in v0.3.0

func (q *Queries) SearchChannels(ctx context.Context, arg SearchChannelsParams) ([]SearchChannelsRow, error)

func (*Queries) SearchChannelsCount added in v0.3.0

func (q *Queries) SearchChannelsCount(ctx context.Context, name string) (int64, error)

func (*Queries) SoftDeleteChannel added in v0.4.0

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

Channel Registration DELETE queries Soft deletes a channel by setting registered_ts to 0

func (*Queries) UpdateAPIKeyIPRestrictions added in v0.5.2

func (q *Queries) UpdateAPIKeyIPRestrictions(ctx context.Context, arg UpdateAPIKeyIPRestrictionsParams) error

func (*Queries) UpdateAPIKeyLastUsed added in v0.5.2

func (q *Queries) UpdateAPIKeyLastUsed(ctx context.Context, iD int32, lastUsedAt pgtype.Int4) error

func (*Queries) UpdateAPIKeyScopes added in v0.5.2

func (q *Queries) UpdateAPIKeyScopes(ctx context.Context, arg UpdateAPIKeyScopesParams) error

func (*Queries) UpdateChannelRegistrationStatus added in v0.4.0

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

Channel Registration UPDATE queries Updates channel registration related timestamps and status

func (*Queries) UpdateChannelSettings added in v0.3.0

func (q *Queries) UpdateChannelSettings(ctx context.Context, arg UpdateChannelSettingsParams) (UpdateChannelSettingsRow, error)

func (*Queries) UpdatePendingChannelDescription added in v0.4.0

func (q *Queries) UpdatePendingChannelDescription(ctx context.Context, channelID int32, description pgtype.Text) error

Updates the description of a pending channel registration

func (*Queries) UpdatePendingChannelStatus added in v0.4.0

Updates the status of a pending channel registration

func (*Queries) UpdateRole added in v0.0.6

func (q *Queries) UpdateRole(ctx context.Context, arg UpdateRoleParams) error

func (*Queries) UpdateUserBackupCodes added in v0.4.1

func (q *Queries) UpdateUserBackupCodes(ctx context.Context, arg UpdateUserBackupCodesParams) error

Backup codes related queries Updates user's backup codes and marks them as unread

func (*Queries) UpdateUserCooldown added in v0.4.1

func (q *Queries) UpdateUserCooldown(ctx context.Context, iD int32, column2 interface{}) error

Set user form submission cooldown (managerchange.php:352)

func (*Queries) UpdateUserFlags added in v0.2.0

func (q *Queries) UpdateUserFlags(ctx context.Context, arg UpdateUserFlagsParams) error

func (*Queries) UpdateUserLastSeen added in v0.4.0

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

Updates user's last seen timestamp (used for instant registration)

func (*Queries) UpdateUserPassword added in v0.2.0

func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error

func (*Queries) UpdateUserTotpKey added in v0.2.0

func (q *Queries) UpdateUserTotpKey(ctx context.Context, arg UpdateUserTotpKeyParams) error

func (*Queries) ValidatePasswordResetToken added in v0.3.0

func (q *Queries) ValidatePasswordResetToken(ctx context.Context, token string, expiresAt int32) (PasswordResetToken, error)

func (*Queries) WithTx

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

type RemoveChannelMemberParams added in v0.3.0

type RemoveChannelMemberParams struct {
	ChannelID   int32       `json:"channel_id"`
	UserID      int32       `json:"user_id"`
	LastModifBy pgtype.Text `json:"last_modif_by"`
}

type RemoveChannelMemberRow added in v0.3.0

type RemoveChannelMemberRow struct {
	ChannelID int32       `json:"channel_id"`
	UserID    int32       `json:"user_id"`
	Access    int32       `json:"access"`
	LastModif pgtype.Int4 `json:"last_modif"`
}

type Role added in v0.0.6

type Role struct {
	ID          int32            `json:"id"`
	Name        string           `json:"name"`
	Description string           `json:"description"`
	CreatedAt   pgtype.Timestamp `json:"created_at"`
	UpdatedAt   pgtype.Timestamp `json:"updated_at"`
	CreatedBy   string           `json:"created_by"`
	UpdatedBy   pgtype.Text      `json:"updated_by"`
}

type SearchChannelsParams added in v0.3.0

type SearchChannelsParams struct {
	Name   string `json:"name"`
	Limit  int32  `json:"limit"`
	Offset int32  `json:"offset"`
}

type SearchChannelsRow added in v0.3.0

type SearchChannelsRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
	CreatedAt   pgtype.Int4 `json:"created_at"`
	MemberCount int64       `json:"member_count"`
}

type Service

type Service struct {
	*Queries
}

Service is a wrapper around the database queries that embeds all Querier methods

func NewService

func NewService(db *Queries) *Service

NewService creates a new Service

func (*Service) WithTx added in v0.1.0

func (s *Service) WithTx(tx pgx.Tx) ServiceInterface

WithTx returns a new Service instance that wraps the provided transaction

type ServiceInterface added in v0.1.0

type ServiceInterface interface {
	Querier
	WithTx(tx pgx.Tx) ServiceInterface
}

ServiceInterface is an interface for the database model

type Statistic

type Statistic struct {
	UsersID       int32  `json:"users_id"`
	StatsType     int32  `json:"stats_type"`
	StatsValueInt int32  `json:"stats_value_int"`
	StatsValueChr string `json:"stats_value_chr"`
	LastUpdated   int32  `json:"last_updated"`
}

type Supporter

type Supporter struct {
	ChannelID   int32       `json:"channel_id"`
	UserID      int32       `json:"user_id"`
	Support     pgtype.Text `json:"support"`
	Noticed     string      `json:"noticed"`
	Reason      pgtype.Text `json:"reason"`
	JoinCount   pgtype.Int4 `json:"join_count"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type Timezone

type Timezone struct {
	TzIndex       pgtype.Int4 `json:"tz_index"`
	TzName        string      `json:"tz_name"`
	TzCountrycode string      `json:"tz_countrycode"`
	TzAcronym     string      `json:"tz_acronym"`
	Deleted       pgtype.Int2 `json:"deleted"`
	LastUpdated   int32       `json:"last_updated"`
}

type Translation

type Translation struct {
	LanguageID  int32       `json:"language_id"`
	ResponseID  int32       `json:"response_id"`
	Text        pgtype.Text `json:"text"`
	LastUpdated int32       `json:"last_updated"`
	Deleted     pgtype.Int2 `json:"deleted"`
}

type UpdateAPIKeyIPRestrictionsParams added in v0.5.2

type UpdateAPIKeyIPRestrictionsParams struct {
	ID             int32  `json:"id"`
	IpRestrictions []byte `json:"ip_restrictions"`
	LastUpdated    int32  `json:"last_updated"`
}

type UpdateAPIKeyScopesParams added in v0.5.2

type UpdateAPIKeyScopesParams struct {
	ID          int32  `json:"id"`
	Scopes      []byte `json:"scopes"`
	LastUpdated int32  `json:"last_updated"`
}

type UpdateChannelSettingsParams added in v0.3.0

type UpdateChannelSettingsParams struct {
	ID          int32       `json:"id"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
}

type UpdateChannelSettingsRow added in v0.3.0

type UpdateChannelSettingsRow struct {
	ID          int32       `json:"id"`
	Name        string      `json:"name"`
	Description pgtype.Text `json:"description"`
	Url         pgtype.Text `json:"url"`
	CreatedAt   pgtype.Int4 `json:"created_at"`
	LastUpdated int32       `json:"last_updated"`
}

type UpdatePendingChannelStatusParams added in v0.4.0

type UpdatePendingChannelStatusParams struct {
	ChannelID    int32       `json:"channel_id"`
	Status       pgtype.Int4 `json:"status"`
	Decision     pgtype.Text `json:"decision"`
	ReviewedByID pgtype.Int4 `json:"reviewed_by_id"`
}

type UpdatePendingChannelStatusRow added in v0.4.0

type UpdatePendingChannelStatusRow struct {
	ChannelID  int32       `json:"channel_id"`
	ManagerID  pgtype.Int4 `json:"manager_id"`
	Status     pgtype.Int4 `json:"status"`
	DecisionTs pgtype.Int4 `json:"decision_ts"`
}

type UpdateRoleParams added in v0.0.6

type UpdateRoleParams struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	UpdatedBy   pgtype.Text      `json:"updated_by"`
	UpdatedAt   pgtype.Timestamp `json:"updated_at"`
	ID          int32            `json:"id"`
}

type UpdateUserBackupCodesParams added in v0.4.1

type UpdateUserBackupCodesParams struct {
	ID            int32       `json:"id"`
	BackupCodes   []byte      `json:"backup_codes"`
	LastUpdated   int32       `json:"last_updated"`
	LastUpdatedBy pgtype.Text `json:"last_updated_by"`
}

type UpdateUserFlagsParams added in v0.2.0

type UpdateUserFlagsParams struct {
	ID            int32       `json:"id"`
	Flags         flags.User  `json:"flags"`
	LastUpdated   int32       `json:"last_updated"`
	LastUpdatedBy pgtype.Text `json:"last_updated_by"`
}

type UpdateUserPasswordParams added in v0.2.0

type UpdateUserPasswordParams struct {
	ID            int32             `json:"id"`
	Password      password.Password `json:"password"`
	LastUpdated   int32             `json:"last_updated"`
	LastUpdatedBy pgtype.Text       `json:"last_updated_by"`
}

type UpdateUserTotpKeyParams added in v0.2.0

type UpdateUserTotpKeyParams struct {
	ID            int32       `json:"id"`
	TotpKey       pgtype.Text `json:"totp_key"`
	LastUpdated   int32       `json:"last_updated"`
	LastUpdatedBy pgtype.Text `json:"last_updated_by"`
}

type User

type User struct {
	ID               int32             `json:"id"`
	Username         string            `json:"user_name"`
	Password         password.Password `json:"password"`
	Email            pgtype.Text       `json:"email"`
	Url              pgtype.Text       `json:"url"`
	QuestionID       pgtype.Int2       `json:"question_id"`
	Verificationdata pgtype.Text       `json:"verificationdata"`
	LanguageID       pgtype.Int4       `json:"language_id"`
	PublicKey        pgtype.Text       `json:"public_key"`
	PostForms        int32             `json:"post_forms"`
	Flags            flags.User        `json:"flags"`
	LastUpdatedBy    pgtype.Text       `json:"last_updated_by"`
	LastUpdated      int32             `json:"last_updated"`
	Deleted          pgtype.Int2       `json:"deleted"`
	TzSetting        pgtype.Text       `json:"tz_setting"`
	SignupCookie     pgtype.Text       `json:"signup_cookie"`
	SignupTs         pgtype.Int4       `json:"signup_ts"`
	SignupIp         pgtype.Text       `json:"signup_ip"`
	Maxlogins        pgtype.Int4       `json:"maxlogins"`
	TotpKey          pgtype.Text       `json:"totp_key"`
	// JSON containing backup codes and metadata: {backup_codes, generated_at, codes_remaining}. Backup codes are bcrypt-hashed for security.
	BackupCodes     []byte      `json:"backup_codes"`
	BackupCodesRead pgtype.Bool `json:"backup_codes_read"`
}

type UserRole added in v0.0.6

type UserRole struct {
	UserID    int32            `json:"user_id"`
	RoleID    int32            `json:"role_id"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
	UpdatedAt pgtype.Timestamp `json:"updated_at"`
	CreatedBy string           `json:"created_by"`
	UpdatedBy pgtype.Text      `json:"updated_by"`
}

type UserSecHistory

type UserSecHistory struct {
	UserID    int32  `json:"user_id"`
	Username  string `json:"user_name"`
	Command   string `json:"command"`
	Ip        string `json:"ip"`
	Hostmask  string `json:"hostmask"`
	Timestamp int32  `json:"timestamp"`
}

type Userlog

type Userlog struct {
	Ts          pgtype.Int4 `json:"ts"`
	UserID      pgtype.Int4 `json:"user_id"`
	Event       pgtype.Int4 `json:"event"`
	Message     pgtype.Text `json:"message"`
	LastUpdated int32       `json:"last_updated"`
}

type UsersLastseen

type UsersLastseen struct {
	UserID       int32       `json:"user_id"`
	LastSeen     pgtype.Int4 `json:"last_seen"`
	LastHostmask pgtype.Text `json:"last_hostmask"`
	LastIp       pgtype.Text `json:"last_ip"`
	LastUpdated  int32       `json:"last_updated"`
}

type Variable

type Variable struct {
	VarName     string      `json:"var_name"`
	Contents    pgtype.Text `json:"contents"`
	Hint        pgtype.Text `json:"hint"`
	LastUpdated pgtype.Int4 `json:"last_updated"`
}

type Webnotice

type Webnotice struct {
	ID        int32  `json:"id"`
	CreatedTs int32  `json:"created_ts"`
	Contents  string `json:"contents"`
}

type Whitelist

type Whitelist struct {
	ID        pgtype.Int4 `json:"id"`
	Ip        netip.Addr  `json:"ip"`
	Addedby   string      `json:"addedby"`
	Addedon   int32       `json:"addedon"`
	Expiresat int32       `json:"expiresat"`
	Reason    pgtype.Text `json:"reason"`
}

Jump to

Keyboard shortcuts

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