postgres

package
v5.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package postgres contains generated code for schema 'public'.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(s string, v ...interface{})

Errorf logs an error message using the package error logger.

func Logf

func Logf(s string, v ...interface{})

Logf logs a message using the package logger.

func SetErrorLogger

func SetErrorLogger(logger interface{})

SetErrorLogger sets the package error logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

func SetLogger

func SetLogger(logger interface{})

SetLogger sets the package logger. Valid logger types:

io.Writer
func(string, ...interface{}) (int, error) // fmt.Printf
func(string, ...interface{}) // log.Printf

Types

type Category

type Category struct {
	CategoryID   int            `json:"category_id"`   // category_id
	CategoryName string         `json:"category_name"` // category_name
	Description  sql.NullString `json:"description"`   // description
	Picture      []byte         `json:"picture"`       // picture
	// contains filtered or unexported fields
}

Category represents a row from 'public.categories'.

func CategoryByCategoryID

func CategoryByCategoryID(ctx context.Context, db DB, categoryID int) (*Category, error)

CategoryByCategoryID retrieves a row from 'public.categories' as a Category.

Generated from index 'categories_pkey'.

func (*Category) Delete

func (c *Category) Delete(ctx context.Context, db DB) error

Delete deletes the Category from the database.

func (*Category) Deleted

func (c *Category) Deleted() bool

Deleted returns true when the Category has been marked for deletion from the database.

func (*Category) Exists

func (c *Category) Exists() bool

Exists returns true when the Category exists in the database.

func (*Category) Insert

func (c *Category) Insert(ctx context.Context, db DB) error

Insert inserts the Category to the database.

func (*Category) Save

func (c *Category) Save(ctx context.Context, db DB) error

Save saves the Category to the database.

func (*Category) Update

func (c *Category) Update(ctx context.Context, db DB) error

Update updates a Category in the database.

func (*Category) Upsert

func (c *Category) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Category.

type Customer

type Customer struct {
	CustomerID   string         `json:"customer_id"`   // customer_id
	CompanyName  string         `json:"company_name"`  // company_name
	ContactName  sql.NullString `json:"contact_name"`  // contact_name
	ContactTitle sql.NullString `json:"contact_title"` // contact_title
	Address      sql.NullString `json:"address"`       // address
	City         sql.NullString `json:"city"`          // city
	Region       sql.NullString `json:"region"`        // region
	PostalCode   sql.NullString `json:"postal_code"`   // postal_code
	Country      sql.NullString `json:"country"`       // country
	Phone        sql.NullString `json:"phone"`         // phone
	Fax          sql.NullString `json:"fax"`           // fax
	// contains filtered or unexported fields
}

Customer represents a row from 'public.customers'.

func CustomerByCustomerID

func CustomerByCustomerID(ctx context.Context, db DB, customerID string) (*Customer, error)

CustomerByCustomerID retrieves a row from 'public.customers' as a Customer.

Generated from index 'customers_pkey'.

func (*Customer) Delete

func (c *Customer) Delete(ctx context.Context, db DB) error

Delete deletes the Customer from the database.

func (*Customer) Deleted

func (c *Customer) Deleted() bool

Deleted returns true when the Customer has been marked for deletion from the database.

func (*Customer) Exists

func (c *Customer) Exists() bool

Exists returns true when the Customer exists in the database.

func (*Customer) Insert

func (c *Customer) Insert(ctx context.Context, db DB) error

Insert inserts the Customer to the database.

func (*Customer) Save

func (c *Customer) Save(ctx context.Context, db DB) error

Save saves the Customer to the database.

func (*Customer) Update

func (c *Customer) Update(ctx context.Context, db DB) error

Update updates a Customer in the database.

func (*Customer) Upsert

func (c *Customer) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Customer.

type CustomerCustomerDemo

type CustomerCustomerDemo struct {
	CustomerID     string `json:"customer_id"`      // customer_id
	CustomerTypeID string `json:"customer_type_id"` // customer_type_id
	// contains filtered or unexported fields
}

CustomerCustomerDemo represents a row from 'public.customer_customer_demo'.

func CustomerCustomerDemoByCustomerIDCustomerTypeID

