database

package
v0.0.0-...-eee2b2e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(dsn string, poolSize int) (*sql.DB, error)

CreateDatabase initializes database connection pool.

func NewDatabaseStorage

func NewDatabaseStorage(ctx context.Context, db *sql.DB) storage.Storage

NewDatabaseStorage constructor.

Types

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage data.

func (*Storage) AddRequest

func (s *Storage) AddRequest(data *model.FetchData) (string, error)

AddFetchData saves fetch data and return ID.

func (*Storage) AddResponse

func (s *Storage) AddResponse(id string, response *model.Response) error

AddResponse saves response from external resource by request ID.

func (*Storage) DeleteRequest

func (s *Storage) DeleteRequest(id string) error

DeleteRequest removes request from storage by ID.

func (*Storage) GetAllRequests

func (s *Storage) GetAllRequests(paginator *model.Paginator) []model.Request

GetAllRequests reads all requests from storage.

Jump to

Keyboard shortcuts

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