model

package
v0.0.0-...-aec7c72 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GroupModOwnerPerm defines the permission for an owner on group mods.
	GroupModOwnerPerm = OwnerPerm

	// GroupModAdminPerm defines the permission for an admin on group mods.
	GroupModAdminPerm = AdminPerm

	// GroupModUserPerm defines the permission for an user on group mods.
	GroupModUserPerm = UserPerm
)
View Source
const (
	// GroupPackOwnerPerm defines the permission for an owner on group packs.
	GroupPackOwnerPerm = OwnerPerm

	// GroupPackAdminPerm defines the permission for an admin on group packs.
	GroupPackAdminPerm = AdminPerm

	// GroupPackUserPerm defines the permission for an user on group packs.
	GroupPackUserPerm = UserPerm
)
View Source
const (
	// OwnerPerm defines the general permission for an owner.
	OwnerPerm = "owner"

	// AdminPerm defines the general permission for an admin.
	AdminPerm = "admin"

	// UserPerm defines the general permission for an user.
	UserPerm = "user"
)
View Source
const (
	// UserGroupOwnerPerm defines the permission for an owner on user groups.
	UserGroupOwnerPerm = OwnerPerm

	// UserGroupAdminPerm defines the permission for an admin on user groups.
	UserGroupAdminPerm = AdminPerm

	// UserGroupUserPerm defines the permission for an user on user groups.
	UserGroupUserPerm = UserPerm
)
View Source
const (
	// UserModOwnerPerm defines the permission for an owner on user mods.
	UserModOwnerPerm = OwnerPerm

	// UserModAdminPerm defines the permission for an admin on user mods.
	UserModAdminPerm = AdminPerm

	// UserModUserPerm defines the permission for an user on user mods.
	UserModUserPerm = UserPerm
)
View Source
const (
	// UserPackOwnerPerm defines the permission for an owner on user packs.
	UserPackOwnerPerm = OwnerPerm

	// UserPackAdminPerm defines the permission for an admin on user packs.
	UserPackAdminPerm = AdminPerm

	// UserPackUserPerm defines the permission for an user on user packs.
	UserPackUserPerm = UserPerm
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	bun.BaseModel `bun:"table:builds"`

	ID          string          `bun:",pk,type:varchar(20)"`
	PackID      string          `bun:"type:varchar(20)"`
	Pack        *Pack           `bun:"rel:belongs-to,join:pack_id=id"`
	Name        string          `bun:"type:varchar(255)"`
	MinecraftID *string         `bun:"type:varchar(20)"`
	Minecraft   *Minecraft      `bun:"rel:belongs-to,join:minecraft_id=id"`
	ForgeID     *string         `bun:"type:varchar(20)"`
	Forge       *Forge          `bun:"rel:belongs-to,join:forge_id=id"`
	NeoforgeID  *string         `bun:"type:varchar(20)"`
	Neoforge    *Neoforge       `bun:"rel:belongs-to,join:neoforge_id=id"`
	QuiltID     *string         `bun:"type:varchar(20)"`
	Quilt       *Quilt          `bun:"rel:belongs-to,join:quilt_id=id"`
	FabricID    *string         `bun:"type:varchar(20)"`
	Fabric      *Fabric         `bun:"rel:belongs-to,join:fabric_id=id"`
	Java        string          `bun:"type:varchar(255)"`
	Memory      string          `bun:"type:varchar(255)"`
	Latest      bool            `bun:"default:false"`
	Recommended bool            `bun:"default:false"`
	Public      bool            `bun:"default:true"`
	CreatedAt   time.Time       `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time       `bun:",nullzero,notnull,default:current_timestamp"`
	Versions    []*BuildVersion `bun:"rel:has-many,join:id=build_id"`
}

Build defines the model for builds table.

func (*Build) BeforeAppendModel

func (m *Build) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type BuildParams

type BuildParams struct {
	ListParams

	PackID  string
	BuildID string
}

BuildParams defines parameters for builds.

type BuildVersion

type BuildVersion struct {
	bun.BaseModel `bun:"table:build_versions"`

	BuildID   string    `bun:",pk,type:varchar(20)"`
	Build     *Build    `bun:"rel:belongs-to,join:build_id=id"`
	VersionID string    `bun:",pk,type:varchar(20)"`
	Version   *Version  `bun:"rel:belongs-to,join:version_id=id"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

BuildVersion defines the model for build_versions table.

func (*BuildVersion) BeforeAppendModel

func (m *BuildVersion) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type BuildVersionParams

type BuildVersionParams struct {
	ListParams

	PackID    string
	BuildID   string
	ModID     string
	VersionID string
	Perm      string
}

BuildVersionParams defines parameters for build versions.

type Fabric

type Fabric struct {
	bun.BaseModel `bun:"table:fabrics"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Name      string    `bun:",unique,type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build  `bun:"rel:has-many,join:id=fabric_id"`
}

Fabric defines the model for fabrics table.

func (*Fabric) BeforeAppendModel

func (m *Fabric) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type FabricBuildParams

type FabricBuildParams struct {
	ListParams

	FabricID string
	PackID   string
	BuildID  string
}

FabricBuildParams defines parameters for fabric builds.

type Forge

type Forge struct {
	bun.BaseModel `bun:"table:forges"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Name      string    `bun:",unique,type:varchar(64)"`
	Minecraft string    `bun:"type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build  `bun:"rel:has-many,join:id=forge_id"`
}

Forge defines the model for forges table.

func (*Forge) BeforeAppendModel

func (m *Forge) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type ForgeBuildParams

type ForgeBuildParams struct {
	ListParams

	ForgeID string
	PackID  string
	BuildID string
}

ForgeBuildParams defines parameters for forge builds.

type Group

type Group struct {
	bun.BaseModel `bun:"table:groups"`

	ID        string       `bun:",pk,type:varchar(20)"`
	Scim      string       `bun:"type:varchar(255)"`
	Slug      string       `bun:",unique,type:varchar(255)"`
	Name      string       `bun:"type:varchar(255)"`
	CreatedAt time.Time    `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time    `bun:",nullzero,notnull,default:current_timestamp"`
	Users     []*UserGroup `bun:"rel:has-many,join:id=group_id"`
	Mods      []*GroupMod  `bun:"rel:has-many,join:id=group_id"`
	Packs     []*GroupPack `bun:"rel:has-many,join:id=group_id"`
}

Group defines the model for groups table.

func (*Group) BeforeAppendModel

func (m *Group) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type GroupMod

type GroupMod struct {
	GroupID   string
	Group     *Group
	ModID     string
	Mod       *Mod
	Perm      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

GroupMod defines the assignment of a group to a mod, backed by an OpenFGA relationship tuple rather than a database table.

type GroupModParams

type GroupModParams struct {
	ListParams

	GroupID string
	ModID   string
	Perm    string
}

GroupModParams defines parameters for group mods.

type GroupPack

type GroupPack struct {
	GroupID   string
	Group     *Group
	PackID    string
	Pack      *Pack
	Perm      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

GroupPack defines the assignment of a group to a pack, backed by an OpenFGA relationship tuple rather than a database table.

type GroupPackParams

type GroupPackParams struct {
	ListParams

	GroupID string
	PackID  string
	Perm    string
}

GroupPackParams defines parameters for group packs.

type ListParams

type ListParams struct {
	Search string
	Sort   string
	Order  string
	Limit  int64
	Offset int64
}

ListParams defines optional list attributes.

type Minecraft

type Minecraft struct {
	bun.BaseModel `bun:"table:minecrafts"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Name      string    `bun:",unique,type:varchar(64)"`
	Type      string    `bun:"type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build  `bun:"rel:has-many,join:id=minecraft_id"`
}

Minecraft defines the model for minecrafts table.

func (*Minecraft) BeforeAppendModel

func (m *Minecraft) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type MinecraftBuildParams

type MinecraftBuildParams struct {
	ListParams

	MinecraftID string
	PackID      string
	BuildID     string
}

MinecraftBuildParams defines parameters for minecraft builds.

type Mod

type Mod struct {
	bun.BaseModel `bun:"table:mods"`

	ID          string     `bun:",pk,type:varchar(20)"`
	Slug        string     `bun:",unique,type:varchar(255)"`
	Name        string     `bun:",unique,type:varchar(255)"`
	Avatar      *ModAvatar `bun:"rel:has-one,join:id=mod_id"`
	Side        string     `bun:"type:varchar(64)"`
	Description string     `bun:"type:text"`
	Author      string     `bun:"type:varchar(255)"`
	Website     string     `bun:"type:varchar(255)"`
	Donate      string     `bun:"type:varchar(255)"`
	Public      bool       `bun:"default:true"`
	CreatedAt   time.Time  `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time  `bun:",nullzero,notnull,default:current_timestamp"`
	Versions    []*Version `bun:"rel:has-many,join:id=mod_id"`
}

Mod defines the model for mods table.

func (*Mod) BeforeAppendModel

func (m *Mod) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type ModAvatar

type ModAvatar struct {
	bun.BaseModel `bun:"table:mod_avatars"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Mod       *Mod      `bun:"rel:belongs-to,join:mod_id=id"`
	ModID     string    `bun:"type:varchar(20)"`
	Slug      string    `bun:"type:varchar(255)"`
	URL       string    `bun:"-"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

ModAvatar defines the model for mod_avatars table.

func (*ModAvatar) BeforeAppendModel

func (m *ModAvatar) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type Neoforge

type Neoforge struct {
	bun.BaseModel `bun:"table:neoforges"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Name      string    `bun:",unique,type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build  `bun:"rel:has-many,join:id=neoforge_id"`
}

Neoforge defines the model for neoforges table.

func (*Neoforge) BeforeAppendModel

func (m *Neoforge) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type NeoforgeBuildParams

type NeoforgeBuildParams struct {
	ListParams

	NeoforgeID string
	PackID     string
	BuildID    string
}

NeoforgeBuildParams defines parameters for neoforge builds.

type Pack

type Pack struct {
	bun.BaseModel `bun:"table:packs"`

	ID        string      `bun:",pk,type:varchar(20)"`
	Slug      string      `bun:",unique,type:varchar(255)"`
	Name      string      `bun:",unique,type:varchar(255)"`
	Avatar    *PackAvatar `bun:"rel:has-one,join:id=pack_id"`
	Website   string      `bun:"type:varchar(255)"`
	Public    bool        `bun:"default:true"`
	CreatedAt time.Time   `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time   `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build    `bun:"rel:has-many,join:id=pack_id"`
}

Pack defines the model for packs table.

func (*Pack) BeforeAppendModel

func (m *Pack) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type PackAvatar

type PackAvatar struct {
	bun.BaseModel `bun:"table:pack_avatars"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Pack      *Pack     `bun:"rel:belongs-to,join:pack_id=id"`
	PackID    string    `bun:"type:varchar(20)"`
	Slug      string    `bun:"type:varchar(255)"`
	URL       string    `bun:"-"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

PackAvatar defines the model for pack_avatars table.

func (*PackAvatar) BeforeAppendModel

func (m *PackAvatar) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type Quilt

type Quilt struct {
	bun.BaseModel `bun:"table:quilts"`

	ID        string    `bun:",pk,type:varchar(20)"`
	Name      string    `bun:",unique,type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Builds    []*Build  `bun:"rel:has-many,join:id=quilt_id"`
}

Quilt defines the model for quilts table.

func (*Quilt) BeforeAppendModel

func (m *Quilt) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type QuiltBuildParams

type QuiltBuildParams struct {
	ListParams

	QuiltID string
	PackID  string
	BuildID string
}

QuiltBuildParams defines parameters for quilt builds.

type User

type User struct {
	bun.BaseModel `bun:"table:users"`

	ID        string      `bun:",pk,type:varchar(20)"`
	Scim      string      `bun:"type:varchar(255)"`
	Username  string      `bun:",unique,type:varchar(255)"`
	Password  string      `bun:"-"`
	Hashword  string      `bun:"type:varchar(255)"`
	Email     string      `bun:"type:varchar(255)"`
	Fullname  string      `bun:"type:varchar(255)"`
	Profile   string      `bun:"-"`
	Active    bool        `bun:"default:false"`
	Admin     bool        `bun:"default:false"`
	CreatedAt time.Time   `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time   `bun:",nullzero,notnull,default:current_timestamp"`
	Auths     []*UserAuth `bun:"rel:has-many,join:id=user_id"`

	// Groups, Mods and Packs hold the user's effective direct assignments,
	// populated from OpenFGA tuples rather than loaded as a bun relation.
	Groups []*UserGroup `bun:"-"`
	Mods   []*UserMod   `bun:"-"`
	Packs  []*UserPack  `bun:"-"`
}

User defines the model for users table.

func (*User) BeforeAppendModel

func (m *User) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type UserAuth

type UserAuth struct {
	bun.BaseModel `bun:"table:user_auths"`

	ID        string    `bun:",pk,type:varchar(20)"`
	UserID    string    `bun:"type:varchar(20)"`
	User      *User     `bun:"rel:belongs-to,join:user_id=id"`
	Provider  string    `bun:"type:varchar(255)"`
	Ref       string    `bun:"type:varchar(255)"`
	Login     string    `bun:"type:varchar(255)"`
	Email     string    `bun:"type:varchar(255)"`
	Name      string    `bun:"type:varchar(255)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

UserAuth defines the model for user_auths table.

func (*UserAuth) BeforeAppendModel

func (m *UserAuth) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type UserGroup

type UserGroup struct {
	UserID    string
	User      *User
	GroupID   string
	Group     *Group
	Perm      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

UserGroup defines the membership of a user in a group, backed by an OpenFGA relationship tuple rather than a database table.

type UserGroupParams

type UserGroupParams struct {
	ListParams

	UserID  string
	GroupID string
	Perm    string
}

UserGroupParams defines parameters for user groups.

type UserMod

type UserMod struct {
	UserID    string
	User      *User
	ModID     string
	Mod       *Mod
	Perm      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

UserMod defines the assignment of a user to a mod, backed by an OpenFGA relationship tuple rather than a database table.

type UserModParams

type UserModParams struct {
	ListParams

	UserID string
	ModID  string
	Perm   string
}

UserModParams defines parameters for user mods.

type UserPack

type UserPack struct {
	UserID    string
	User      *User
	PackID    string
	Pack      *Pack
	Perm      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

UserPack defines the assignment of a user to a pack, backed by an OpenFGA relationship tuple rather than a database table.

type UserPackParams

type UserPackParams struct {
	ListParams

	UserID string
	PackID string
	Perm   string
}

UserPackParams defines parameters for user packs.

type UserToken

type UserToken struct {
	bun.BaseModel `bun:"table:user_tokens"`

	ID        string        `bun:",pk,type:varchar(20)"`
	UserID    string        `bun:"type:varchar(20)"`
	User      *User         `bun:"rel:belongs-to,join:user_id=id"`
	Kind      UserTokenKind `bun:"type:varchar(128)"`
	Token     string        `bun:",unique,type:varchar(128)"`
	CreatedAt time.Time     `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time     `bun:",nullzero,notnull,default:current_timestamp"`
}

UserToken defines the model for user_tokens table.

func (*UserToken) BeforeAppendModel

func (m *UserToken) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type UserTokenKind

type UserTokenKind string

UserTokenKind is the custom type for kind of tokens.

const (
	// UserTokenKindRedirect defines the kind used for redirects.
	UserTokenKindRedirect UserTokenKind = "redirect"
)

type Version

type Version struct {
	bun.BaseModel `bun:"table:versions"`

	ID         string           `bun:",pk,type:varchar(20)"`
	ModID      string           `bun:"type:varchar(20)"`
	Mod        *Mod             `bun:"rel:belongs-to,join:mod_id=id"`
	Name       string           `bun:",unique,type:varchar(255)"`
	File       *VersionFile     `bun:"rel:has-one,join:id=version_id"`
	FileUpload *dataurl.DataURL `bun:"-"`
	Public     bool             `bun:"default:true"`
	CreatedAt  time.Time        `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt  time.Time        `bun:",nullzero,notnull,default:current_timestamp"`
	Builds     []*BuildVersion  `bun:"rel:has-many,join:id=version_id"`
}

Version defines the model for versions table.

func (*Version) BeforeAppendModel

func (m *Version) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type VersionFile

type VersionFile struct {
	bun.BaseModel `bun:"table:version_files"`

	ID          string    `bun:",pk,type:varchar(20)"`
	Version     *Version  `bun:"rel:belongs-to,join:version_id=id"`
	VersionID   string    `bun:"type:varchar(20)"`
	Slug        string    `bun:"type:varchar(255)"`
	ContentType string    `bun:"type:varchar(255)"`
	MD5         string    `bun:"column:md5,type:varchar(255)"`
	URL         string    `bun:"-"`
	CreatedAt   time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt   time.Time `bun:",nullzero,notnull,default:current_timestamp"`
}

VersionFile defines the model for version_files table.

func (*VersionFile) BeforeAppendModel

func (m *VersionFile) BeforeAppendModel(_ context.Context, query bun.Query) error

BeforeAppendModel implements the bun hook interface.

type VersionParams

type VersionParams struct {
	ListParams

	ModID     string
	VersionID string
}

VersionParams defines parameters for versions.

Jump to

Keyboard shortcuts

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