db

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveEntry

func SaveEntry(signature, message string) (string, error)

SaveEntry is the db wrapper to save an entry

Types

type Entry

type Entry struct {
	Signature string
	TS        time.Time
	Message   string
}

Entry is a MongoDB object

func GetEntries

func GetEntries(signature string) ([]Entry, error)

GetEntries is the db wrapper to get entries

func NewEntry

func NewEntry(sender, text string, ts time.Time) *Entry

NewEntry creates a new MS

type Instance

type Instance struct {
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}

Instance is the interface for the database

func NewInstance

func NewInstance(host, port string) *Instance

NewInstance creates a new database engine

func (*Instance) AddEntry

func (i *Instance) AddEntry(signature, txt string) (bool, error)

AddEntry adds an entry to the database

func (*Instance) Close

func (i *Instance) Close()

Close the database connection, to be deferred

func (*Instance) Connect

func (i *Instance) Connect(dbname, collname string) (context.CancelFunc, error)

Connect to the MongoDB database

func (*Instance) GetEntries

func (i *Instance) GetEntries(signature string) ([]Entry, error)

GetEntries given an input signature, returns all entries from the database

Jump to

Keyboard shortcuts

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