model

package
v1.6.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyArray

type DependencyArray []ModVersionDependency

func (*DependencyArray) Scan

func (a *DependencyArray) Scan(value any) error

func (DependencyArray) Value

func (a DependencyArray) Value() (driver.Value, error)

type DependencyType

type DependencyType string
const (
	DependencyTypeRequired DependencyType = "required"
	DependencyTypeOptional DependencyType = "optional"
	DependencyTypeConflict DependencyType = "conflict"
	DependencyTypeEmbedded DependencyType = "embedded"
)

type Features added in v1.6.0

type Features map[string]any

func (*Features) Scan added in v1.6.0

func (f *Features) Scan(value any) error

func (Features) Value added in v1.6.0

func (f Features) Value() (driver.Value, error)

type FileType

type FileType string
const (
	FileTypeArchive   FileType = "archive"
	FileTypePluginDll FileType = "plugin_dll"
	FileTypeBinary    FileType = "binary"
)

type ModDetails

type ModDetails struct {
	ID           string  `gorm:"primaryKey" json:"id"`
	Name         string  `gorm:"not null" json:"name"`
	Description  string  `gorm:"not null" json:"description"`
	Author       string  `gorm:"not null" json:"author"`
	ThumbnailURI *string `gorm:"default:null" json:"-"`

	LatestVersionID       *string `gorm:"index;default:null;" json:"-"`
	LatestVersionExternal string  `gorm:"-" json:"latest_version"`

	Versions []ModVersionDetails `gorm:"foreignKey:ModID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
	Files    []ModVersionFile    `gorm:"foreignKey:ModID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`

	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}

type ModVersionDependency

type ModVersionDependency struct {
	ModID          string         `json:"mod_id"`
	VersionID      string         `json:"version_id"`
	DependencyType DependencyType `json:"dependency_type"` // "required" or "optional"
}

type ModVersionDetails

type ModVersionDetails struct {
	ID        string `gorm:"primaryKey" json:"-"`
	VersionID string `gorm:"index:idx_mod_version_details" json:"version_id"`
	ModID     string `gorm:"index:idx_mod_version_details" json:"mod_id"`

	Files        []ModVersionFile `gorm:"foreignKey:VersionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"files,omitempty"`
	Dependencies DependencyArray  `gorm:"type:json" json:"dependencies,omitempty"`
	Features     Features         `gorm:"type:json" json:"features,omitempty"`

	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}

type ModVersionFile

type ModVersionFile struct {
	ID        string  `gorm:"primaryKey" json:"id"`
	ModID     *string `gorm:"index:idx_mod_version_file;not null" json:"-"`
	VersionID *string `gorm:"index:idx_mod_version_file;not null" json:"-"`

	Filename    string   `gorm:"not null" json:"filename"`
	ContentType FileType `gorm:"not null" json:"content_type"`
	Size        int64    `gorm:"not null" json:"size"`

	ExtractPath    *string        `gorm:"default:null" json:"extract_path,omitempty"`
	TargetPlatform TargetPlatform `gorm:"not null;default:'any'" json:"target_platform"`

	Hashes    StringMap   `gorm:"type:json" json:"hashes"`
	Downloads StringArray `gorm:"type:json" json:"downloads"`

	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}

type StringArray

type StringArray []string

func (*StringArray) Scan

func (a *StringArray) Scan(value any) error

func (StringArray) Value

func (a StringArray) Value() (driver.Value, error)

type StringMap

type StringMap map[string]string

func (*StringMap) Scan

func (m *StringMap) Scan(value any) error

func (StringMap) Value

func (m StringMap) Value() (driver.Value, error)

type TargetPlatform

type TargetPlatform string
const (
	TargetPlatformAny     TargetPlatform = "any"
	TargetPlatformX64     TargetPlatform = "x64"
	TargetPlatformX86     TargetPlatform = "x86"
	TargetPlatformAArch64 TargetPlatform = "aarch64"
)

Jump to

Keyboard shortcuts

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