repository

package
v0.0.0-...-37fcaca Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beginner

type Beginner interface {
	Begin() (*sql.Tx, error)
}

Beginner is interface of sql.DB.Begin methods.

type DB

type DB interface {
	Execer
	Queryer
	Preparer
}

DB is interface of *sql.DB

type DBConnector

type DBConnector interface {
	DB
	Beginner
}

DBConnector is a interface od *sql.DB

func NewSqlite3

func NewSqlite3(ds string) (DBConnector, error)

NewSqlite3 create new sqlite3 connection.

type EntryRepository

type EntryRepository struct{}

EntryRepository implements IEntryRepository interface.

func (*EntryRepository) GetAll

func (s *EntryRepository) GetAll(db DB) ([]entity.Entry, error)

GetAll get all entries from data store.

func (*EntryRepository) Save

func (s *EntryRepository) Save(db DB, entry entity.Entry) error

Save inserts a record at entries.

type Execer

type Execer interface {
	Exec(string, ...interface{}) (sql.Result, error)
}

Execer is interface of sql.DB.Exec methods.

type IEntryRepository

type IEntryRepository interface {
	GetAll(db DB) ([]entity.Entry, error)
	Save(db DB, entry entity.Entry) error
}

IEntryRepository is interface of the repository to fetch Entry.

type Preparer

type Preparer interface {
	Prepare(string) (*sql.Stmt, error)
}

Preparer is interface of sql.DB.Prepare methods.

type Queryer

type Queryer interface {
	Query(string, ...interface{}) (*sql.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
}

Queryer is interface of sql.DB.Query and sql.DB.QueryRow methods.

type Tx

type Tx interface {
	Rollback() error
	Commit() error
	DB
}

Tx is interface of *sql.Tx

Jump to

Keyboard shortcuts

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