func CustomerCustomerDemoByCustomerIDCustomerTypeID(ctx context.Context, db DB, customerID, customerTypeID string) (*CustomerCustomerDemo, error)

CustomerCustomerDemoByCustomerIDCustomerTypeID retrieves a row from 'public.customer_customer_demo' as a CustomerCustomerDemo.

Generated from index 'customer_customer_demo_pkey'.

func (*CustomerCustomerDemo) Customer

func (ccd *CustomerCustomerDemo) Customer(ctx context.Context, db DB) (*Customer, error)

Customer returns the Customer associated with the CustomerCustomerDemo's (CustomerID).

Generated from foreign key 'customer_customer_demo_customer_id_fkey'.

func (*CustomerCustomerDemo) CustomerDemographic

func (ccd *CustomerCustomerDemo) CustomerDemographic(ctx context.Context, db DB) (*CustomerDemographic, error)

CustomerDemographic returns the CustomerDemographic associated with the CustomerCustomerDemo's (CustomerTypeID).

Generated from foreign key 'customer_customer_demo_customer_type_id_fkey'.

func (*CustomerCustomerDemo) Delete

func (ccd *CustomerCustomerDemo) Delete(ctx context.Context, db DB) error

Delete deletes the CustomerCustomerDemo from the database.

func (*CustomerCustomerDemo) Deleted

func (ccd *CustomerCustomerDemo) Deleted() bool

Deleted returns true when the CustomerCustomerDemo has been marked for deletion from the database.

func (*CustomerCustomerDemo) Exists

func (ccd *CustomerCustomerDemo) Exists() bool

Exists returns true when the CustomerCustomerDemo exists in the database.

func (*CustomerCustomerDemo) Insert

func (ccd *CustomerCustomerDemo) Insert(ctx context.Context, db DB) error

Insert inserts the CustomerCustomerDemo to the database.

type CustomerDemographic

type CustomerDemographic struct {
	CustomerTypeID string         `json:"customer_type_id"` // customer_type_id
	CustomerDesc   sql.NullString `json:"customer_desc"`    // customer_desc
	// contains filtered or unexported fields
}

CustomerDemographic represents a row from 'public.customer_demographics'.

func CustomerDemographicByCustomerTypeID

func CustomerDemographicByCustomerTypeID(ctx context.Context, db DB, customerTypeID string) (*CustomerDemographic, error)

CustomerDemographicByCustomerTypeID retrieves a row from 'public.customer_demographics' as a CustomerDemographic.

Generated from index 'customer_demographics_pkey'.

func (*CustomerDemographic) Delete

func (cd *CustomerDemographic) Delete(ctx context.Context, db DB) error

Delete deletes the CustomerDemographic from the database.

func (*CustomerDemographic) Deleted

func (cd *CustomerDemographic) Deleted() bool

Deleted returns true when the CustomerDemographic has been marked for deletion from the database.

func (*CustomerDemographic) Exists

func (cd *CustomerDemographic) Exists() bool

Exists returns true when the CustomerDemographic exists in the database.

func (*CustomerDemographic) Insert

func (cd *CustomerDemographic) Insert(ctx context.Context, db DB) error

Insert inserts the CustomerDemographic to the database.

func (*CustomerDemographic) Save

func (cd *CustomerDemographic) Save(ctx context.Context, db DB) error

Save saves the CustomerDemographic to the database.

func (*CustomerDemographic) Update

func (cd *CustomerDemographic) Update(ctx context.Context, db DB) error

Update updates a CustomerDemographic in the database.

func (*CustomerDemographic) Upsert

func (cd *CustomerDemographic) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for CustomerDemographic.

type DB

type DB interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

DB is the common interface for database operations that can be used with types from schema 'public'.

This works with both database/sql.DB and database/sql.Tx.

type Employee

