Documentation ¶
Index ¶
- type Ability
- type DownloadEvent
- type Featured
- type FollowEvent
- type Game
- type GameVersion
- type Mod
- type ModList
- type ModListItem
- type ModVersion
- type Model
- type Publisher
- type Rating
- type ReferralEvent
- type Role
- func (role *Role) AddAbility(name string) *Ability
- func (role *Role) AddParam(ability string, param string, value string) error
- func (s *Role) AfterFind()
- func (role *Role) GetParams(ability string, param string) []string
- func (role *Role) HasAbility(name string) bool
- func (role *Role) RemoveAbility(name string)
- func (role *Role) RemoveParam(ability string, param string, value string) error
- type SharedAuthor
- type Token
- type User
- func (user *User) AddRole(name string) *Role
- func (s *User) AfterFind()
- func (user *User) Format(admin bool) map[string]interface{}
- func (user *User) GetAbilities() []string
- func (user *User) GetById(id uint) error
- func (user *User) HasRole(name string) bool
- func (user *User) IsAuthenticated() bool
- func (user *User) Login()
- func (user *User) Logout()
- func (user *User) RemoveRole(name string)
- func (user *User) SetPassword(password string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ability ¶
type DownloadEvent ¶
type DownloadEvent struct { Model Mod Mod `json:"-" gorm:"ForeignKey:ModID" spacedock:"lock"` ModID uint `json:"mod" spacedock:"lock"` Version ModVersion `json:"-" gorm:"ForeignKey:VersionID" spacedock:"lock"` VersionID uint `json:"version" spacedock:"lock"` Downloads int `json:"downloads" spacedock:"lock"` }
func NewDownloadEvent ¶
func NewDownloadEvent(mod Mod, version ModVersion) *DownloadEvent
func (*DownloadEvent) AfterFind ¶
func (s *DownloadEvent) AfterFind()
type Featured ¶
type Featured struct { Model Mod Mod `json:"mod" gorm:"ForeignKey:ModID" spacedock:"lock;tomap"` ModID uint `json:"mod_id" spacedock:"lock"` }
func NewFeatured ¶
type FollowEvent ¶
type FollowEvent struct { Model Mod Mod `json:"-" gorm:"ForeignKey:ModID" spacedock:"lock"` ModID uint `json:"mod" spacedock:"lock"` Events int `json:"events" spacedock:"lock"` Delta int `json:"delta" spacedock:"lock"` }
func NewFollowEvent ¶
func NewFollowEvent(mod Mod) *FollowEvent
func (*FollowEvent) AfterFind ¶
func (s *FollowEvent) AfterFind()
type Game ¶
type Game struct { Model Name string `gorm:"size:1024;unique_index;not null" json:"name"` Active bool `json:"active"` Altname string `gorm:"size:1024" json:"altname"` Rating float32 `json:"rating" spacedock:"lock"` Releasedate time.Time `json:"releasedate" spacedock:"lock"` Short string `gorm:"size:1024" json:"short" spacedock:"lock"` Publisher Publisher `json:"-" gorm:"ForeignKey:PublisherID" spacedock:"lock"` PublisherID uint `json:"publisher" spacedock:"lock"` Description string `gorm:"size:100000" json:"description"` ShortDescription string `gorm:"size:1000" json:"short_description"` Mods []Mod `json:"-" spacedock:"lock"` Modlists []ModList `json:"-" spacedock:"lock"` Versions []GameVersion `json:"-" spacedock:"lock"` }
type GameVersion ¶
type GameVersion struct { Model Game Game `json:"-" spacedock:"lock"` GameID uint `json:"game" spacedock:"lock"` FriendlyVersion string `gorm:"size:128;" json:"friendly_version" spacedock:"lock"` Beta bool `json:"beta"` }
func NewGameVersion ¶
func NewGameVersion(friendly_version string, game Game, beta bool) *GameVersion
func (*GameVersion) AfterFind ¶
func (s *GameVersion) AfterFind()
type Mod ¶
type Mod struct { Model User User `json:"-" gorm:"ForeignKey:UserID" spacedock:"lock"` UserID uint `json:"user" spacedock:"lock"` Game Game `json:"-" gorm:"ForeignKey:GameID" spacedock:"lock"` GameID uint `json:"game" spacedock:"lock"` Name string `json:"name" gorm:"size:1024;unique_index;not null"` Description string `json:"description" gorm:"size:100000"` ShortDescription string `json:"short_description" gorm:"size:1000"` Approved bool `json:"approved" spacedock:"lock"` Published bool `json:"published" spacedock:"lock"` License string `json:"license" gorm:"size:512"` DefaultVersion ModVersion `json:"default_version" gorm:"ForeignKey:DefaultVersionID" spacedock:"lock;tomap"` DefaultVersionID uint `json:"default_version_id"` Versions []ModVersion `json:"versions" spacedock:"lock"` DownloadEvents []DownloadEvent `json:"-" spacedock:"lock"` FollowEvents []FollowEvent `json:"-" spacedock:"lock"` ReferralEvents []ReferralEvent `json:"-" spacedock:"lock"` Followers []User `json:"-" gorm:"many2many:mod_followers" spacedock:"lock"` Ratings []Rating `json:"-" spacedock:"lock"` TotalScore float64 `json:"total_score" gorm:"not null" spacedock:"lock"` DownloadCount int64 `json:"download_count" spacedock:"lock"` }
func (*Mod) CalculateScore ¶
func (mod *Mod) CalculateScore()
type ModList ¶
type ModList struct { Model User User `json:"-" gorm:"ForeignKey:UserID" spacedock:"lock"` UserID uint `json:"user" spacedock:"lock"` Game Game `json:"-" gorm:"ForeignKey:GameID" spacedock:"lock"` GameID uint `json:"game" spacedock:"lock"` Description string `gorm:"size:100000"` ShortDescription string `gorm:"size:1000"` Name string `json:"name" gorm:"size:1024;unique_index;not null"` Mods []ModListItem `json:"-" spacedock:"lock"` }
type ModListItem ¶
type ModListItem struct { Model Mod Mod `json:"-" gorm:"ForeignKey:ModID" spacedock:"lock"` ModID uint `json:"mod" spacedock:"lock"` ModList ModList `json:"-" gorm:"ForeignKey:ModListID" spacedock:"lock"` ModListID uint `json:"mod_list" spacedock:"lock"` SortIndex uint `json:"sort_index" spacedock:"lock"` }
func NewModListItem ¶
func NewModListItem(mod Mod, list ModList) *ModListItem
func (*ModListItem) AfterFind ¶
func (s *ModListItem) AfterFind()
type ModVersion ¶
type ModVersion struct { Model ModID uint `json:"mod" spacedock:"lock"` FriendlyVersion string `json:"friendly_version" gorm:"size:64;" spacedock:"lock"` Beta bool `json:"beta"` GameVersion GameVersion `json:"gameversion" gorm:"ForeignKey:GameVersionID" spacedock:"lock;tomap"` GameVersionID uint `json:"gameversion_id" spacedock:"lock"` DownloadPath string `json:"download_path" gorm:"size:512" spacedock:"lock"` Changelog string `json:"changelog" gorm:"size:10000"` SortIndex int `json:"sort_index" spacedock:"lock"` FileSize int64 `json:"file_size" spacedock:"lock"` }
func NewModVersion ¶
func NewModVersion(mod Mod, friendly_version string, gameversion GameVersion, download_path string, beta bool) *ModVersion
func (*ModVersion) AfterFind ¶
func (s *ModVersion) AfterFind()
type Model ¶
type Publisher ¶
type Publisher struct { Model Name string `gorm:"size:1024;unique_index;not null" json:"name"` Description string `gorm:"size:100000" json:"description"` ShortDescription string `gorm:"size:1000" json:"short_description"` Games []Game `json:"-" spacedock:"lock"` }
func NewPublisher ¶
type Rating ¶
type ReferralEvent ¶
type ReferralEvent struct { Model Mod Mod `json:"-" gorm:"ForeignKey:Mod" spacedock:"lock"` ModID uint `json:"mod" spacedock:"lock"` Events int `json:"events" spacedock:"lock"` Host string `json:"host" gorm:"size:128" spacedock:"lock"` }
func NewReferralEvent ¶
func NewReferralEvent(mod Mod, host string) *ReferralEvent
func (*ReferralEvent) AfterFind ¶
func (s *ReferralEvent) AfterFind()
type Role ¶
type Role struct { Model Name string `gorm:"size:128;unique_index;not null" spacedock:"lock"` Params string `gorm:"size:4096" spacedock:"json" spacedock:"lock"` Abilities []Ability `gorm:"many2many:role_abilities" json:"-" spacedock:"lock"` Users []User `gorm:"many2many:role_users" json:"-" spacedock:"lock"` }
func (*Role) AddAbility ¶
func (*Role) HasAbility ¶
func (*Role) RemoveAbility ¶
type SharedAuthor ¶
type SharedAuthor struct {}
func NewSharedAuthor ¶
func NewSharedAuthor(user User, mod Mod) *SharedAuthor
func (*SharedAuthor) AfterFind ¶
func (s *SharedAuthor) AfterFind()
type User ¶
type User struct { Model Username string `gorm:"size:128;unique_index;not null" json:"username"` Email string `gorm:"size:256;unique_index;not null" json:"email"` ShowEmail bool `json:"showEmail"` Public bool `json:"public"` Password string `gorm:"size:128" json:"-" spacedock:"lock"` Description string `gorm:"size:10000" json:"description"` Confirmation string `gorm:"size:128" json:"-" spacedock:"lock"` PasswordReset string `gorm:"size:128" json:"-" spacedock:"lock"` PasswordResetExpiry time.Time `json:"-" spacedock:"lock"` Roles []Role `gorm:"many2many:role_users" json:"-" spacedock:"lock"` Following []Mod `json:"following" gorm:"many2many:mod_followers" spacedock:"lock"` // contains filtered or unexported fields }
func (*User) GetAbilities ¶
func (*User) IsAuthenticated ¶
func (*User) RemoveRole ¶
func (*User) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.