database

package
v0.0.0-...-358fae8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 6 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 struct {
	// contains filtered or unexported fields
}

Db represents a connection to the database and provides methods for interacting with it.

func NewDb

func NewDb(c config.Config) (Db, error)

NewDb creates a new Db.

func (Db) DeleteSubscribedChannel

func (d Db) DeleteSubscribedChannel(channelId, guildId string) (changed bool, err error)

func (Db) SubscribedChannels

func (d Db) SubscribedChannels(guildIds []string) ([]SubscribedChannel, error)

SubscribedChannels returns a slice of SubscribedChannels that are exist in the given guild ids.

func (Db) UpdateSubscribedChannel

func (d Db) UpdateSubscribedChannel(channelId, guildId, notificationType, launchMentions string) (changed bool, err error)

UpdateSubscribedChannel sets the notification type and launch mentions for a given channel ID. guildId is required to ensure that the channel exists in that guild.

type SubscribedChannel

type SubscribedChannel struct {
	Id               string         `db:"channel_id"`
	GuildId          string         `db:"guild_id"`
	Name             string         `db:"channel_name"`
	NotificationType string         `db:"notification_type"`
	LaunchMentions   sql.NullString `db:"launch_mentions"`
}

SubscribedChannel represents a subscribed channel from the database.

Jump to

Keyboard shortcuts

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