type Employee struct {
	EmployeeID      int            `json:"employee_id"`       // employee_id
	LastName        string         `json:"last_name"`         // last_name
	FirstName       string         `json:"first_name"`        // first_name
	Title           sql.NullString `json:"title"`             // title
	TitleOfCourtesy sql.NullString `json:"title_of_courtesy"` // title_of_courtesy
	BirthDate       sql.NullTime   `json:"birth_date"`        // birth_date
	HireDate        sql.NullTime   `json:"hire_date"`         // hire_date
	Address         sql.NullString `json:"address"`           // address
	City            sql.NullString `json:"city"`              // city
	Region          sql.NullString `json:"region"`            // region
	PostalCode      sql.NullString `json:"postal_code"`       // postal_code
	Country         sql.NullString `json:"country"`           // country
	HomePhone       sql.NullString `json:"home_phone"`        // home_phone
	Extension       sql.NullString `json:"extension"`         // extension
	Photo           []byte         `json:"photo"`             // photo
	Notes           sql.NullString `json:"notes"`             // notes
	ReportsTo       sql.NullInt64  `json:"reports_to"`        // reports_to
	PhotoPath       sql.NullString `json:"photo_path"`        // photo_path
	// contains filtered or unexported fields
}

Employee represents a row from 'public.employees'.

func EmployeeByEmployeeID

func EmployeeByEmployeeID(ctx context.Context, db DB, employeeID int) (*Employee, error)

EmployeeByEmployeeID retrieves a row from 'public.employees' as a Employee.

Generated from index 'employees_pkey'.

func (*Employee) Delete

func (e *Employee) Delete(ctx context.Context, db DB) error

Delete deletes the Employee from the database.

func (*Employee) Deleted

func (e *Employee) Deleted() bool

Deleted returns true when the Employee has been marked for deletion from the database.

func (*Employee) Employee

func (e *Employee) Employee(ctx context.Context, db DB) (*Employee, error)

Employee returns the Employee associated with the Employee's (ReportsTo).

Generated from foreign key 'employees_reports_to_fkey'.

func (*Employee) Exists

func (e *Employee) Exists() bool

Exists returns true when the Employee exists in the database.

func (*Employee) Insert

func (e *Employee) Insert(ctx context.Context, db DB) error

Insert inserts the Employee to the database.

func (*Employee) Save

func (e *Employee) Save(ctx context.Context, db DB) error

Save saves the Employee to the database.

func (*Employee) Update

func (e *Employee) Update(ctx context.Context, db DB) error

Update updates a Employee in the database.

func (*Employee) Upsert

func (e *Employee) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Employee.

type EmployeeTerritory

type EmployeeTerritory struct {
	EmployeeID  int    `json:"employee_id"`  // employee_id
	TerritoryID string `json:"territory_id"` // territory_id
	// contains filtered or unexported fields
}

EmployeeTerritory represents a row from 'public.employee_territories'.

func EmployeeTerritoryByEmployeeIDTerritoryID

func EmployeeTerritoryByEmployeeIDTerritoryID(ctx context.Context, db DB, employeeID int, territoryID string) (*EmployeeTerritory, error)

EmployeeTerritoryByEmployeeIDTerritoryID retrieves a row from 'public.employee_territories' as a EmployeeTerritory.

Generated from index 'employee_territories_pkey'.

func (*EmployeeTerritory) Delete

func (et *EmployeeTerritory) Delete(ctx context.Context, db DB) error

Delete deletes the EmployeeTerritory from the database.

func (*EmployeeTerritory) Deleted

func (et *EmployeeTerritory) Deleted() bool

Deleted returns true when the EmployeeTerritory has been marked for deletion from the database.

func (*EmployeeTerritory) Employee

func (et *EmployeeTerritory) Employee(ctx context.Context, db DB) (*Employee, error)

Employee returns the Employee associated with the EmployeeTerritory's (EmployeeID).

Generated from foreign key 'employee_territories_employee_id_fkey'.

func (*EmployeeTerritory) Exists

func (et *EmployeeTerritory) Exists() bool

Exists returns true when the EmployeeTerritory exists in the database.

func (*EmployeeTerritory) Insert

func (et *EmployeeTerritory) Insert(ctx context.Context, db DB) error

Insert inserts the EmployeeTerritory to the database.

func (*EmployeeTerritory) Territory

func (et *EmployeeTerritory) Territory(ctx context.Context, db DB) (*Territory, error)

Territory returns the Territory associated with the EmployeeTerritory's (TerritoryID).

Generated from foreign key 'employee_territories_territory_id_fkey'.

type ErrInsertFailed

