Documentation ¶
Overview ¶
Package types defines some Go structs to use as models and destinations while testing and benchmarking sqlh.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddressRecords []*Address
AddressRecords is initialized when importing the package.
View Source
var AddressTableName = "sqlh_addresses"
Model table names.
View Source
var SaleRecords []*SaleReport
SaleRecords is initialized when importing the package.
View Source
var SizeAddressRecords int
View Source
var SizeSaleRecords int
Functions ¶
Types ¶
type Address ¶
type Address struct { Id int `json:"id" db:"pk" model:"key,auto" gorm:"column:pk;primaryKey"` CreatedTime Time `json:"created_time" db:"created_tmz" model:"inserted" gorm:"-"` ModifiedTime Time `json:"modified_time" db:"modified_tmz" model:"inserted,updated" gorm:"-"` Street string `json:"street"` City string `json:"city"` State string `json:"state"` Zip string `json:"zip"` // contains filtered or unexported fields }
Address model to represent an address.
Methods like Pop, Push, PreInsert, TestInsert, and TestUpdate are present to simplify test code and are not required by the model package.
func (*Address) PostInsert ¶
func (*Address) PostUpdate ¶
type MockRows ¶
type MockRows interface {
MockRows(int) *sqlmock.Rows
}
MockRows is the interface for mocking rows.
type SaleReport ¶
type SaleReport struct { Id int `json:"id" db:"pk"` CreatedTime string `json:"created_time" db:"created_tmz"` ModifiedTime string `json:"modified_time" db:"modified_tmz"` Price int `json:"price" db:"price"` Quantity int `json:"quantity" db:"quantity"` Total int `json:"total" db:"total"` CustomerId int `json:"customer_id" db:"customer_id"` CustomerFirst string `json:"customer_first" db:"customer_first"` CustomerLast string `json:"customer_last" db:"customer_last"` VendorId int `json:"vendor_id" db:"vendor_id"` VendorName string `json:"vendor_name" db:"vendor_name"` VendorDescription string `json:"vendor_description" db:"vendor_description"` VendorContactId int `json:"vendor_contact_id" db:"vendor_contact_id"` VendorContactFirst string `json:"vendor_contact_first" db:"vendor_contact_first"` VendorContactLast string `json:"vendor_contact_last" db:"vendor_contact_last"` }
SaleReport is a SELECT destination; it does not represent models.
func (*SaleReport) MockRows ¶
func (me *SaleReport) MockRows(n int) *sqlmock.Rows
type TestModel ¶
type TestModel interface { PreInsert(b *testing.B) PostInsert(b *testing.B) PreUpdate(b *testing.B) PostUpdate(b *testing.B) }
TestModel represents models that we test. By implementing this interface our test code can be more uniform.
Click to show internal directories.
Click to hide internal directories.