Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.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 DB

type DB interface {
	GuildSettings() GuildSettingsDB
	LikedTracks() LikedTracksDB
	PlayHistory() PlayHistoriesDB
	Tags() TagsDB
	Voters() VotersDB
	Reports() ReportsDB
	Close() error
}

func SetupDatabase

func SetupDatabase(config DatabaseConfig) (DB, error)

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	DBName   string `json:"db_name"`
	SSLMode  string `json:"ssl_mode"`
}

type GuildSettingsDB

type GuildSettingsDB interface {
	CreateIfNotExist(guildID snowflake.ID) error
	Get(guildID snowflake.ID) (GuildSettings, error)
	UpdateModeration(guildID snowflake.ID, webhookID snowflake.ID, webhookToken string) error
	Delete(guildID snowflake.ID) error
}

type LikedTracksDB added in v0.5.0

type LikedTracksDB interface {
	Get(userID snowflake.ID, title string) (LikedTracks, error)
	GetAll(userID snowflake.ID) ([]LikedTracks, error)
	Add(userID snowflake.ID, query string, title string) error
	Delete(userID snowflake.ID, title string) error
	DeleteAll(userID snowflake.ID) error
}

type PlayHistoriesDB

type PlayHistoriesDB interface {
	Get(userID snowflake.ID) ([]PlayHistories, error)
	Add(userID snowflake.ID, query string, title string) error
}

type ReportsDB

type ReportsDB interface {
	Get(id int32) (Reports, error)
	GetCount(userID snowflake.ID, guildID snowflake.ID) (int, error)
	GetAll(userID snowflake.ID, guildID snowflake.ID) ([]Reports, error)
	Create(userID snowflake.ID, guildID snowflake.ID, description string, createdAt time.Time, messageID snowflake.ID, channelID snowflake.ID) (int32, error)
	Confirm(id int32) error
	Delete(id int32) error
	DeleteAll(userID snowflake.ID, guildID snowflake.ID) error
}

type TagsDB

type TagsDB interface {
	Get(guildID snowflake.ID, name string) (Tags, error)
	GetAll(guildID snowflake.ID) ([]Tags, error)
	Create(guildID snowflake.ID, ownerID snowflake.ID, name string, content string) error
	Edit(guildID snowflake.ID, name string, content string) error
	IncrementUses(guildID snowflake.ID, name string) error
	Delete(guildID snowflake.ID, name string) error
}

type VotersDB

type VotersDB interface {
	GetAll(expiresAt time.Time) ([]Voters, error)
	Add(userID snowflake.ID, duration time.Duration) error
	Delete(userID snowflake.ID) error
}

Jump to

Keyboard shortcuts

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