database

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Db *gorm.DB //Pointer to database

	PusherTomb tomb.Tomb
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(cfg map[string]string) (*Context, error)

func (*Context) CleanUpRecordsByAge

func (c *Context) CleanUpRecordsByAge() (int, error)

func (*Context) CleanUpRecordsByCount

func (c *Context) CleanUpRecordsByCount() (int, error)

func (*Context) DeleteAll

func (c *Context) DeleteAll() error

func (*Context) DeleteBan

func (c *Context) DeleteBan(target string) (int, error)

try to delete entries with matching fields

func (*Context) DeleteExpired

func (c *Context) DeleteExpired() (int, error)

func (*Context) Flush

func (c *Context) Flush() error

Flush doesn't do anything here : we are not using transactions or such, nothing to "flush" per se

func (*Context) GetBansAt

func (c *Context) GetBansAt(at time.Time) ([]map[string]string, error)

GetBansAt returns the IPs that were banned at a given time

func (*Context) GetDeletedBanSince

func (c *Context) GetDeletedBanSince(since time.Time) ([]types.BanApplication, error)

func (*Context) GetNewBan

func (c *Context) GetNewBan() ([]types.BanApplication, error)

func (*Context) GetNewBanSince

func (c *Context) GetNewBanSince(since time.Time) ([]types.BanApplication, error)

func (*Context) StartAutoCommit

func (c *Context) StartAutoCommit() error

func (*Context) WriteBanApplication

func (c *Context) WriteBanApplication(ban types.BanApplication) error

we simply append the event to the transaction

func (*Context) WriteSignal

func (c *Context) WriteSignal(sig types.SignalOccurence) error

Jump to

Keyboard shortcuts

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