infrastructure

package
v0.0.0-...-e2f3688 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoringLogger

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

BoringLogger is a wrapper for the standard logger.

func NewBoringLogger

func NewBoringLogger(out io.Writer) *BoringLogger

NewBoringLogger returns a new instance of the boring logger.

func (BoringLogger) Log

func (bl BoringLogger) Log(msg string)

Log prints the given message.

type SqliteHandler

type SqliteHandler struct {
	Conn *sql.DB
}

SqliteHandler wraps a connection to a SQLite database.

func NewSqliteHandler

func NewSqliteHandler(fileName string) (*SqliteHandler, error)

NewSqliteHandler istannciate a new connection to the sqlite db. A filepath to the database file name must be supplied.

func (*SqliteHandler) Execute

func (sh *SqliteHandler) Execute(statement string) error

Execute performs the given statement on the database the handler is connected to.

func (*SqliteHandler) Query

func (sh *SqliteHandler) Query(statement string) (repositories.Row, error)

Query performs the given statement on the database the handler is connected to and returns the result.

type SqliteRow

type SqliteRow struct {
	Rows *sql.Rows
}

SqliteRow wraps sql results and implements our interfaces/repositories.Row to allow the interfaces to comunicate with the database without handling low level details.

func (SqliteRow) Close

func (r SqliteRow) Close() error

Close closes the Rows, preventing further enumeration. If Next is called and returns false and there are no further result sets, the Rows are closed automatically and it will suffice to check the result of Err. Close is idempotent and does not affect the result of Err.

func (SqliteRow) Next

func (r SqliteRow) Next() bool

Next prepares the next result row for reading with the Scan method. It returns true on success, or false if there is no next result row or an error happened while preparing it. Err should be consulted to distinguish between the two cases.

func (SqliteRow) Scan

func (r SqliteRow) Scan(dest ...interface{}) error

Scan copies the columns from the matched row into the values pointed at by dest. See the documentation on Rows.Scan for details. If more than one row matches the query, Scan uses the first row and discards the rest. If no row matches the query, Scan returns ErrNoRows.

Jump to

Keyboard shortcuts

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