model

package
v0.0.0-...-f06e5ea Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadList

func LoadList[T any](
	conn database.Queryable,
	list *[]T,
	capacity int,
	scan func(database.Row, *T) error,
	sql string,
	arguments ...any,
) error

LoadList loads rows from a database into a list.

The `scan` function determine how to set the values on each object.

Types

type Alert

type Alert struct {
	ID    int
	From  Currency
	To    Currency
	Value decimal.Decimal
	Above bool
	Time  time.Time
	Sent  bool
}

Alert represents an alert configured by a user

type Asset

type Asset struct {
	Currency  Currency
	Purchased decimal.Decimal
	Amount    decimal.Decimal
}

Asset represents the value and purchased amount of a crypto asset

type Currency

type Currency struct {
	ID     int
	Ticker string
	Name   string
}

Currency represents a currency in the database

type Portfolio

type Portfolio struct {
	Currency Currency
	Cash     decimal.Decimal
}

Portfolio represents portfolio data for a user

type Price

type Price struct {
	From  Currency
	To    Currency
	Time  time.Time
	Value decimal.Decimal
}

Price represents a price in the database

type User

type User struct {
	ID       int
	Username string
}

User represents a user in the database

Jump to

Keyboard shortcuts

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