407 lines
13 KiB
Go
407 lines
13 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package db
|
|
|
|
import (
|
|
"database/sql"
|
|
"database/sql/driver"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type DocumentsType string
|
|
|
|
const (
|
|
DocumentsTypeQuote DocumentsType = "quote"
|
|
DocumentsTypeInvoice DocumentsType = "invoice"
|
|
DocumentsTypePurchaseOrder DocumentsType = "purchaseOrder"
|
|
DocumentsTypeOrderAck DocumentsType = "orderAck"
|
|
DocumentsTypePackingList DocumentsType = "packingList"
|
|
)
|
|
|
|
func (e *DocumentsType) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = DocumentsType(s)
|
|
case string:
|
|
*e = DocumentsType(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for DocumentsType: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullDocumentsType struct {
|
|
DocumentsType DocumentsType `json:"documents_type"`
|
|
Valid bool `json:"valid"` // Valid is true if DocumentsType is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullDocumentsType) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.DocumentsType, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.DocumentsType.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullDocumentsType) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.DocumentsType), nil
|
|
}
|
|
|
|
type UsersAccessLevel string
|
|
|
|
const (
|
|
UsersAccessLevelAdmin UsersAccessLevel = "admin"
|
|
UsersAccessLevelManager UsersAccessLevel = "manager"
|
|
UsersAccessLevelUser UsersAccessLevel = "user"
|
|
UsersAccessLevelNone UsersAccessLevel = "none"
|
|
)
|
|
|
|
func (e *UsersAccessLevel) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = UsersAccessLevel(s)
|
|
case string:
|
|
*e = UsersAccessLevel(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for UsersAccessLevel: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullUsersAccessLevel struct {
|
|
UsersAccessLevel UsersAccessLevel `json:"users_access_level"`
|
|
Valid bool `json:"valid"` // Valid is true if UsersAccessLevel is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullUsersAccessLevel) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.UsersAccessLevel, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.UsersAccessLevel.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullUsersAccessLevel) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.UsersAccessLevel), nil
|
|
}
|
|
|
|
type UsersType string
|
|
|
|
const (
|
|
UsersTypePrinciple UsersType = "principle"
|
|
UsersTypeContact UsersType = "contact"
|
|
UsersTypeUser UsersType = "user"
|
|
)
|
|
|
|
func (e *UsersType) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*e = UsersType(s)
|
|
case string:
|
|
*e = UsersType(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for UsersType: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type NullUsersType struct {
|
|
UsersType UsersType `json:"users_type"`
|
|
Valid bool `json:"valid"` // Valid is true if UsersType is not NULL
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (ns *NullUsersType) Scan(value interface{}) error {
|
|
if value == nil {
|
|
ns.UsersType, ns.Valid = "", false
|
|
return nil
|
|
}
|
|
ns.Valid = true
|
|
return ns.UsersType.Scan(value)
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (ns NullUsersType) Value() (driver.Value, error) {
|
|
if !ns.Valid {
|
|
return nil, nil
|
|
}
|
|
return string(ns.UsersType), nil
|
|
}
|
|
|
|
type Address struct {
|
|
ID int32 `json:"id"`
|
|
// Descriptive Name for this address
|
|
Name string `json:"name"`
|
|
// street or unit number and street name
|
|
Address string `json:"address"`
|
|
// Suburb / City
|
|
City string `json:"city"`
|
|
// State foreign Key
|
|
StateID int32 `json:"state_id"`
|
|
// Country foreign Key
|
|
CountryID int32 `json:"country_id"`
|
|
// Customer foreign key
|
|
CustomerID int32 `json:"customer_id"`
|
|
// either bill / ship / both
|
|
Type string `json:"type"`
|
|
Postcode string `json:"postcode"`
|
|
}
|
|
|
|
type Attachment struct {
|
|
ID int32 `json:"id"`
|
|
PrincipleID int32 `json:"principle_id"`
|
|
Created time.Time `json:"created"`
|
|
Modified time.Time `json:"modified"`
|
|
Name string `json:"name"`
|
|
Filename string `json:"filename"`
|
|
File string `json:"file"`
|
|
Type string `json:"type"`
|
|
Size int32 `json:"size"`
|
|
Description string `json:"description"`
|
|
Archived bool `json:"archived"`
|
|
}
|
|
|
|
type Box struct {
|
|
ID int32 `json:"id"`
|
|
ShipmentID int32 `json:"shipment_id"`
|
|
Length string `json:"length"`
|
|
Width string `json:"width"`
|
|
Height string `json:"height"`
|
|
Weight string `json:"weight"`
|
|
}
|
|
|
|
type Country struct {
|
|
ID int32 `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type Customer struct {
|
|
ID int32 `json:"id"`
|
|
// Company Name
|
|
Name string `json:"name"`
|
|
TradingName string `json:"trading_name"`
|
|
Abn sql.NullString `json:"abn"`
|
|
Created time.Time `json:"created"`
|
|
Notes string `json:"notes"`
|
|
DiscountPricingPolicies string `json:"discount_pricing_policies"`
|
|
PaymentTerms string `json:"payment_terms"`
|
|
CustomerCategoryID int32 `json:"customer_category_id"`
|
|
Url string `json:"url"`
|
|
CountryID int32 `json:"country_id"`
|
|
}
|
|
|
|
type Document struct {
|
|
ID int32 `json:"id"`
|
|
Type DocumentsType `json:"type"`
|
|
Created time.Time `json:"created"`
|
|
UserID int32 `json:"user_id"`
|
|
DocPageCount int32 `json:"doc_page_count"`
|
|
// Either the Enquiry number, Invoice no, order ack. Convenient place to store this to save on queries
|
|
CmcReference string `json:"cmc_reference"`
|
|
PdfFilename string `json:"pdf_filename"`
|
|
PdfCreatedAt time.Time `json:"pdf_created_at"`
|
|
PdfCreatedByUserID int32 `json:"pdf_created_by_user_id"`
|
|
ShippingDetails sql.NullString `json:"shipping_details"`
|
|
Revision int32 `json:"revision"`
|
|
BillTo sql.NullString `json:"bill_to"`
|
|
ShipTo sql.NullString `json:"ship_to"`
|
|
EmailSentAt time.Time `json:"email_sent_at"`
|
|
EmailSentByUserID int32 `json:"email_sent_by_user_id"`
|
|
}
|
|
|
|
type Enquiry struct {
|
|
ID int32 `json:"id"`
|
|
Created time.Time `json:"created"`
|
|
Submitted sql.NullTime `json:"submitted"`
|
|
// enquirynumber
|
|
Title string `json:"title"`
|
|
UserID int32 `json:"user_id"`
|
|
CustomerID int32 `json:"customer_id"`
|
|
ContactID int32 `json:"contact_id"`
|
|
ContactUserID int32 `json:"contact_user_id"`
|
|
StateID int32 `json:"state_id"`
|
|
CountryID int32 `json:"country_id"`
|
|
PrincipleID int32 `json:"principle_id"`
|
|
StatusID int32 `json:"status_id"`
|
|
Comments string `json:"comments"`
|
|
// Numeric Principle Code
|
|
PrincipleCode int32 `json:"principle_code"`
|
|
// GST applicable on this enquiry
|
|
Gst bool `json:"gst"`
|
|
BillingAddressID sql.NullInt32 `json:"billing_address_id"`
|
|
ShippingAddressID sql.NullInt32 `json:"shipping_address_id"`
|
|
// has the enquired been posted
|
|
Posted bool `json:"posted"`
|
|
EmailCount int32 `json:"email_count"`
|
|
InvoiceCount int32 `json:"invoice_count"`
|
|
JobCount int32 `json:"job_count"`
|
|
QuoteCount int32 `json:"quote_count"`
|
|
Archived int8 `json:"archived"`
|
|
}
|
|
|
|
type Invoice struct {
|
|
ID int32 `json:"id"`
|
|
// CMC Invoice Number String
|
|
Title string `json:"title"`
|
|
CustomerID int32 `json:"customer_id"`
|
|
}
|
|
|
|
type LineItem struct {
|
|
ID int32 `json:"id"`
|
|
ItemNumber string `json:"item_number"`
|
|
Option bool `json:"option"`
|
|
Quantity string `json:"quantity"`
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
DocumentID int32 `json:"document_id"`
|
|
ProductID sql.NullInt32 `json:"product_id"`
|
|
HasTextPrices bool `json:"has_text_prices"`
|
|
HasPrice int8 `json:"has_price"`
|
|
UnitPriceString sql.NullString `json:"unit_price_string"`
|
|
GrossPriceString sql.NullString `json:"gross_price_string"`
|
|
CostingID sql.NullInt32 `json:"costing_id"`
|
|
// Either fill this in or have a costing_id associated with this record
|
|
GrossUnitPrice sql.NullString `json:"gross_unit_price"`
|
|
NetUnitPrice sql.NullString `json:"net_unit_price"`
|
|
DiscountPercent sql.NullString `json:"discount_percent"`
|
|
DiscountAmountUnit sql.NullString `json:"discount_amount_unit"`
|
|
DiscountAmountTotal sql.NullString `json:"discount_amount_total"`
|
|
GrossPrice sql.NullString `json:"gross_price"`
|
|
NetPrice sql.NullString `json:"net_price"`
|
|
}
|
|
|
|
type Principle struct {
|
|
ID int32 `json:"id"`
|
|
Name string `json:"name"`
|
|
ShortName sql.NullString `json:"short_name"`
|
|
Code int32 `json:"code"`
|
|
}
|
|
|
|
type Product struct {
|
|
ID int32 `json:"id"`
|
|
// Principle FK
|
|
PrincipleID int32 `json:"principle_id"`
|
|
ProductCategoryID int32 `json:"product_category_id"`
|
|
// This must match the Title in the Excel Costing File
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
// Part or model number principle uses to identify this product
|
|
ModelNumber sql.NullString `json:"model_number"`
|
|
// %1% - first item, %2% , second item etc
|
|
ModelNumberFormat sql.NullString `json:"model_number_format"`
|
|
// Any notes about this product. Note displayed on quotes
|
|
Notes sql.NullString `json:"notes"`
|
|
// Stock or Ident
|
|
Stock bool `json:"stock"`
|
|
ItemCode string `json:"item_code"`
|
|
ItemDescription string `json:"item_description"`
|
|
}
|
|
|
|
type PurchaseOrder struct {
|
|
ID int32 `json:"id"`
|
|
IssueDate time.Time `json:"issue_date"`
|
|
DispatchDate time.Time `json:"dispatch_date"`
|
|
DateArrived time.Time `json:"date_arrived"`
|
|
// CMC PONumber
|
|
Title string `json:"title"`
|
|
PrincipleID int32 `json:"principle_id"`
|
|
PrincipleReference string `json:"principle_reference"`
|
|
DocumentID int32 `json:"document_id"`
|
|
CurrencyID sql.NullInt32 `json:"currency_id"`
|
|
OrderedFrom string `json:"ordered_from"`
|
|
Description string `json:"description"`
|
|
DispatchBy string `json:"dispatch_by"`
|
|
DeliverTo string `json:"deliver_to"`
|
|
ShippingInstructions string `json:"shipping_instructions"`
|
|
JobsText string `json:"jobs_text"`
|
|
FreightForwarderText string `json:"freight_forwarder_text"`
|
|
ParentPurchaseOrderID int32 `json:"parent_purchase_order_id"`
|
|
}
|
|
|
|
type Quote struct {
|
|
Created time.Time `json:"created"`
|
|
Modified time.Time `json:"modified"`
|
|
ID int32 `json:"id"`
|
|
EnquiryID int32 `json:"enquiry_id"`
|
|
CurrencyID int32 `json:"currency_id"`
|
|
// limited at 5 digits. Really, you're not going to have more revisions of a single quote than that
|
|
Revision int32 `json:"revision"`
|
|
// estimated delivery time for quote
|
|
DeliveryTime string `json:"delivery_time"`
|
|
DeliveryTimeFrame string `json:"delivery_time_frame"`
|
|
PaymentTerms string `json:"payment_terms"`
|
|
DaysValid int32 `json:"days_valid"`
|
|
DateIssued time.Time `json:"date_issued"`
|
|
ValidUntil time.Time `json:"valid_until"`
|
|
DeliveryPoint string `json:"delivery_point"`
|
|
ExchangeRate string `json:"exchange_rate"`
|
|
CustomsDuty string `json:"customs_duty"`
|
|
DocumentID int32 `json:"document_id"`
|
|
CommercialComments sql.NullString `json:"commercial_comments"`
|
|
}
|
|
|
|
type QuoteReminder struct {
|
|
ID int32 `json:"id"`
|
|
QuoteID int32 `json:"quote_id"`
|
|
// 1=1st, 2=2nd, 3=3rd reminder
|
|
ReminderType int32 `json:"reminder_type"`
|
|
DateSent time.Time `json:"date_sent"`
|
|
// User who manually (re)sent the reminder
|
|
Username sql.NullString `json:"username"`
|
|
}
|
|
|
|
type State struct {
|
|
ID int32 `json:"id"`
|
|
Name string `json:"name"`
|
|
Shortform sql.NullString `json:"shortform"`
|
|
Enqform sql.NullString `json:"enqform"`
|
|
}
|
|
|
|
type Status struct {
|
|
ID int32 `json:"id"`
|
|
Name string `json:"name"`
|
|
Color sql.NullString `json:"color"`
|
|
}
|
|
|
|
type User struct {
|
|
ID int32 `json:"id"`
|
|
PrincipleID int32 `json:"principle_id"`
|
|
CustomerID int32 `json:"customer_id"`
|
|
Type UsersType `json:"type"`
|
|
AccessLevel UsersAccessLevel `json:"access_level"`
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
Email string `json:"email"`
|
|
JobTitle string `json:"job_title"`
|
|
Phone string `json:"phone"`
|
|
Mobile string `json:"mobile"`
|
|
Fax string `json:"fax"`
|
|
PhoneExtension string `json:"phone_extension"`
|
|
DirectPhone string `json:"direct_phone"`
|
|
Notes string `json:"notes"`
|
|
// Added by Vault. May or may not be a real person.
|
|
ByVault bool `json:"by_vault"`
|
|
// Disregard emails from this address in future.
|
|
Blacklisted bool `json:"blacklisted"`
|
|
Enabled bool `json:"enabled"`
|
|
Archived sql.NullBool `json:"archived"`
|
|
PrimaryContact bool `json:"primary_contact"`
|
|
}
|