Files
PrivateCaptcha/pkg/db/generated/models.go
T
2025-12-06 14:04:04 +01:00

338 lines
12 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
package generated
import (
"database/sql/driver"
"fmt"
"github.com/jackc/pgx/v5/pgtype"
"time"
)
type AccessLevel string
const (
AccessLevelMember AccessLevel = "member"
AccessLevelInvited AccessLevel = "invited"
AccessLevelOwner AccessLevel = "owner"
)
func (e *AccessLevel) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AccessLevel(s)
case string:
*e = AccessLevel(s)
default:
return fmt.Errorf("unsupported scan type for AccessLevel: %T", src)
}
return nil
}
type NullAccessLevel struct {
AccessLevel AccessLevel `json:"backend_access_level"`
Valid bool `json:"valid"` // Valid is true if AccessLevel is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAccessLevel) Scan(value interface{}) error {
if value == nil {
ns.AccessLevel, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AccessLevel.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAccessLevel) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.AccessLevel), nil
}
type AuditLogAction string
const (
AuditLogActionUnknown AuditLogAction = "unknown"
AuditLogActionCreate AuditLogAction = "create"
AuditLogActionUpdate AuditLogAction = "update"
AuditLogActionSoftDelete AuditLogAction = "softdelete"
AuditLogActionDelete AuditLogAction = "delete"
AuditLogActionRecover AuditLogAction = "recover"
AuditLogActionLogin AuditLogAction = "login"
AuditLogActionLogout AuditLogAction = "logout"
AuditLogActionAccess AuditLogAction = "access"
)
func (e *AuditLogAction) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AuditLogAction(s)
case string:
*e = AuditLogAction(s)
default:
return fmt.Errorf("unsupported scan type for AuditLogAction: %T", src)
}
return nil
}
type NullAuditLogAction struct {
AuditLogAction AuditLogAction `json:"backend_audit_log_action"`
Valid bool `json:"valid"` // Valid is true if AuditLogAction is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAuditLogAction) Scan(value interface{}) error {
if value == nil {
ns.AuditLogAction, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AuditLogAction.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAuditLogAction) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.AuditLogAction), nil
}
type DifficultyGrowth string
const (
DifficultyGrowthConstant DifficultyGrowth = "constant"
DifficultyGrowthSlow DifficultyGrowth = "slow"
DifficultyGrowthMedium DifficultyGrowth = "medium"
DifficultyGrowthFast DifficultyGrowth = "fast"
)
func (e *DifficultyGrowth) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = DifficultyGrowth(s)
case string:
*e = DifficultyGrowth(s)
default:
return fmt.Errorf("unsupported scan type for DifficultyGrowth: %T", src)
}
return nil
}
type NullDifficultyGrowth struct {
DifficultyGrowth DifficultyGrowth `json:"backend_difficulty_growth"`
Valid bool `json:"valid"` // Valid is true if DifficultyGrowth is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullDifficultyGrowth) Scan(value interface{}) error {
if value == nil {
ns.DifficultyGrowth, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.DifficultyGrowth.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullDifficultyGrowth) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.DifficultyGrowth), nil
}
type SubscriptionSource string
const (
SubscriptionSourceExternal SubscriptionSource = "external"
SubscriptionSourceInternal SubscriptionSource = "internal"
)
func (e *SubscriptionSource) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = SubscriptionSource(s)
case string:
*e = SubscriptionSource(s)
default:
return fmt.Errorf("unsupported scan type for SubscriptionSource: %T", src)
}
return nil
}
type NullSubscriptionSource struct {
SubscriptionSource SubscriptionSource `json:"backend_subscription_source"`
Valid bool `json:"valid"` // Valid is true if SubscriptionSource is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullSubscriptionSource) Scan(value interface{}) error {
if value == nil {
ns.SubscriptionSource, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.SubscriptionSource.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullSubscriptionSource) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.SubscriptionSource), nil
}
type APIKey struct {
ID int32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
ExternalID pgtype.UUID `db:"external_id" json:"external_id"`
UserID pgtype.Int4 `db:"user_id" json:"user_id"`
Enabled pgtype.Bool `db:"enabled" json:"enabled"`
RequestsPerSecond float64 `db:"requests_per_second" json:"requests_per_second"`
RequestsBurst int32 `db:"requests_burst" json:"requests_burst"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
ExpiresAt pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
Notes pgtype.Text `db:"notes" json:"notes"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
Period time.Duration `db:"period" json:"period"`
}
type AuditLog struct {
ID int64 `db:"id" json:"id"`
UserID pgtype.Int4 `db:"user_id" json:"user_id"`
Action AuditLogAction `db:"action" json:"action"`
EntityID pgtype.Int8 `db:"entity_id" json:"entity_id"`
EntityTable string `db:"entity_table" json:"entity_table"`
SessionID string `db:"session_id" json:"session_id"`
OldValue []byte `db:"old_value" json:"old_value"`
NewValue []byte `db:"new_value" json:"new_value"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
}
type Cache struct {
ID int32 `db:"id" json:"id"`
Key string `db:"key" json:"key"`
Value []byte `db:"value" json:"value"`
ExpiresAt pgtype.Timestamp `db:"expires_at" json:"expires_at"`
}
type DeletedRecord struct {
ID pgtype.UUID `db:"id" json:"id"`
Data []byte `db:"data" json:"data"`
DeletedAt pgtype.Timestamptz `db:"deleted_at" json:"deleted_at"`
TableName string `db:"table_name" json:"table_name"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}
type Lock struct {
Name string `db:"name" json:"name"`
Data []byte `db:"data" json:"data"`
ExpiresAt pgtype.Timestamptz `db:"expires_at" json:"expires_at"`
}
type NotificationTemplate struct {
ID int32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
ExternalID string `db:"external_id" json:"external_id"`
ContentHtml string `db:"content_html" json:"content_html"`
ContentText string `db:"content_text" json:"content_text"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}
type Organization struct {
ID int32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
UserID pgtype.Int4 `db:"user_id" json:"user_id"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
DeletedAt pgtype.Timestamptz `db:"deleted_at" json:"deleted_at"`
}
type OrganizationUser struct {
OrgID int32 `db:"org_id" json:"org_id"`
UserID int32 `db:"user_id" json:"user_id"`
Level AccessLevel `db:"level" json:"level"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
}
type Property struct {
ID int32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
ExternalID pgtype.UUID `db:"external_id" json:"external_id"`
OrgID pgtype.Int4 `db:"org_id" json:"org_id"`
CreatorID pgtype.Int4 `db:"creator_id" json:"creator_id"`
OrgOwnerID pgtype.Int4 `db:"org_owner_id" json:"org_owner_id"`
Domain string `db:"domain" json:"domain"`
Level pgtype.Int2 `db:"level" json:"level"`
Salt []byte `db:"salt" json:"salt"`
Growth DifficultyGrowth `db:"growth" json:"growth"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
DeletedAt pgtype.Timestamptz `db:"deleted_at" json:"deleted_at"`
ValidityInterval time.Duration `db:"validity_interval" json:"validity_interval"`
AllowSubdomains bool `db:"allow_subdomains" json:"allow_subdomains"`
AllowLocalhost bool `db:"allow_localhost" json:"allow_localhost"`
MaxReplayCount int32 `db:"max_replay_count" json:"max_replay_count"`
}
type Subscription struct {
ID int32 `db:"id" json:"id"`
ExternalProductID string `db:"external_product_id" json:"external_product_id"`
ExternalPriceID string `db:"external_price_id" json:"external_price_id"`
ExternalSubscriptionID pgtype.Text `db:"external_subscription_id" json:"external_subscription_id"`
ExternalCustomerID pgtype.Text `db:"external_customer_id" json:"external_customer_id"`
Status string `db:"status" json:"status"`
Source SubscriptionSource `db:"source" json:"source"`
TrialEndsAt pgtype.Timestamptz `db:"trial_ends_at" json:"trial_ends_at"`
NextBilledAt pgtype.Timestamptz `db:"next_billed_at" json:"next_billed_at"`
CancelFrom pgtype.Timestamptz `db:"cancel_from" json:"cancel_from"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
ExternalEmail pgtype.Text `db:"external_email" json:"external_email"`
}
type SystemNotification struct {
ID int32 `db:"id" json:"id"`
Message string `db:"message" json:"message"`
StartDate pgtype.Timestamptz `db:"start_date" json:"start_date"`
EndDate pgtype.Timestamptz `db:"end_date" json:"end_date"`
UserID pgtype.Int4 `db:"user_id" json:"user_id"`
IsActive pgtype.Bool `db:"is_active" json:"is_active"`
}
type User struct {
ID int32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"`
SubscriptionID pgtype.Int4 `db:"subscription_id" json:"subscription_id"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
DeletedAt pgtype.Timestamptz `db:"deleted_at" json:"deleted_at"`
}
type UserNotification struct {
ID int32 `db:"id" json:"id"`
UserID pgtype.Int4 `db:"user_id" json:"user_id"`
TemplateID pgtype.Text `db:"template_id" json:"template_id"`
Payload []byte `db:"payload" json:"payload"`
Subject string `db:"subject" json:"subject"`
ReferenceID string `db:"reference_id" json:"reference_id"`
ProcessingAttempts int32 `db:"processing_attempts" json:"processing_attempts"`
Persistent bool `db:"persistent" json:"persistent"`
RequiresSubscription pgtype.Bool `db:"requires_subscription" json:"requires_subscription"`
CreatedAt pgtype.Timestamptz `db:"created_at" json:"created_at"`
UpdatedAt pgtype.Timestamptz `db:"updated_at" json:"updated_at"`
ScheduledAt pgtype.Timestamptz `db:"scheduled_at" json:"scheduled_at"`
ProcessedAt pgtype.Timestamptz `db:"processed_at" json:"processed_at"`
}