models

package
v0.0.0-...-3834a52 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package models contains the structs for the various things

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIErrorJSON

func APIErrorJSON(e string) []byte

APIErrorJSON takes an error string, marshals it to JSON and returns it in a solder compatible format

Types

type APIError

type APIError struct {
	Message string ` json:"error" `
}

APIError is the representation of an error sent by solder as a struct An Example of an error:

{"error":"Mod does not exist"}

type APIInfo

type APIInfo struct {
	Name    string ` json:"api" `
	Version string ` json:"version" `
	Stream  string ` json:"stream" `
}

APIInfo is the information sent to the technic client to verify that we're definitely talking to a solder server. In reality the client isn't very picky.

type APIKey

type APIKey struct {
	DBStructTemplate
	Name   string
	APIKey string ` gorm:"column:api_key" `
}

APIKey is the struct that represents an API key for the technic platform

func (APIKey) TableName

func (APIKey) TableName() string

TableName is the tabler interface for GORM to specify a custom name for a table

type APIKeyVerifyResponse

type APIKeyVerifyResponse struct {
	Valid     string    `json:"valid"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

APIKeyVerifyResponse is the response if an api key successfully verifies

type BuildModversion

type BuildModversion struct {
	DBStructTemplate
	ModVersionID uint ` gorm:"column:modversion_id" `
	BuildID      uint
}

BuildModversion is the DB map between modversions and modpack builds

func (BuildModversion) TableName

func (BuildModversion) TableName() string

TableName is the tabler interface function for GORM

type DBStructTemplate

type DBStructTemplate struct {
	ID        int32     ` gorm:"primaryKey" json:"-" `
	CreatedAt time.Time ` json:"-" `
	UpdatedAt time.Time ` json:"-" `
}

DBStructTemplate most all the tables in the database have these fields. This is similar to the GORM one but without the deletedAt field.

type DBStructTemplateID

type DBStructTemplateID struct {
	ID        int32     ` gorm:"primaryKey" json:"id" `
	CreatedAt time.Time ` json:"-" `
	UpdatedAt time.Time ` json:"-" `
}

DBStructTemplateID is the same as DBStructTemplate however the ID is included in the JSON representation

type ListModpack

type ListModpack struct {
	Name        string ` json:"name" gorm:"column:slug" `
	DisplayName string ` json:"display_name" gorm:"column:name" `
}

ListModpack is a stripped down modpack to save bandwidth while querying.

type Mod

type Mod struct {
	DBStructTemplate
	Name        string   ` json:"name" `
	Description string   ` json:"description" `
	Author      string   ` json:"author" `
	Link        string   ` json:"link" `
	Versions    []string ` json:"versions" gorm:"-"`
	DisplayName string   ` json:"pretty_name" gorm:"column:pretty_name" `
}

A Mod is a singular mod roughly compliant with what comes out the database and what gets turned into JSON

type ModList

type ModList struct {
	Mods map[string]string `json:"mods" `
}

ModList is for the most part a bodge to get the JSON document correct for /api/mod

type ModVersion

type ModVersion struct {
	DBStructTemplate
	ModID    int32  ` json:"-" `
	Version  string ` json:"-" `
	MD5      string ` json:"md5" `
	Filesize int32  ` json:"filesize" `
	URL      string ` json:"url" gorm:"url"`
}

A ModVersion is a version of a mod with all the things required for JSON

func (ModVersion) TableName

func (ModVersion) TableName() string

TableName is the tabler interface function for GORM

type Modpack

type Modpack struct {
	DBStructTemplate
	Name          string   ` json:"name" gorm:"column:slug" `
	DisplayName   string   ` json:"display_name" gorm:"column:name" `
	URL           string   ` json:"url" `
	Icon          bool     ` json:"-" `
	IconURL       string   ` json:"icon" `
	IconMD5       string   ` json:"icon_md5" `
	LogoURL       string   ` json:"logo" `
	LogoMD5       string   ` json:"logo_md5" `
	Background    bool     ` json:"-" `
	BackgroundURL string   ` json:"background" `
	BackgroundMD5 string   ` json:"background_md5" `
	Recommended   string   ` json:"recommended" `
	Latest        string   ` json:"latest" `
	Builds        []string ` json:"builds" gorm:"-" `
	Order         int32    ` json:"-" `
	Hidden        bool     ` json:"-" `
	Private       bool     ` json:"-" `
}

Modpack is a struct representation of a technic modpack

type ModpackBuild

type ModpackBuild struct {
	DBStructTemplateID
	ModpackID    int32        ` json:"-" `
	Version      string       ` json:"-" `
	Minecraft    string       ` json:"minecraft" `
	MinecraftMD5 string       ` json:"minecraft_md5"`
	Java         string       ` json:"java" gorm:"column:min_java" `
	Memory       int32        ` json:"memory" gorm:"column:min_memory" `
	Forge        null.String  ` json:"forge" `
	Mods         []ModpackMod ` json:"mods" gorm:"-" `
	IsPublished  bool         ` json:"-"`
	Private      bool         ` json:"-" `
}

ModpackBuild is a struct representation of a modpack build.

func (ModpackBuild) TableName

func (ModpackBuild) TableName() string

TableName is the Tabler interface that provides a table name for GORM

type ModpackList

type ModpackList struct {
	Modpacks  map[string]string `json:"modpacks" `
	MirrorURL string            `json:"mirror_url"`
}

ModpackList is a list of slug/name pairs and the mirror URL, don't know why it's done like this but eh what can you do

type ModpackMod

type ModpackMod struct {
	ID       int32  `json:"id"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	MD5      string `json:"md5"`
	Filesize int32  `json:"filesize"`
	URL      string `json:"url"`
}

ModpackMod is the mod version type returned by /api/modpack/<slug>/<build>

func ModpackModFormat

func ModpackModFormat(mod *Mod, modVersion *ModVersion) ModpackMod

ModpackModFormat converts a mod and a modVersion into a modpack build compatible doodad

type User

type User struct {
	ID       uint32
	Username string
	Email    string
	Password string
}

User the user struct is a user for solder. enough said

Jump to

Keyboard shortcuts

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