type ErrInsertFailed struct {
	Err error
}

ErrInsertFailed is the insert failed error.

func (*ErrInsertFailed) Error

func (err *ErrInsertFailed) Error() string

Error satisfies the error interface.

func (*ErrInsertFailed) Unwrap

func (err *ErrInsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrUpdateFailed

type ErrUpdateFailed struct {
	Err error
}

ErrUpdateFailed is the update failed error.

func (*ErrUpdateFailed) Error

func (err *ErrUpdateFailed) Error() string

Error satisfies the error interface.

func (*ErrUpdateFailed) Unwrap

func (err *ErrUpdateFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type ErrUpsertFailed

type ErrUpsertFailed struct {
	Err error
}

ErrUpsertFailed is the upsert failed error.

func (*ErrUpsertFailed) Error

func (err *ErrUpsertFailed) Error() string

Error satisfies the error interface.

func (*ErrUpsertFailed) Unwrap

func (err *ErrUpsertFailed) Unwrap() error

Unwrap satisfies the unwrap interface.

type Error

type Error string

Error is an error.

const (
	// ErrAlreadyExists is the already exists error.
	ErrAlreadyExists Error = "already exists"
	// ErrDoesNotExist is the does not exist error.
	ErrDoesNotExist Error = "does not exist"
	// ErrMarkedForDeletion is the marked for deletion error.
	ErrMarkedForDeletion Error = "marked for deletion"
)

Error values.

func (Error) Error

func (err Error) Error() string

Error satisfies the error interface.

type Order

type Order struct {
	OrderID        int             `json:"order_id"`         // order_id
	CustomerID     sql.NullString  `json:"customer_id"`      // customer_id
	EmployeeID     sql.NullInt64   `json:"employee_id"`      // employee_id
	OrderDate      sql.NullTime    `json:"order_date"`       // order_date
	RequiredDate   sql.NullTime    `json:"required_date"`    // required_date
	ShippedDate    sql.NullTime    `json:"shipped_date"`     // shipped_date
	ShipVia        sql.NullInt64   `json:"ship_via"`         // ship_via
	Freight        sql.NullFloat64 `json:"freight"`          // freight
	ShipName       sql.NullString  `json:"ship_name"`        // ship_name
	ShipAddress    sql.NullString  `json:"ship_address"`     // ship_address
	ShipCity       sql.NullString  `json:"ship_city"`        // ship_city
	ShipRegion     sql.NullString  `json:"ship_region"`      // ship_region
	ShipPostalCode sql.NullString  `json:"ship_postal_code"` // ship_postal_code
	ShipCountry    sql.NullString  `json:"ship_country"`     // ship_country
	// contains filtered or unexported fields
}

Order represents a row from 'public.orders'.

func OrderByOrderID

func OrderByOrderID(ctx context.Context, db DB, orderID int) (*Order, error)

OrderByOrderID retrieves a row from 'public.orders' as a Order.

Generated from index 'orders_pkey'.

func (*Order) Customer

func (o *Order) Customer(ctx context.Context, db DB) (*Customer, error)

Customer returns the Customer associated with the Order's (CustomerID).

Generated from foreign key 'orders_customer_id_fkey'.

func (*Order) Delete

func (o *Order) Delete(ctx context.Context, db DB) error

Delete deletes the Order from the database.

func (*Order) Deleted

func (o *Order) Deleted() bool

Deleted returns true when the Order has been marked for deletion from the database.

func (*Order) Employee

func (o *Order) Employee(ctx context.Context, db DB) (*Employee, error)

Employee returns the Employee associated with the Order's (EmployeeID).

Generated from foreign key 'orders_employee_id_fkey'.

func (*Order) Exists

func (o *Order) Exists() bool

Exists returns true when the Order exists in the database.

func (*Order) Insert

func (o *Order) Insert(ctx context.Context, db DB) error

Insert inserts the Order to the database.

func (*Order) Save

func (o *Order) Save(ctx context.Context, db DB) error

Save saves the Order to the database.

func (*Order) Shipper

func (o *Order) Shipper(ctx context.Context, db DB) (*Shipper, error)

Shipper returns the Shipper associated with the Order's (ShipVia).

Generated from foreign key 'orders_ship_via_fkey'.

func (*Order) Update

func (o *Order) Update(ctx context.Context, db DB) error

Update updates a Order in the database.

func (*Order) Upsert

func (o *Order) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Order.

type OrderDetail

type OrderDetail struct {
	OrderID   int     `json:"order_id"`   // order_id
	ProductID int     `json:"product_id"` // product_id
	UnitPrice float32 `json:"unit_price"` // unit_price
	Quantity  int     `json:"quantity"`   // quantity
	Discount  float32 `json:"discount"`   // discount
	// contains filtered or unexported fields
}

OrderDetail represents a row from 'public.order_details'.

func OrderDetailByOrderIDProductID

func OrderDetailByOrderIDProductID(ctx context.Context, db DB, orderID, productID int) (*OrderDetail, error)

OrderDetailByOrderIDProductID retrieves a row from 'public.order_details' as a OrderDetail.

Generated from index 'order_details_pkey'.

func (*OrderDetail) Delete

func (od *OrderDetail) Delete(ctx context.Context, db DB) error

Delete deletes the OrderDetail from the database.

func (*OrderDetail) Deleted

func (od *OrderDetail) Deleted() bool

Deleted returns true when the OrderDetail has been marked for deletion from the database.

func (*OrderDetail) Exists

func (od *OrderDetail) Exists() bool

Exists returns true when the OrderDetail exists in the database.

func (*OrderDetail) Insert

func (od *OrderDetail) Insert(ctx context.Context, db DB) error

Insert inserts the OrderDetail to the database.

func (*OrderDetail) Order

func (od *OrderDetail) Order(ctx context.Context, db DB) (*Order, error)

Order returns the Order associated with the OrderDetail's (OrderID).

Generated from foreign key 'order_details_order_id_fkey'.

func (*OrderDetail) Product

func (od *OrderDetail) Product(ctx context.Context, db DB) (*Product, error)

Product returns the Product associated with the OrderDetail's (ProductID).

Generated from foreign key 'order_details_product_id_fkey'.

func (*OrderDetail) Save

func (od *OrderDetail) Save(ctx context.Context, db DB) error

Save saves the OrderDetail to the database.

func (*OrderDetail) Update

func (od *OrderDetail) Update(ctx context.Context, db DB) error

Update updates a OrderDetail in the database.

func (*OrderDetail) Upsert

func (od *OrderDetail) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for OrderDetail.

type Product

type Product struct {
	ProductID       int             `json:"product_id"`        // product_id
	ProductName     string          `json:"product_name"`      // product_name
	SupplierID      sql.NullInt64   `json:"supplier_id"`       // supplier_id
	CategoryID      sql.NullInt64   `json:"category_id"`       // category_id
	QuantityPerUnit sql.NullString  `json:"quantity_per_unit"` // quantity_per_unit
	UnitPrice       sql.NullFloat64 `json:"unit_price"`        // unit_price
	UnitsInStock    sql.NullInt64   `json:"units_in_stock"`    // units_in_stock
	UnitsOnOrder    sql.NullInt64   `json:"units_on_order"`    // units_on_order
	ReorderLevel    sql.NullInt64   `json:"reorder_level"`     // reorder_level
	Discontinued    int             `json:"discontinued"`      // discontinued
	// contains filtered or unexported fields
}

Product represents a row from 'public.products'.

func ProductByProductID

func ProductByProductID(ctx context.Context, db DB, productID int) (*Product, error)

ProductByProductID retrieves a row from 'public.products' as a Product.

Generated from index 'products_pkey'.

func (*Product) Category

func (p *Product) Category(ctx context.Context, db DB) (*Category, error)

Category returns the Category associated with the Product's (CategoryID).

Generated from foreign key 'products_category_id_fkey'.

func (*Product) Delete

func (p *Product) Delete(ctx context.Context, db DB) error

Delete deletes the Product from the database.

func (*Product) Deleted

func (p *Product) Deleted() bool

Deleted returns true when the Product has been marked for deletion from the database.

func (*Product) Exists

func (p *Product) Exists() bool

Exists returns true when the Product exists in the database.

func (*Product) Insert

func (p *Product) Insert(ctx context.Context, db DB) error

Insert inserts the Product to the database.

func (*Product) Save

func (p *Product) Save(ctx context.Context, db DB) error

Save saves the Product to the database.

func (*Product) Supplier

func (p *Product) Supplier(ctx context.Context, db DB) (*Supplier, error)

Supplier returns the Supplier associated with the Product's (SupplierID).

Generated from foreign key 'products_supplier_id_fkey'.

func (*Product) Update

func (p *Product) Update(ctx context.Context, db DB) error

Update updates a Product in the database.

func (*Product) Upsert

func (p *Product) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Product.

type Region

type Region struct {
	RegionID          int    `json:"region_id"`          // region_id
	RegionDescription string `json:"region_description"` // region_description
	// contains filtered or unexported fields
}

Region represents a row from 'public.region'.

func RegionByRegionID

func RegionByRegionID(ctx context.Context, db DB, regionID int) (*Region, error)

RegionByRegionID retrieves a row from 'public.region' as a Region.

Generated from index 'region_pkey'.

func (*Region) Delete

func (r *Region) Delete(ctx context.Context, db DB) error

Delete deletes the Region from the database.

func (*Region) Deleted

func (r *Region) Deleted() bool

Deleted returns true when the Region has been marked for deletion from the database.

func (*Region) Exists

func (r *Region) Exists() bool

Exists returns true when the Region exists in the database.

func (*Region) Insert

func (r *Region) Insert(ctx context.Context, db DB) error

Insert inserts the Region to the database.

func (*Region) Save

func (r *Region) Save(ctx context.Context, db DB) error

Save saves the Region to the database.

func (*Region) Update

func (r *Region) Update(ctx context.Context, db DB) error

Update updates a Region in the database.

func (*Region) Upsert

func (r *Region) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Region.

type Shipper

type Shipper struct {
	ShipperID   int            `json:"shipper_id"`   // shipper_id
	CompanyName string         `json:"company_name"` // company_name
	Phone       sql.NullString `json:"phone"`        // phone
	// contains filtered or unexported fields
}

Shipper represents a row from 'public.shippers'.

func ShipperByShipperID

func ShipperByShipperID(ctx context.Context, db DB, shipperID int) (*Shipper, error)

ShipperByShipperID retrieves a row from 'public.shippers' as a Shipper.

Generated from index 'shippers_pkey'.

func (*Shipper) Delete

func (s *Shipper) Delete(ctx context.Context, db DB) error

Delete deletes the Shipper from the database.

func (*Shipper) Deleted

func (s *Shipper) Deleted() bool

Deleted returns true when the Shipper has been marked for deletion from the database.

func (*Shipper) Exists

func (s *Shipper) Exists() bool

Exists returns true when the Shipper exists in the database.

func (*Shipper) Insert

func (s *Shipper) Insert(ctx context.Context, db DB) error

Insert inserts the Shipper to the database.

func (*Shipper) Save

func (s *Shipper) Save(ctx context.Context, db DB) error

Save saves the Shipper to the database.

func (*Shipper) Update

func (s *Shipper) Update(ctx context.Context, db DB) error

Update updates a Shipper in the database.

func (*Shipper) Upsert

func (s *Shipper) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Shipper.

type Supplier

type Supplier struct {
	SupplierID   int            `json:"supplier_id"`   // supplier_id
	CompanyName  string         `json:"company_name"`  // company_name
	ContactName  sql.NullString `json:"contact_name"`  // contact_name
	ContactTitle sql.NullString `json:"contact_title"` // contact_title
	Address      sql.NullString `json:"address"`       // address
	City         sql.NullString `json:"city"`          // city
	Region       sql.NullString `json:"region"`        // region
	PostalCode   sql.NullString `json:"postal_code"`   // postal_code
	Country      sql.NullString `json:"country"`       // country
	Phone        sql.NullString `json:"phone"`         // phone
	Fax          sql.NullString `json:"fax"`           // fax
	Homepage     sql.NullString `json:"homepage"`      // homepage
	// contains filtered or unexported fields
}

Supplier represents a row from 'public.suppliers'.

func SupplierBySupplierID

func SupplierBySupplierID(ctx context.Context, db DB, supplierID int) (*Supplier, error)

SupplierBySupplierID retrieves a row from 'public.suppliers' as a Supplier.

Generated from index 'suppliers_pkey'.

func (*Supplier) Delete

func (s *Supplier) Delete(ctx context.Context, db DB) error

Delete deletes the Supplier from the database.

func (*Supplier) Deleted

func (s *Supplier) Deleted() bool

Deleted returns true when the Supplier has been marked for deletion from the database.

func (*Supplier) Exists

func (s *Supplier) Exists() bool

Exists returns true when the Supplier exists in the database.

func (*Supplier) Insert

func (s *Supplier) Insert(ctx context.Context, db DB) error

Insert inserts the Supplier to the database.

func (*Supplier) Save

func (s *Supplier) Save(ctx context.Context, db DB) error

Save saves the Supplier to the database.

func (*Supplier) Update

func (s *Supplier) Update(ctx context.Context, db DB) error

Update updates a Supplier in the database.

func (*Supplier) Upsert

func (s *Supplier) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Supplier.

type Territory

type Territory struct {
	TerritoryID          string `json:"territory_id"`          // territory_id
	TerritoryDescription string `json:"territory_description"` // territory_description
	RegionID             int    `json:"region_id"`             // region_id
	// contains filtered or unexported fields
}

Territory represents a row from 'public.territories'.

func TerritoryByTerritoryID

func TerritoryByTerritoryID(ctx context.Context, db DB, territoryID string) (*Territory, error)

TerritoryByTerritoryID retrieves a row from 'public.territories' as a Territory.

Generated from index 'territories_pkey'.

func (*Territory) Delete

func (t *Territory) Delete(ctx context.Context, db DB) error

Delete deletes the Territory from the database.

func (*Territory) Deleted

func (t *Territory) Deleted() bool

Deleted returns true when the Territory has been marked for deletion from the database.

func (*Territory) Exists

func (t *Territory) Exists() bool

Exists returns true when the Territory exists in the database.

func (*Territory) Insert

func (t *Territory) Insert(ctx context.Context, db DB) error

Insert inserts the Territory to the database.

func (*Territory) Region

func (t *Territory) Region(ctx context.Context, db DB) (*Region, error)

Region returns the Region associated with the Territory's (RegionID).

Generated from foreign key 'territories_region_id_fkey'.

func (*Territory) Save

func (t *Territory) Save(ctx context.Context, db DB) error

Save saves the Territory to the database.

func (*Territory) Update

func (t *Territory) Update(ctx context.Context, db DB) error

Update updates a Territory in the database.

func (*Territory) Upsert

func (t *Territory) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for Territory.

type UsState

type UsState struct {
	StateID     int            `json:"state_id"`     // state_id
	StateName   sql.NullString `json:"state_name"`   // state_name
	StateAbbr   sql.NullString `json:"state_abbr"`   // state_abbr
	StateRegion sql.NullString `json:"state_region"` // state_region
	// contains filtered or unexported fields
}

UsState represents a row from 'public.us_states'.

func UsStateByStateID

func UsStateByStateID(ctx context.Context, db DB, stateID int) (*UsState, error)

UsStateByStateID retrieves a row from 'public.us_states' as a UsState.

Generated from index 'us_states_pkey'.

func (*UsState) Delete

func (us *UsState) Delete(ctx context.Context, db DB) error

Delete deletes the UsState from the database.

func (*UsState) Deleted

func (us *UsState) Deleted() bool

Deleted returns true when the UsState has been marked for deletion from the database.

func (*UsState) Exists

func (us *UsState) Exists() bool

Exists returns true when the UsState exists in the database.

func (*UsState) Insert

func (us *UsState) Insert(ctx context.Context, db DB) error

Insert inserts the UsState to the database.

func (*UsState) Save

func (us *UsState) Save(ctx context.Context, db DB) error

Save saves the UsState to the database.

func (*UsState) Update

func (us *UsState) Update(ctx context.Context, db DB) error

Update updates a UsState in the database.

func (*UsState) Upsert

func (us *UsState) Upsert(ctx context.Context, db DB) error

Upsert performs an upsert for UsState.

Jump to

Keyboard shortcuts

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