Skip to content

Instantly share code, notes, and snippets.

@dvliman
Created February 16, 2016 06:11
Show Gist options
  • Save dvliman/448867992e32587c96d1 to your computer and use it in GitHub Desktop.
Save dvliman/448867992e32587c96d1 to your computer and use it in GitHub Desktop.
type Item struct {
Id int `json:"id" db:"id"`
Maker string `json:"maker" db:"maker"` // komatsu, hitachi; fixed
Model string `json:"model" db:"model"` // SK815; non unique
Serial string `json:"serial" db:"serial"` // 37BF00l74; unique
Kind string `json:"kind" db:"kind"` // forklift, loader, crane
Year int `json:"year" db:"year"` // 1988
Description string `json:"description" db:"description"`
Buy int `json:"buy" db:"buy"`
Sell int `json:"sell" db:"sell"`
// 'Images' and 'Costs' fields are here for json serialization
// we don't store full version or partial version (by _id) of these objects
// to db since it is really hard to use array on postgres and/or
// dealing with deserializing sql.NullString
Images []Image `json:"images"`
Costs []Cost `json:"costs"`
Created time.Time `json:"created" db:"created"`
Updated time.Time `json:"updated" db:"updated"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment