repository

package
v0.0.0-...-fe57f78 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Holdings

type Holdings struct {
	Id            int64     `json:"id"`
	Amount        int       `json:"amount"`
	PurchaseDate  time.Time `json:"purchase_date"`
	PurchasePrice int       `json:"purchase_price"`
}

type Repository

type Repository interface {
	Migrate() error
	InsertHolding(h Holdings) (*Holdings, error)
	AllHoldings() ([]Holdings, error)
	GetHoldingById(id int64) (*Holdings, error)
	UpdateHolding(id int64, updated Holdings) error
	DeleteHolding(id int64) error
}

type SQLiteRepository

type SQLiteRepository struct {
	Conn *sql.DB
}

func NewSQLiteRepository

func NewSQLiteRepository(db *sql.DB) *SQLiteRepository

func (*SQLiteRepository) AllHoldings

func (r *SQLiteRepository) AllHoldings() ([]Holdings, error)

func (*SQLiteRepository) DeleteHolding

func (r *SQLiteRepository) DeleteHolding(id int64) error

func (*SQLiteRepository) GetHoldingById

func (r *SQLiteRepository) GetHoldingById(id int64) (*Holdings, error)

func (*SQLiteRepository) InsertHolding

func (r *SQLiteRepository) InsertHolding(h Holdings) (*Holdings, error)

func (*SQLiteRepository) Migrate

func (r *SQLiteRepository) Migrate() error

func (*SQLiteRepository) UpdateHolding

func (r *SQLiteRepository) UpdateHolding(id int64, updated Holdings) error

type TestRepository

type TestRepository struct{}

func NewTestRepository

func NewTestRepository() *TestRepository

func (*TestRepository) AllHoldings

func (t *TestRepository) AllHoldings() ([]Holdings, error)

func (*TestRepository) DeleteHolding

func (t *TestRepository) DeleteHolding(id int64) error

func (*TestRepository) GetHoldingById

func (t *TestRepository) GetHoldingById(id int64) (*Holdings, error)

func (*TestRepository) InsertHolding

func (t *TestRepository) InsertHolding(h Holdings) (*Holdings, error)

func (*TestRepository) Migrate

func (t *TestRepository) Migrate() error

func (*TestRepository) UpdateHolding

func (t *TestRepository) UpdateHolding(id int64, updated Holdings) error

Jump to

Keyboard shortcuts

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