storage

package
v0.0.0-...-488ba96 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgresql

type Postgresql struct {
	URL string
	// contains filtered or unexported fields
}

Postgresql storage

func (*Postgresql) Initialize

func (h *Postgresql) Initialize(ctx context.Context) (err error)

Initialize creates the tables

func (*Postgresql) ReadReport

func (h *Postgresql) ReadReport(ctx context.Context, id int64) (rs dmarc.Rows, err error)

ReadReport fetches a report

func (*Postgresql) ReadReports

func (h *Postgresql) ReadReports(ctx context.Context, offset int, pagesize int) (rs []dmarc.Report, err error)

ReadReports fetches the list of reports paginated

func (*Postgresql) Write

func (h *Postgresql) Write(ctx context.Context, f dmarc.Feedback) (err error)

type Storage

type Storage interface {
	Initialize(ctx context.Context) error
	Write(ctx context.Context, f dmarc.Feedback) error
	ReadReports(ctx context.Context, offset int, pagesize int) ([]dmarc.Report, error)
	ReadReport(ctx context.Context, id int64) (dmarc.Rows, error)
}

Storage is the interface type so we can use different drivers TODO: The name storage.Storage is redundant

Jump to

Keyboard shortcuts

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