Using struct attrs to match desired db schema

This commit is contained in:
Matthew Dillon 2014-10-16 09:20:25 -08:00
parent 7fe5566edf
commit 7e74d672ba
6 changed files with 27 additions and 27 deletions

View file

@ -12,10 +12,10 @@ import (
// A Genus is a high-level classifier in bactdb.
type Genus struct {
Id int64 `json:"id,omitempty"`
GenusName string `json:"genus_name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
GenusName string `db:"genus_name" json:"genus_name"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
DeletedAt time.Time `db:"deleted_at" json:"deleted_at"`
}
// GeneraService interacts with the genus-related endpoints in bactdb's API.

View file

@ -12,11 +12,11 @@ import (
// A Species is a high-level classifier in bactdb.
type Species struct {
Id int64 `json:"id,omitempty"`
GenusId int64 `json:"genus_id"`
SpeciesName string `json:"species_name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
GenusId int64 `db:"genus_id" json:"genus_id"`
SpeciesName string `db:"species_name" json:"species_name"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
DeletedAt time.Time `db:"deleted_at" json:"deleted_at"`
}
// SpeciesService interacts with the species-related endpoints in bactdb's API.

View file

@ -12,10 +12,10 @@ import (
// A User is a person that has administrative access to bactdb.
type User struct {
Id int64 `json:"id,omitempty"`
UserName string `sql:"size:100" json:"user_name"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
UserName string `json:"user_name"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
DeletedAt time.Time `db:"deleted_at" json:"deleted_at"`
}
// UsersService interacts with the user-related endpoints in bactdb's API.