sqlitestore

package
v0.0.0-...-f60b94f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBFileNotFound = errors.New("DB files not found")

Functions

func CloseDB

func CloseDB() error

func DownloadDatabase

func DownloadDatabase() (string, error)

func GetDatabase

func GetDatabase(forceUpdate bool) (*sql.DB, *sqlx.DB, error)

func InitTables

func InitTables(db *sql.DB) error

func UploadDatabase

func UploadDatabase() (*sql.DB, error)

Types

type Account

type Account struct {
	BankID           int64           `db:"bank_id"`
	UsernameHash     string          `db:"user"`
	DateRecorded     int64           `db:"date_recorded"`
	Bank             string          `db:"bank"`
	Type             string          `db:"type"`
	AccountName      string          `db:"account_name"`
	BSB              string          `db:"bsb"`
	AccountNumber    int64           `db:"account_number"`
	CurrentBalance   decimal.Decimal `db:"current_balance"`
	AvailableBalance decimal.Decimal `db:"available_balance"`
}

type SqliteStore

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

func New

func New() (*SqliteStore, error)

func (SqliteStore) AddCategories

func (store SqliteStore) AddCategories(usernameHash string, categories []models.Category) ([]models.Category, error)

func (SqliteStore) AddDeviceToken

func (store SqliteStore) AddDeviceToken(usernameHash string, deviceToken string) ([]string, error)

func (SqliteStore) Close

func (store SqliteStore) Close() error

func (SqliteStore) GetAccounts

func (store SqliteStore) GetAccounts(usernamehash string) (models.BankResponse, error)

func (SqliteStore) GetBankData

func (store SqliteStore) GetBankData(usernamehash string) (models.BankResponse, error)

func (SqliteStore) GetCategories

func (store SqliteStore) GetCategories(usernameHash string) ([]models.Category, error)

func (SqliteStore) GetCredentials

func (store SqliteStore) GetCredentials(usernameHash string) (string, error)

func (SqliteStore) GetDeviceTokens

func (store SqliteStore) GetDeviceTokens(usernameHash string) ([]string, error)

func (SqliteStore) GetExclusions

func (store SqliteStore) GetExclusions(usernameHash string) ([]models.Transaction, error)

func (SqliteStore) GetInvocations

func (store SqliteStore) GetInvocations(usernamehash string) (models.InvocationsResponse, error)

func (SqliteStore) GetStoredPassword

func (store SqliteStore) GetStoredPassword(usernamehash string) (string, error)

func (SqliteStore) GetTransactions

func (store SqliteStore) GetTransactions(usernamehash string) (models.BankResponse, error)

func (SqliteStore) PatchTransaction

func (store SqliteStore) PatchTransaction(usernameHash string, transactionId int64, transactionPatch models.TransactionPatch) (models.Transaction, error)

func (SqliteStore) PutUser

func (store SqliteStore) PutUser(usernameHash string, password string) error

func (SqliteStore) SetCredentials

func (store SqliteStore) SetCredentials(usernameHash string, credentials string) error

type Transaction

type Transaction struct {
	TransactionID          int64           `db:"transaction_id"`
	UsernameHash           string          `db:"user"`
	DateRecorded           int64           `db:"date_recorded"`
	Date                   int64           `db:"date"`
	Account                int64           `db:"account"`
	Bank                   string          `db:"bank"`
	Description            string          `db:"description"`
	DisplayableDescription string          `db:"displayable_description"`
	Credit                 decimal.Decimal `db:"credit"`
	Debit                  decimal.Decimal `db:"debit"`
	Type                   string          `db:"type"`
	Location               string          `db:"location"`
	Card                   string          `db:"card"`
	Status                 string          `db:"status"`
	Exclude                int             `db:"exclude"`
}

type User

type User struct {
	UserID       int    `db:"user_id"`
	UsernameHash string `db:"username_hash"`
	Password     string `db:"password"`
	Credentials  string `db:"credentials"`
}

Jump to

Keyboard shortcuts

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