repository

package
v0.0.0-...-40c4472 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Login:    "postgres",
	Password: "",
	Address:  "localhost",
	Port:     5432,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Login    string `yaml:"login"`
	Password string `yaml:"password"`
	Address  string `yaml:"address"`
	Port     uint   `yaml:"port"`
}

type Connector

type Connector interface {
	Connect(address, login, pass string, port uint) (err error)
	Close()
}

type Database

type Database interface {
	InsertLog(dtime time.Time, optype string, data json.RawMessage) (err error)
	InsertReceipt(dtime time.Time, optype string, data json.RawMessage) (err error)
}

type Repo

type Repo interface {
	Connector
	Database
}

type Repository

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

func NewRepository

func NewRepository(ctx context.Context, cfg *Config) *Repository

func (*Repository) Close

func (r *Repository) Close()

func (*Repository) Connect

func (r *Repository) Connect(address, login, pass string, port uint) (err error)

func (*Repository) InsertLog

func (r *Repository) InsertLog(dtime time.Time, optype string, data json.RawMessage) error

func (*Repository) InsertReceipt

func (r *Repository) InsertReceipt(dtime time.Time, optype string, data json.RawMessage) error

Jump to

Keyboard shortcuts

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