db

package
v0.0.0-...-aec64cb Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(db *sql.DB) error

func ConnectDB

func ConnectDB(DBPath string) (*sql.DB, error)

func InitDB

func InitDB(DBPath string, db *sql.DB) error

Types

type CarTrip

type CarTrip struct {
	ID         int64
	SessionID  sql.NullInt64
	DistanceKM float64
	DateOnly   string
}

CarTrip Methods: String, PreInsertValid, Valid

func (CarTrip) PreInsertValid

func (ct CarTrip) PreInsertValid() error

func (CarTrip) String

func (ct CarTrip) String() string

func (CarTrip) Valid

func (ct CarTrip) Valid() error

type Client

type Client struct {
	ID   int64
	Name string
}

Client Methods: String, PreInsertValid, Valid

func (Client) PreInsertValid

func (c Client) PreInsertValid() error

func (Client) String

func (c Client) String() string

func (Client) Valid

func (c Client) Valid() error

type Expense

type Expense struct {
	ID             int64
	SessionID      sql.NullInt64
	TypeID         int64
	Currency       string
	ReceiptRelPath sql.NullString
	Notes          sql.NullString
	DateTime       time.Time
}

Expense Methods: String, PreInsertValid, Valid, PreReportValid

func (Expense) PreInsertValid

func (e Expense) PreInsertValid() error

func (Expense) PreReportValid

func (e Expense) PreReportValid() error

func (Expense) String

func (e Expense) String() string

func (Expense) Valid

func (e Expense) Valid() error

type ExpenseList

type ExpenseList []Expense

Method: MapExpensesByCurrency

func (ExpenseList) MapExpensesByCurrency

func (eList ExpenseList) MapExpensesByCurrency() (map[string]ExpenseList, error)

type ExpenseType

type ExpenseType struct {
	ID   int64
	Name string // TODO: check UNIQUE in crud
}

ExpenseType Methods: String, PreInsertValid, Valid

func (ExpenseType) PreInsertValid

func (et ExpenseType) PreInsertValid() error

func (ExpenseType) String

func (et ExpenseType) String() string

func (ExpenseType) Valid

func (et ExpenseType) Valid() error

type LineItem

type LineItem struct {
	ID        int64
	ExpenseID int64
	TaxeRate  float64
	Total     float64
}

LineItem Method: String, PreInsertValid, Valid

func (LineItem) PreInsertValid

func (li LineItem) PreInsertValid() error

func (LineItem) String

func (li LineItem) String() string

func (LineItem) Valid

func (li LineItem) Valid() error

type LineItemList

type LineItemList []LineItem

Method: SumByTaxeRates

func (LineItemList) SumByTaxeRates

func (liList LineItemList) SumByTaxeRates() (map[float64]float64, error)

This method consider Expense.Currency equality handled

type NullableTime

type NullableTime struct {
	Time  time.Time
	Valid bool
}

Custom Nullable time.Time as the library sql doesn't have one

func (NullableTime) Equal

func (nt NullableTime) Equal(other NullableTime) bool

func (*NullableTime) Scan

func (nt *NullableTime) Scan(value interface{}) error

func (NullableTime) Value

func (nt NullableTime) Value() (driver.Value, error)

type Session

type Session struct {
	ID                int64
	ClientID          int64
	Location          string
	TripStartLocation sql.NullString
	TripEndLocation   sql.NullString
	StartAtDateTime   NullableTime
	EndAtDateTime     NullableTime
}

Session Methods: String, PreInsertValid, Valid, PreReportValid

func (Session) PreInsertValid

func (s Session) PreInsertValid() error

func (Session) PreReportValid

func (s Session) PreReportValid() error

func (Session) String

func (s Session) String() string

func (Session) Valid

func (s Session) Valid() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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