Importing data, realized need to handle NULLs.
This commit is contained in:
parent
df95dfc930
commit
58344b82a5
4 changed files with 33 additions and 25 deletions
|
@ -3,9 +3,9 @@
|
|||
|
||||
CREATE TABLE strains (
|
||||
id BIGSERIAL NOT NULL,
|
||||
species_id BIGINT,
|
||||
strain_name CHARACTER VARYING(100),
|
||||
strain_type CHARACTER VARYING(100),
|
||||
species_id BIGINT NOT NULL,
|
||||
strain_name CHARACTER VARYING(100) NOT NULL,
|
||||
strain_type CHARACTER VARYING(100) NOT NULL,
|
||||
etymology CHARACTER VARYING(500),
|
||||
accession_banks CHARACTER VARYING(100),
|
||||
genbank_embl_ddb CHARACTER VARYING(100),
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"github.com/thermokarst/bactdb/router"
|
||||
)
|
||||
|
||||
|
@ -15,7 +16,7 @@ type Genus struct {
|
|||
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"`
|
||||
DeletedAt pq.NullTime `db:"deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
func NewGenus() *Genus {
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"github.com/thermokarst/bactdb/router"
|
||||
)
|
||||
|
||||
|
@ -16,7 +17,7 @@ type Species struct {
|
|||
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"`
|
||||
DeletedAt pq.NullTime `db:"deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
func NewSpecies() *Species {
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
"github.com/thermokarst/bactdb/router"
|
||||
)
|
||||
|
||||
|
@ -20,11 +21,16 @@ type Strain struct {
|
|||
GenbankEmblDdb string `db:"genbank_embl_ddb" json:"genbank_embl_ddb"`
|
||||
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"`
|
||||
DeletedAt pq.NullTime `db:"deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
func NewStrain() *Strain {
|
||||
return &Strain{StrainName: "Test Strain", StrainType: "Test Type", Etymology: "Test Etymology", AccessionBanks: "Test Accession", GenbankEmblDdb: "Test Genbank"}
|
||||
return &Strain{
|
||||
StrainName: "Test Strain",
|
||||
StrainType: "Test Type",
|
||||
Etymology: "Test Etymology",
|
||||
AccessionBanks: "Test Accession",
|
||||
GenbankEmblDdb: "Test Genbank"}
|
||||
}
|
||||
|
||||
// StrainService interacts with the strain-related endpoints in bactdb's API
|
||||
|
|
Reference in a new issue