database

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 13 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) HardDeleteAll added in v0.3.4

func (c *Context) HardDeleteAll() 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