Documentation ¶
Index ¶
- func DecodeInvoice(invoice *Invoice) (*database.Invoice, error)
- func DecodeInvoiceLineItem(lineItem *LineItem) *database.LineItem
- func DecodeInvoices(invoices []Invoice) ([]database.Invoice, error)
- func DisableLog()
- func New(host, net, rootCert, cert, key string) (*cockroachdb, error)
- func UseLogger(logger slog.Logger)
- type ExchangeRate
- type Invoice
- type InvoiceChange
- type LineItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeInvoice ¶
DecodeInvoice decodes a cockroachdb Invoice instance into a generic database.Invoice.
func DecodeInvoiceLineItem ¶
DecodeInvoiceLineItem decodes a cockroachdb line item into a generic database.LineItem
func DecodeInvoices ¶
DecodeInvoices decodes an array of cockroachdb Invoice instances into generic database.Invoices.
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type ExchangeRate ¶
type ExchangeRate struct { Month uint `gorm:"not null"` Year uint `gorm:"not null"` ExchangeRate uint `gorm:"not null"` }
ExchangeRate contains cached calculated rates for a given month/year
func (ExchangeRate) TableName ¶
func (ExchangeRate) TableName() string
TableName returns the table name of the line items table.
type Invoice ¶
type Invoice struct { Token string `gorm:"primary_key"` UserID string `gorm:"not null"` Username string `gorm:"-"` // Only populated when reading from the database Month uint `gorm:"not null"` Year uint `gorm:"not null"` ExchangeRate uint `gorm:"not null"` Timestamp time.Time `gorm:"not null"` Status uint `gorm:"not null"` StatusChangeReason string `gorm:"not null"` PublicKey string `gorm:"not null"` UserSignature string `gorm:"not null"` ServerSignature string `gorm:"not null"` Version string `gorm:"not null"` ContractorName string `gorm:"not null"` ContractorLocation string `gorm:"not null"` ContractorRate uint `gorm:"not null"` ContractorContact string `gorm:"not null"` PaymentAddress string `gorm:"not null"` LineItems []LineItem `gorm:"foreignkey:InvoiceToken"` Changes []InvoiceChange `gorm:"foreignkey:InvoiceToken"` }
Invoice is the database model for the database.Invoice type
func EncodeInvoice ¶
EncodeInvoice encodes a generic database.Invoice instance into a cockroachdb Invoice.
type InvoiceChange ¶
type InvoiceChange struct { InvoiceToken string `gorm:"not null"` // Censorship token of the invoice AdminPublicKey string `gorm:"not null"` // The public of the admin that processed the status change. NewStatus uint `gorm:"not null"` // Updated status of the invoice. Reason string `gorm:"not null"` // Reason for status updated (required if rejected) Timestamp time.Time `gorm:"not null"` // The timestamp of the status change. }
InvoiceChange contains entries for any status update that occurs to a given invoice. This will give a full history of an invoices history.
func (InvoiceChange) TableName ¶
func (InvoiceChange) TableName() string
TableName returns the table name of the line items table.
type LineItem ¶
type LineItem struct { LineItemKey string `gorm:"primary_key"` // Token of the Invoice + array index InvoiceToken string `gorm:"not null"` // Censorship token of the invoice Type uint `gorm:"not null"` // Type of line item Domain string `gorm:"not null"` // Domain of the work performed (dev, marketing etc) Subdomain string `gorm:"not null"` // Subdomain of the work performed (foneroiton, event X etc) Description string `gorm:"not null"` // Description of work performed ProposalURL string `gorm:"not null"` // Link to politeia proposal that work is associated with Labor uint `gorm:"not null"` // Number of minutes worked Expenses uint `gorm:"not null"` // Total cost of line item (in USD cents) }
LineItem is the database model for the database.LineItem type
func EncodeInvoiceLineItem ¶
EncodeInvoiceLineItem encodes a database.LineItem into a cockroachdb line item.