db

package
v0.0.0-...-4e431d5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func CreateGuild

func CreateGuild(guild Guild) error

CreateGuild creates a new guild.

guild: the guild to be created. error: an error if the creation fails.

func DeleteGuild

func DeleteGuild(guildID string) error

DeleteGuild deletes a guild by its ID.

Parameter: guildID string Return type: error

func DoesGuildExist

func DoesGuildExist(guildID string) (bool, error)

DoesGuildExist checks if the guild with the given ID exists in the database.

guildID string bool, error

func GetAllGuildIDs

func GetAllGuildIDs() ([]string, error)

GetAllGuildIDs retrieves all guild IDs from the database.

No parameters. Returns a slice of strings and an error.

func InitDB

func InitDB(databasePath string) (*gorm.DB, error)

InitDB initializes the database connection.

It takes a database path as a parameter and returns a *gorm.DB and an error.

Types

type Guild

type Guild struct {
	ID   string `gorm:"primaryKey"`
	Name string
}

func GetGuildByID

func GetGuildByID(guildID string) (*Guild, error)

GetGuildByID retrieves a Guild by its ID.

guildID string *Guild, error

Jump to

Keyboard shortcuts

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