|
| 1 | +package main |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/folospace/go-mysql-orm/orm" |
| 5 | + "testing" |
| 6 | + "time" |
| 7 | +) |
| 8 | + |
| 9 | +type Family struct { |
| 10 | + RfamAcc string `json:"rfam_acc" orm:"rfam_acc,varchar(7),primary,unique"` |
| 11 | + RfamId string `json:"rfam_id" orm:"rfam_id,varchar(40),index"` |
| 12 | + AutoWiki uint `json:"auto_wiki" orm:"auto_wiki,int(10) unsigned,index"` |
| 13 | + Description *string `json:"description" orm:"description,varchar(75),null" default:"NULL"` |
| 14 | + Author *string `json:"author" orm:"author,tinytext,null"` |
| 15 | + SeedSource *string `json:"seed_source" orm:"seed_source,tinytext,null"` |
| 16 | + GatheringCutoff *float64 `json:"gathering_cutoff" orm:"gathering_cutoff,double(5,2),null" default:"NULL"` |
| 17 | + TrustedCutoff *float64 `json:"trusted_cutoff" orm:"trusted_cutoff,double(5,2),null" default:"NULL"` |
| 18 | + NoiseCutoff *float64 `json:"noise_cutoff" orm:"noise_cutoff,double(5,2),null" default:"NULL"` |
| 19 | + Comment *string `json:"comment" orm:"comment,longtext,null"` |
| 20 | + PreviousId *string `json:"previous_id" orm:"previous_id,tinytext,null"` |
| 21 | + Cmbuild *string `json:"cmbuild" orm:"cmbuild,tinytext,null"` |
| 22 | + Cmcalibrate *string `json:"cmcalibrate" orm:"cmcalibrate,tinytext,null"` |
| 23 | + Cmsearch *string `json:"cmsearch" orm:"cmsearch,tinytext,null"` |
| 24 | + NumSeed *int64 `json:"num_seed" orm:"num_seed,bigint(20),null" default:"NULL"` |
| 25 | + NumFull *int64 `json:"num_full" orm:"num_full,bigint(20),null" default:"NULL"` |
| 26 | + NumGenomeSeq *int64 `json:"num_genome_seq" orm:"num_genome_seq,bigint(20),null" default:"NULL"` |
| 27 | + NumRefseq *int64 `json:"num_refseq" orm:"num_refseq,bigint(20),null" default:"NULL"` |
| 28 | + Type *string `json:"type" orm:"type,varchar(50),null" default:"NULL"` |
| 29 | + StructureSource *string `json:"structure_source" orm:"structure_source,tinytext,null"` |
| 30 | + NumberOfSpecies *int64 `json:"number_of_species" orm:"number_of_species,bigint(20),null" default:"NULL"` |
| 31 | + Number3dStructures *int `json:"number_3d_structures" orm:"number_3d_structures,int(11),null" default:"NULL"` |
| 32 | + NumPseudonokts *int `json:"num_pseudonokts" orm:"num_pseudonokts,int(11),null" default:"NULL"` |
| 33 | + TaxSeed *string `json:"tax_seed" orm:"tax_seed,mediumtext,null"` |
| 34 | + EcmliLambda *float64 `json:"ecmli_lambda" orm:"ecmli_lambda,double(10,5),null" default:"NULL"` |
| 35 | + EcmliMu *float64 `json:"ecmli_mu" orm:"ecmli_mu,double(10,5),null" default:"NULL"` |
| 36 | + EcmliCalDb *int `json:"ecmli_cal_db" orm:"ecmli_cal_db,mediumint(9),null" default:"0"` |
| 37 | + EcmliCalHits *int `json:"ecmli_cal_hits" orm:"ecmli_cal_hits,mediumint(9),null" default:"0"` |
| 38 | + Maxl *int `json:"maxl" orm:"maxl,mediumint(9),null" default:"0"` |
| 39 | + Clen *int `json:"clen" orm:"clen,mediumint(9),null" default:"0"` |
| 40 | + MatchPairNode *int8 `json:"match_pair_node" orm:"match_pair_node,tinyint(1),null" default:"0"` |
| 41 | + HmmTau *float64 `json:"hmm_tau" orm:"hmm_tau,double(10,5),null" default:"NULL"` |
| 42 | + HmmLambda *float64 `json:"hmm_lambda" orm:"hmm_lambda,double(10,5),null" default:"NULL"` |
| 43 | + Created time.Time `json:"created" orm:"created,datetime"` |
| 44 | + Updated time.Time `json:"updated" orm:"updated,timestamp" default:"CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"` |
| 45 | +} |
| 46 | +type Family_2022_06_13_11_38_30 struct { |
| 47 | +} |
| 48 | + |
| 49 | +func (Family) TableName() string { |
| 50 | + return "family" |
| 51 | +} |
| 52 | + |
| 53 | +func (Family) DatabaseName() string { |
| 54 | + return "Rfam" |
| 55 | +} |
| 56 | + |
| 57 | +func TestMigrate(t *testing.T) { |
| 58 | + t.Run("create_struct", func(t *testing.T) { |
| 59 | + FamilyTable := orm.NewQuery(Family{}, tdb) |
| 60 | + |
| 61 | + err := orm.CreateStructFromTable(FamilyTable) |
| 62 | + |
| 63 | + t.Log(err) |
| 64 | + }) |
| 65 | +} |
0 commit comments