database

package
v0.0.0-...-282c9a7 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	Id            int    `gorm:"column:id;primary_key"`
	FancyName     string `gorm:"column:fancyname;size:100;default:null"`
	Name          string `gorm:"column:name;size:100"`
	Number        string `gorm:"column:number;size:100"`
	Reference     string `gorm:"column:reference;size:100:default:null"`
	PayDay        int    `gorm:"column:payday;default:30"`
	Address       string `gorm:"column:address;size:100"`
	PostalAddress string `gorm:"column:postaladdress;size:100"`
}

func (*Customer) TableName

func (p *Customer) TableName() string

type Database

type Database struct {
	UseTestDatabase bool
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(useTestDatabase bool) *Database

func (*Database) CloseDatabase

func (d *Database) CloseDatabase()

func (*Database) GetAllCustomers

func (d *Database) GetAllCustomers() ([]Customer, error)

func (*Database) GetAllInvoices

func (d *Database) GetAllInvoices() ([]Invoice, error)

func (*Database) GetAllProducts

func (d *Database) GetAllProducts() ([]Product, error)

func (*Database) GetCustomerByNumber

func (d *Database) GetCustomerByNumber(number string) (*Customer, error)

func (*Database) GetDatabaseName

func (d *Database) GetDatabaseName() string

func (*Database) GetInvoiceByNumber

func (d *Database) GetInvoiceByNumber(number string) (*Invoice, error)

func (*Database) GetInvoiceRowsByInvoiceId

func (d *Database) GetInvoiceRowsByInvoiceId(id int) ([]InvoiceRow, error)

func (*Database) GetNextInvoiceNumber

func (d *Database) GetNextInvoiceNumber() (int, error)

func (*Database) GetProductByNumber

func (d *Database) GetProductByNumber(number string) (*Product, error)

func (*Database) InsertInvoice

func (d *Database) InsertInvoice(invoice *Invoice) error

func (*Database) UpdateProduct

func (d *Database) UpdateProduct(product *Product) error

type Invoice

type Invoice struct {
	Id                    int           `gorm:"column:id;primary_key"`
	Number                int           `gorm:"column:number"`
	Date                  time.Time     `gorm:"column:date"`
	DueDate               time.Time     `gorm:"column:duedate"`
	Amount                float32       `gorm:"column:amount"`
	CustomerNumber        string        `gorm:"column:customernumber;size:100"`
	CustomerName          string        `gorm:"column:customername;size:100"`
	CustomerAddress       string        `gorm:"column:customeraddress;size:100"`
	CustomerPostalAddress string        `gorm:"column:customerpostaladdress;size:100"`
	CustomerReference     string        `gorm:"column:customerreference;size:100"`
	PayDay                int           `gorm:"column:payday"`
	Credit                bool          `gorm:"column:credit;default:0"`
	CreditInvoiceNumber   sql.NullInt32 `gorm:"column:creditinvoicenumber;default:null"`
	ReadOnly              bool          `gorm:"column:readonly;default:false"`

	Rows []InvoiceRow
}

func (*Invoice) TableName

func (i *Invoice) TableName() string

type InvoiceRow

type InvoiceRow struct {
	Id        int     `gorm:"column:id;primary_key"`
	InvoiceId int     `gorm:"column:invoiceid;"`
	Text      string  `gorm:"column:producttext;size:100"`
	Name      string  `gorm:"column:productname;size:100"`
	Price     float32 `gorm:"column:productprice"`
	Amount    float32 `gorm:"column:amount"`
	Total     float32 `gorm:"column:rowtotal"`
}

func (*InvoiceRow) TableName

func (p *InvoiceRow) TableName() string

type Product

type Product struct {
	Id     int     `gorm:"column:id;primary_key"`
	Number string  `gorm:"column:number;size:50"`
	Text   string  `gorm:"column:text;size:100"`
	Name   string  `gorm:"column:name;size:100"`
	Price  float32 `gorm:"column:price"`
}

func (*Product) TableName

func (p *Product) TableName() string

Jump to

Keyboard shortcuts

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