database

package
v0.0.0-...-1318fff Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Close() error

	SetUpdatedAt(ctx context.Context, post discord.ChannelID, t time.Time) error
	UpdatedAt(ctx context.Context, post discord.ChannelID) (time.Time, error)
	UpdateMessages(ctx context.Context, post discord.ChannelID, msgs []discord.Message) error
	InsertMessage(ctx context.Context, msg discord.Message) error
	UpdateMessage(ctx context.Context, msg discord.Message) error
	DeleteMessage(ctx context.Context, msg discord.MessageID) error
	MessagesAfter(ctx context.Context, post discord.ChannelID, after discord.MessageID, limit uint) ([]discord.Message, bool, error)
	MessagesBefore(ctx context.Context, post discord.ChannelID, before discord.MessageID, limit uint) ([]discord.Message, bool, error)
}

func OpenPostgres

func OpenPostgres(source string) (Database, error)

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

func (*Postgres) Close

func (db *Postgres) Close() error

func (*Postgres) DeleteMessage

func (db *Postgres) DeleteMessage(ctx context.Context, msg discord.MessageID) error

func (*Postgres) InsertMessage

func (db *Postgres) InsertMessage(ctx context.Context, msg discord.Message) error

func (*Postgres) MessagesAfter

func (db *Postgres) MessagesAfter(ctx context.Context, ch discord.ChannelID, msg discord.MessageID, limit uint) (msgs []discord.Message, hasbefore bool, err error)

func (*Postgres) MessagesBefore

func (db *Postgres) MessagesBefore(ctx context.Context, ch discord.ChannelID, msg discord.MessageID, limit uint) (msgs []discord.Message, hasafter bool, err error)

func (*Postgres) SetUpdatedAt

func (db *Postgres) SetUpdatedAt(ctx context.Context, post discord.ChannelID, time time.Time) error

func (*Postgres) UpdateMessage

func (db *Postgres) UpdateMessage(ctx context.Context, msg discord.Message) error

func (*Postgres) UpdateMessages

func (db *Postgres) UpdateMessages(ctx context.Context, post discord.ChannelID, msgs []discord.Message) error

func (*Postgres) UpdatedAt

func (db *Postgres) UpdatedAt(ctx context.Context, post discord.ChannelID) (time.Time, error)

Jump to

Keyboard shortcuts

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