db

package
v0.0.0-...-7404a93 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NicknameUpdate

type NicknameUpdate struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index"` //we want to easyily keep track of the last one
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	DiscordID string         `gorm:"index"`
	Nickname  string
}

NicknameUpdate stores ever nickname change in the server

type NitroUserChannel

type NitroUserChannel struct {
	gorm.Model
	User
	Name      string
	ChannelID string
	Active    bool
	LastUsed  *time.Time
	Enabled   bool
}

NitroUserChannel represents a voice channel registered to a nitro booster

type User

type User struct {
	DiscordID string `gorm:"uniqueIndex"`
}

User holds a DiscordID to be embeded in other models

type UserActivity

type UserActivity struct {
	gorm.Model
	CommandCount int
	MessageCount int
	VoiceCount   int
	User
	LastChannelVoiceAppearence *time.Time
	LastChannelTextAppearence  *time.Time
}

UserActivity stores any per-user statistics

type WadlDB

type WadlDB struct {
	*gorm.DB
}

WadlDB holds the gorm.DB{} database connection

var (
	//Instance is the current database connection
	Instance *WadlDB
)

func BuildWadlDB

func BuildWadlDB(config *cfg.Config) WadlDB

BuildWadlDB connects to the database and returns a WadlDB{} holding the database connection

func (*WadlDB) Migrate

func (wdb *WadlDB) Migrate()

Migrate calls gorm.DB.AutoMigrate() on all dbs

Jump to

Keyboard shortcuts

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