db

package
v0.0.0-...-aa84830 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ban

type Ban struct {
	ID        int64
	MessageID *discord.MessageID
	UserIDs   []uint64 `db:"user_ids"`
	Reason    string
	Evidence  *string
	CreatedAt time.Time
}

func (Ban) Embed

func (b Ban) Embed(ctx *bcr.Context) discord.Embed

type DB

type DB struct {
	*pgxpool.Pool
}

func New

func New(dsn string) (*DB, error)

func (*DB) AddListing

func (db *DB) AddListing(name, url string, embed bool) (l Listing, err error)

func (*DB) AddListingMessage

func (db *DB) AddListingMessage(listing int64, id discord.MessageID, ch discord.ChannelID) error

func (*DB) AllListings

func (db *DB) AllListings() (l []Listing, err error)

func (*DB) CreateBan

func (db *DB) CreateBan(users []*discord.User, reason string) (b Ban, err error)

func (*DB) IsRepresentative

func (db *DB) IsRepresentative(id uint64) (isRep bool)

func (*DB) Listing

func (db *DB) Listing(id int64) (l Listing, err error)

func (*DB) ListingMessages

func (db *DB) ListingMessages(id int64) (m []ListingMessage, err error)

func (*DB) SetBanMessage

func (db *DB) SetBanMessage(id int64, msg discord.MessageID) error

func (*DB) UpdateEvidence

func (db *DB) UpdateEvidence(id int64, evidence string) (b Ban, err error)

func (*DB) UpdateReason

func (db *DB) UpdateReason(id int64, reason string) (b Ban, err error)

type Listing

type Listing struct {
	ID              int64
	Name            string
	Description     string
	URL             string
	EmbedURL        bool
	Representatives []uint64
}

func (Listing) Message

func (l Listing) Message() string

Message returns the listing formatted for a message.

type ListingMessage

type ListingMessage struct {
	ID        discord.MessageID
	ChannelID discord.ChannelID
	ListingID int64
}

Jump to

Keyboard shortcuts

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