Help us shape the future of Go! Take the 2026 Go Developer Survey

database

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DownloadStatusPending     = "pending"
	DownloadStatusDownloading = "downloading"
	DownloadStatusCompleted   = "completed"
	DownloadStatusFailed      = "failed"
	DownloadStatusCancelled   = "cancelled"
)
View Source
const (
	SettingPassphraseHash = "passphrase_hash"
	SettingPassphraseSalt = "passphrase_salt"
	SettingEncryptionSalt = "encryption_salt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*gorm.DB
}

func New

func New(cfg *config.Config) (*DB, error)

func (*DB) GetSetting

func (db *DB) GetSetting(key string) (string, error)

func (*DB) HasSetting

func (db *DB) HasSetting(key string) bool

func (*DB) SetSetting

func (db *DB) SetSetting(key, value string) error

type Delivery

type Delivery struct {
	ID          string `gorm:"primaryKey"`
	ProductID   string `gorm:"index"`
	ExternalID  string
	Name        string
	PublishedAt *time.Time
	ExpiresAt   *time.Time
	CreatedAt   time.Time

	Product Product `gorm:"foreignKey:ProductID"`
	Files   []File  `gorm:"foreignKey:DeliveryID"`
}

type DownloadEntry

type DownloadEntry struct {
	ID            uint   `gorm:"primaryKey"`
	FileID        string `gorm:"index"`
	Status        string
	Progress      int64
	TotalBytes    int64
	LocalPath     string
	LocalChecksum string
	ErrorMessage  string
	StartedAt     *time.Time
	CompletedAt   *time.Time
	CreatedAt     time.Time

	File File `gorm:"foreignKey:FileID"`
}

type File

type File struct {
	ID                string `gorm:"primaryKey"`
	DeliveryID        string `gorm:"index"`
	ProductID         string `gorm:"index"`
	SourceID          string `gorm:"index"`
	ExternalID        string
	FileName          string
	FileSize          int64
	ExpectedChecksum  string
	ChecksumAlgorithm string
	DownloadURI       string
	ReleasedAt        *time.Time
	Skipped           bool `gorm:"default:false"`
	CreatedAt         time.Time
	UpdatedAt         time.Time

	Delivery        Delivery        `gorm:"foreignKey:DeliveryID"`
	DownloadEntries []DownloadEntry `gorm:"foreignKey:FileID"`
}

type Product

type Product struct {
	ID               string `gorm:"primaryKey"`
	SourceID         string `gorm:"index"`
	ExternalID       string
	Name             string
	Description      string
	AutoDownload     bool `gorm:"default:false"`
	CheckWindowStart string
	CheckWindowEnd   string
	LastCheckedAt    *time.Time
	CreatedAt        time.Time
	UpdatedAt        time.Time

	Source     Source     `gorm:"foreignKey:SourceID"`
	Deliveries []Delivery `gorm:"foreignKey:ProductID"`
}

type Setting

type Setting struct {
	Key   string `gorm:"primaryKey"`
	Value string
}

type Source

type Source struct {
	ID             string `gorm:"primaryKey"`
	Name           string
	Enabled        bool `gorm:"default:false"`
	CredentialsEnc []byte
	LastSyncAt     *time.Time
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type Webhook

type Webhook struct {
	ID        uint `gorm:"primaryKey"`
	Name      string
	URL       string
	Events    string
	Headers   []byte
	Enabled   bool `gorm:"default:true"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

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