db

package
v0.0.0-...-f388cdf Latest Latest
Warning

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

Go to latest
Published: May 27, 2017 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_DATEZERO             = errors.New("Error, date is zero.")
	ERR_NOTEXIST_MESSAGEROOT = errors.New("Error, ROOT messages bucket does not exist")
	ERR_NOTEXIST_QUERYBUCKET = errors.New("Error, queried bucket does not exist")
	ERR_NONEXIST_MESSAGEBYID = errors.New("Error, the given ID does not exist within the bucket it should inhabit")
	ERR_PARSE_TIMEFROMID     = func(id string, err error) error {
		return errors.New("Error parsing id " + id + "to string:" + err.Error())
	}
	ERR_DECODE_MESSAGE = func(id string, err error) error {
		return errors.New("Error parsing message " + id + "to message struct: " + err.Error())
	}
)

Functions

This section is empty.

Types

type Message

type Message struct {
	M           *discordgo.Message
	Edits       []*MessageEdit
	Deleted     bool
	DeletedWhen time.Time // nil if not caught
}

type MessageEdit

type MessageEdit struct {
	At         time.Time
	NewContent string
}

type PlutoDB

type PlutoDB struct {
	Database *bolt.DB
	Name     string
}

func Open

func Open(name string) (PlutoDB, error)

func (PlutoDB) AddMessage

func (p PlutoDB) AddMessage(m *discordgo.Message)

func (PlutoDB) Close

func (db PlutoDB) Close() error

func (PlutoDB) DecodeData

func (db PlutoDB) DecodeData(data []byte, output interface{}) error

func (PlutoDB) EncodeData

func (db PlutoDB) EncodeData(data interface{}) ([]byte, error)

func (PlutoDB) GetMessage

func (p PlutoDB) GetMessage(id string) (*Message, error)

func (PlutoDB) GetMessages

func (p PlutoDB) GetMessages(from, till time.Time) ([]*Message, error)

func (PlutoDB) IdDate

func (p PlutoDB) IdDate(id string) time.Time

Jump to

Keyboard shortcuts

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