db

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(driver string, dsn []string, debug bool) (*gorm.DB, error)

New initializes a GORM database connection based on the driver and DSN.

Types

type BlockedUser added in v0.15.0

type BlockedUser struct {
	Username  string    `gorm:"primaryKey"`
	Reason    string    `gorm:"column:reason"`
	BlockedAt time.Time `gorm:"autoCreateTime"`
}

BlockedUser represents a user that has been blocked from re-registering. When an account is deleted via the admin API/CLI, its username is added here to prevent the same address from being created again (via /new or JIT).

type Contact

type Contact struct {
	Slug      string `gorm:"primaryKey"`
	URL       string `gorm:"column:url;not null"`
	Name      string
	CreatedAt time.Time `gorm:"autoCreateTime"`
}

Contact represents the contacts table for contact sharing.

type DNSOverride added in v0.14.1

type DNSOverride = EndpointOverride

DNSOverride is a type alias kept for backward compatibility. New code should use EndpointOverride.

type EndpointOverride added in v0.16.0

type EndpointOverride struct {
	LookupKey  string    `gorm:"primaryKey;column:lookup_key"` // Domain or IP to match
	TargetHost string    `gorm:"column:target_host;not null"`  // Destination host/IP to use instead
	Comment    string    `gorm:"column:comment"`               // Optional human-readable note
	CreatedAt  time.Time `gorm:"autoCreateTime"`
	UpdatedAt  time.Time `gorm:"autoUpdateTime"`
}

EndpointOverride represents a local endpoint override entry (formerly "DNS override"). It maps a lookup key (domain name or IP address) to a target host, allowing outbound mail delivery to be redirected without modifying system DNS. For example:

  • LookupKey="nine.testrun.org" TargetHost="1.2.3.4" → route mail for nine.testrun.org to 1.2.3.4
  • LookupKey="1.1.1.1" TargetHost="2.2.2.2" → redirect connections from 1.1.1.1 to 2.2.2.2

func (EndpointOverride) TableName added in v0.16.0

func (EndpointOverride) TableName() string

TableName keeps the original table name for backward compatibility with existing databases that already have a "dns_overrides" table.

type MessageStat added in v0.15.0

type MessageStat struct {
	Name  string `gorm:"primaryKey"`
	Count int64
}

MessageStat stores server-wide message counters. Each row is identified by a stat name (e.g., "sent_messages").

type Quota

type Quota struct {
	Username     string `gorm:"primaryKey"`
	MaxStorage   int64
	CreatedAt    int64
	FirstLoginAt int64
	LastLoginAt  int64
}

Quota represents the quotas table.

type TableEntry

type TableEntry struct {
	Key   string `gorm:"primaryKey"`
	Value string `gorm:"not null"`
}

TableEntry represents a generic key-value entry for sql_table module.

Jump to

Keyboard shortcuts

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