本文整理汇总了Golang中github.com/vattle/sqlboiler/strmangle.SetComplement函数的典型用法代码示例。如果您正苦于以下问题:Golang SetComplement函数的具体用法?Golang SetComplement怎么用?Golang SetComplement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetComplement函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: testOrganismOneToOneSetOpJbrowseOrganismUsingJbrowseOrganism
func testOrganismOneToOneSetOpJbrowseOrganismUsingJbrowseOrganism(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Organism
var b, c JbrowseOrganism
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, organismDBTypes, false, strmangle.SetComplement(organismPrimaryKeyColumns, organismColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, jbrowseOrganismDBTypes, false, strmangle.SetComplement(jbrowseOrganismPrimaryKeyColumns, jbrowseOrganismColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, jbrowseOrganismDBTypes, false, strmangle.SetComplement(jbrowseOrganismPrimaryKeyColumns, jbrowseOrganismColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*JbrowseOrganism{&b, &c} {
err = a.SetJbrowseOrganism(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.JbrowseOrganism != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Organism != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.OrganismID != x.OrganismID {
t.Error("foreign key was wrong value", a.OrganismID)
}
zero := reflect.Zero(reflect.TypeOf(x.OrganismID))
reflect.Indirect(reflect.ValueOf(&x.OrganismID)).Set(zero)
if err = x.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.OrganismID != x.OrganismID {
t.Error("foreign key was wrong value", a.OrganismID, x.OrganismID)
}
if err = x.Delete(tx); err != nil {
t.Fatal("failed to delete x", err)
}
}
}
示例2: testFeatureCvtermOneToOneSetOpFeatureCvtermPubUsingFeatureCvtermPub
func testFeatureCvtermOneToOneSetOpFeatureCvtermPubUsingFeatureCvtermPub(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a FeatureCvterm
var b, c FeatureCvtermPub
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, featureCvtermDBTypes, false, strmangle.SetComplement(featureCvtermPrimaryKeyColumns, featureCvtermColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, featureCvtermPubDBTypes, false, strmangle.SetComplement(featureCvtermPubPrimaryKeyColumns, featureCvtermPubColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, featureCvtermPubDBTypes, false, strmangle.SetComplement(featureCvtermPubPrimaryKeyColumns, featureCvtermPubColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*FeatureCvtermPub{&b, &c} {
err = a.SetFeatureCvtermPub(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.FeatureCvtermPub != x {
t.Error("relationship struct not set to correct value")
}
if x.R.FeatureCvterm != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.FeatureCvtermID != x.FeatureCvtermID {
t.Error("foreign key was wrong value", a.FeatureCvtermID)
}
zero := reflect.Zero(reflect.TypeOf(x.FeatureCvtermID))
reflect.Indirect(reflect.ValueOf(&x.FeatureCvtermID)).Set(zero)
if err = x.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.FeatureCvtermID != x.FeatureCvtermID {
t.Error("foreign key was wrong value", a.FeatureCvtermID, x.FeatureCvtermID)
}
if err = x.Delete(tx); err != nil {
t.Fatal("failed to delete x", err)
}
}
}
示例3: testStockDbxrefOneToOneSetOpStockDbxrefpropUsingStockDbxrefprop
func testStockDbxrefOneToOneSetOpStockDbxrefpropUsingStockDbxrefprop(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a StockDbxref
var b, c StockDbxrefprop
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, stockDbxrefDBTypes, false, strmangle.SetComplement(stockDbxrefPrimaryKeyColumns, stockDbxrefColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, stockDbxrefpropDBTypes, false, strmangle.SetComplement(stockDbxrefpropPrimaryKeyColumns, stockDbxrefpropColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, stockDbxrefpropDBTypes, false, strmangle.SetComplement(stockDbxrefpropPrimaryKeyColumns, stockDbxrefpropColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*StockDbxrefprop{&b, &c} {
err = a.SetStockDbxrefprop(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.StockDbxrefprop != x {
t.Error("relationship struct not set to correct value")
}
if x.R.StockDbxref != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.StockDbxrefID != x.StockDbxrefID {
t.Error("foreign key was wrong value", a.StockDbxrefID)
}
zero := reflect.Zero(reflect.TypeOf(x.StockDbxrefID))
reflect.Indirect(reflect.ValueOf(&x.StockDbxrefID)).Set(zero)
if err = x.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.StockDbxrefID != x.StockDbxrefID {
t.Error("foreign key was wrong value", a.StockDbxrefID, x.StockDbxrefID)
}
if err = x.Delete(tx); err != nil {
t.Fatal("failed to delete x", err)
}
}
}
示例4: testAuthRoleOneToOneSetOpAuthRolePermissionUsingAuthRolePermission
func testAuthRoleOneToOneSetOpAuthRolePermissionUsingAuthRolePermission(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a AuthRole
var b, c AuthRolePermission
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, authRoleDBTypes, false, strmangle.SetComplement(authRolePrimaryKeyColumns, authRoleColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, authRolePermissionDBTypes, false, strmangle.SetComplement(authRolePermissionPrimaryKeyColumns, authRolePermissionColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, authRolePermissionDBTypes, false, strmangle.SetComplement(authRolePermissionPrimaryKeyColumns, authRolePermissionColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*AuthRolePermission{&b, &c} {
err = a.SetAuthRolePermission(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.AuthRolePermission != x {
t.Error("relationship struct not set to correct value")
}
if x.R.AuthRole != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.AuthRoleID != x.AuthRoleID {
t.Error("foreign key was wrong value", a.AuthRoleID)
}
zero := reflect.Zero(reflect.TypeOf(x.AuthRoleID))
reflect.Indirect(reflect.ValueOf(&x.AuthRoleID)).Set(zero)
if err = x.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.AuthRoleID != x.AuthRoleID {
t.Error("foreign key was wrong value", a.AuthRoleID, x.AuthRoleID)
}
if err = x.Delete(tx); err != nil {
t.Fatal("failed to delete x", err)
}
}
}
示例5: testGenotypeOneToOneSetOpPhenstatementUsingPhenstatement
func testGenotypeOneToOneSetOpPhenstatementUsingPhenstatement(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Genotype
var b, c Phenstatement
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, genotypeDBTypes, false, strmangle.SetComplement(genotypePrimaryKeyColumns, genotypeColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, phenstatementDBTypes, false, strmangle.SetComplement(phenstatementPrimaryKeyColumns, phenstatementColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, phenstatementDBTypes, false, strmangle.SetComplement(phenstatementPrimaryKeyColumns, phenstatementColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Phenstatement{&b, &c} {
err = a.SetPhenstatement(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Phenstatement != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Genotype != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.GenotypeID != x.GenotypeID {
t.Error("foreign key was wrong value", a.GenotypeID)
}
zero := reflect.Zero(reflect.TypeOf(x.GenotypeID))
reflect.Indirect(reflect.ValueOf(&x.GenotypeID)).Set(zero)
if err = x.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.GenotypeID != x.GenotypeID {
t.Error("foreign key was wrong value", a.GenotypeID, x.GenotypeID)
}
if err = x.Delete(tx); err != nil {
t.Fatal("failed to delete x", err)
}
}
}
示例6: testFeatureGenotypeToOneSetOpFeatureUsingChromosome
func testFeatureGenotypeToOneSetOpFeatureUsingChromosome(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a FeatureGenotype
var b, c Feature
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, featureGenotypeDBTypes, false, strmangle.SetComplement(featureGenotypePrimaryKeyColumns, featureGenotypeColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, featureDBTypes, false, strmangle.SetComplement(featurePrimaryKeyColumns, featureColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, featureDBTypes, false, strmangle.SetComplement(featurePrimaryKeyColumns, featureColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Feature{&b, &c} {
err = a.SetChromosome(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Chromosome != x {
t.Error("relationship struct not set to correct value")
}
if x.R.ChromosomeFeatureGenotype != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.ChromosomeID.Int != x.FeatureID {
t.Error("foreign key was wrong value", a.ChromosomeID.Int)
}
zero := reflect.Zero(reflect.TypeOf(a.ChromosomeID.Int))
reflect.Indirect(reflect.ValueOf(&a.ChromosomeID.Int)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.ChromosomeID.Int != x.FeatureID {
t.Error("foreign key was wrong value", a.ChromosomeID.Int, x.FeatureID)
}
}
}
示例7: testPubauthorToOneSetOpPubUsingPub
func testPubauthorToOneSetOpPubUsingPub(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Pubauthor
var b, c Pub
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, pubauthorDBTypes, false, strmangle.SetComplement(pubauthorPrimaryKeyColumns, pubauthorColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, pubDBTypes, false, strmangle.SetComplement(pubPrimaryKeyColumns, pubColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, pubDBTypes, false, strmangle.SetComplement(pubPrimaryKeyColumns, pubColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Pub{&b, &c} {
err = a.SetPub(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Pub != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Pubauthor != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.PubID != x.PubID {
t.Error("foreign key was wrong value", a.PubID)
}
zero := reflect.Zero(reflect.TypeOf(a.PubID))
reflect.Indirect(reflect.ValueOf(&a.PubID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.PubID != x.PubID {
t.Error("foreign key was wrong value", a.PubID, x.PubID)
}
}
}
示例8: testPhenotypeComparisonToOneSetOpPhenotypeUsingPhenotype2
func testPhenotypeComparisonToOneSetOpPhenotypeUsingPhenotype2(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a PhenotypeComparison
var b, c Phenotype
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, phenotypeComparisonDBTypes, false, strmangle.SetComplement(phenotypeComparisonPrimaryKeyColumns, phenotypeComparisonColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, phenotypeDBTypes, false, strmangle.SetComplement(phenotypePrimaryKeyColumns, phenotypeColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, phenotypeDBTypes, false, strmangle.SetComplement(phenotypePrimaryKeyColumns, phenotypeColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Phenotype{&b, &c} {
err = a.SetPhenotype2(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Phenotype2 != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Phenotype2PhenotypeComparisons[0] != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.Phenotype2ID.Int != x.PhenotypeID {
t.Error("foreign key was wrong value", a.Phenotype2ID.Int)
}
zero := reflect.Zero(reflect.TypeOf(a.Phenotype2ID.Int))
reflect.Indirect(reflect.ValueOf(&a.Phenotype2ID.Int)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.Phenotype2ID.Int != x.PhenotypeID {
t.Error("foreign key was wrong value", a.Phenotype2ID.Int, x.PhenotypeID)
}
}
}
示例9: testEnvironmentCvtermToOneSetOpEnvironmentUsingEnvironment
func testEnvironmentCvtermToOneSetOpEnvironmentUsingEnvironment(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a EnvironmentCvterm
var b, c Environment
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, environmentCvtermDBTypes, false, strmangle.SetComplement(environmentCvtermPrimaryKeyColumns, environmentCvtermColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, environmentDBTypes, false, strmangle.SetComplement(environmentPrimaryKeyColumns, environmentColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, environmentDBTypes, false, strmangle.SetComplement(environmentPrimaryKeyColumns, environmentColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Environment{&b, &c} {
err = a.SetEnvironment(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Environment != x {
t.Error("relationship struct not set to correct value")
}
if x.R.EnvironmentCvterm != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.EnvironmentID != x.EnvironmentID {
t.Error("foreign key was wrong value", a.EnvironmentID)
}
zero := reflect.Zero(reflect.TypeOf(a.EnvironmentID))
reflect.Indirect(reflect.ValueOf(&a.EnvironmentID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.EnvironmentID != x.EnvironmentID {
t.Error("foreign key was wrong value", a.EnvironmentID, x.EnvironmentID)
}
}
}
示例10: testContactRelationshipToOneSetOpContactUsingSubject
func testContactRelationshipToOneSetOpContactUsingSubject(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a ContactRelationship
var b, c Contact
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, contactRelationshipDBTypes, false, strmangle.SetComplement(contactRelationshipPrimaryKeyColumns, contactRelationshipColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, contactDBTypes, false, strmangle.SetComplement(contactPrimaryKeyColumns, contactColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, contactDBTypes, false, strmangle.SetComplement(contactPrimaryKeyColumns, contactColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Contact{&b, &c} {
err = a.SetSubject(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Subject != x {
t.Error("relationship struct not set to correct value")
}
if x.R.SubjectContactRelationship != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.SubjectID != x.ContactID {
t.Error("foreign key was wrong value", a.SubjectID)
}
zero := reflect.Zero(reflect.TypeOf(a.SubjectID))
reflect.Indirect(reflect.ValueOf(&a.SubjectID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.SubjectID != x.ContactID {
t.Error("foreign key was wrong value", a.SubjectID, x.ContactID)
}
}
}
示例11: testStockItemOrderToOneSetOpStockUsingItem
func testStockItemOrderToOneSetOpStockUsingItem(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a StockItemOrder
var b, c Stock
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, stockItemOrderDBTypes, false, strmangle.SetComplement(stockItemOrderPrimaryKeyColumns, stockItemOrderColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, stockDBTypes, false, strmangle.SetComplement(stockPrimaryKeyColumns, stockColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, stockDBTypes, false, strmangle.SetComplement(stockPrimaryKeyColumns, stockColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Stock{&b, &c} {
err = a.SetItem(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Item != x {
t.Error("relationship struct not set to correct value")
}
if x.R.ItemStockItemOrder != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.ItemID != x.StockID {
t.Error("foreign key was wrong value", a.ItemID)
}
zero := reflect.Zero(reflect.TypeOf(a.ItemID))
reflect.Indirect(reflect.ValueOf(&a.ItemID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.ItemID != x.StockID {
t.Error("foreign key was wrong value", a.ItemID, x.StockID)
}
}
}
示例12: testThumbnailToOneSetOpFileUsingFile
func testThumbnailToOneSetOpFileUsingFile(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Thumbnail
var b, c File
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, thumbnailDBTypes, false, strmangle.SetComplement(thumbnailPrimaryKeyColumns, thumbnailColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, fileDBTypes, false, strmangle.SetComplement(filePrimaryKeyColumns, fileColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, fileDBTypes, false, strmangle.SetComplement(filePrimaryKeyColumns, fileColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*File{&b, &c} {
err = a.SetFile(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.File != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Thumbnails[0] != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.FileID != x.ID {
t.Error("foreign key was wrong value", a.FileID)
}
zero := reflect.Zero(reflect.TypeOf(a.FileID))
reflect.Indirect(reflect.ValueOf(&a.FileID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.FileID != x.ID {
t.Error("foreign key was wrong value", a.FileID, x.ID)
}
}
}
示例13: testAnalysisfeaturepropToOneSetOpAnalysisfeatureUsingAnalysisfeature
func testAnalysisfeaturepropToOneSetOpAnalysisfeatureUsingAnalysisfeature(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Analysisfeatureprop
var b, c Analysisfeature
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, analysisfeaturepropDBTypes, false, strmangle.SetComplement(analysisfeaturepropPrimaryKeyColumns, analysisfeaturepropColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, analysisfeatureDBTypes, false, strmangle.SetComplement(analysisfeaturePrimaryKeyColumns, analysisfeatureColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, analysisfeatureDBTypes, false, strmangle.SetComplement(analysisfeaturePrimaryKeyColumns, analysisfeatureColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Analysisfeature{&b, &c} {
err = a.SetAnalysisfeature(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Analysisfeature != x {
t.Error("relationship struct not set to correct value")
}
if x.R.Analysisfeatureprop != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.AnalysisfeatureID != x.AnalysisfeatureID {
t.Error("foreign key was wrong value", a.AnalysisfeatureID)
}
zero := reflect.Zero(reflect.TypeOf(a.AnalysisfeatureID))
reflect.Indirect(reflect.ValueOf(&a.AnalysisfeatureID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.AnalysisfeatureID != x.AnalysisfeatureID {
t.Error("foreign key was wrong value", a.AnalysisfeatureID, x.AnalysisfeatureID)
}
}
}
示例14: testCvtermpathToOneSetOpCvtermUsingType
func testCvtermpathToOneSetOpCvtermUsingType(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a Cvtermpath
var b, c Cvterm
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, cvtermpathDBTypes, false, strmangle.SetComplement(cvtermpathPrimaryKeyColumns, cvtermpathColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, cvtermDBTypes, false, strmangle.SetComplement(cvtermPrimaryKeyColumns, cvtermColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, cvtermDBTypes, false, strmangle.SetComplement(cvtermPrimaryKeyColumns, cvtermColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Cvterm{&b, &c} {
err = a.SetType(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Type != x {
t.Error("relationship struct not set to correct value")
}
if x.R.TypeCvtermpath != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.TypeID.Int != x.CvtermID {
t.Error("foreign key was wrong value", a.TypeID.Int)
}
zero := reflect.Zero(reflect.TypeOf(a.TypeID.Int))
reflect.Indirect(reflect.ValueOf(&a.TypeID.Int)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.TypeID.Int != x.CvtermID {
t.Error("foreign key was wrong value", a.TypeID.Int, x.CvtermID)
}
}
}
示例15: testOrganismDbxrefToOneSetOpDbxrefUsingDbxref
func testOrganismDbxrefToOneSetOpDbxrefUsingDbxref(t *testing.T) {
var err error
tx := MustTx(boil.Begin())
defer tx.Rollback()
var a OrganismDbxref
var b, c Dbxref
seed := randomize.NewSeed()
if err = randomize.Struct(seed, &a, organismDbxrefDBTypes, false, strmangle.SetComplement(organismDbxrefPrimaryKeyColumns, organismDbxrefColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &b, dbxrefDBTypes, false, strmangle.SetComplement(dbxrefPrimaryKeyColumns, dbxrefColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err = randomize.Struct(seed, &c, dbxrefDBTypes, false, strmangle.SetComplement(dbxrefPrimaryKeyColumns, dbxrefColumnsWithoutDefault)...); err != nil {
t.Fatal(err)
}
if err := a.Insert(tx); err != nil {
t.Fatal(err)
}
if err = b.Insert(tx); err != nil {
t.Fatal(err)
}
for i, x := range []*Dbxref{&b, &c} {
err = a.SetDbxref(tx, i != 0, x)
if err != nil {
t.Fatal(err)
}
if a.R.Dbxref != x {
t.Error("relationship struct not set to correct value")
}
if x.R.OrganismDbxref != &a {
t.Error("failed to append to foreign relationship struct")
}
if a.DbxrefID != x.DbxrefID {
t.Error("foreign key was wrong value", a.DbxrefID)
}
zero := reflect.Zero(reflect.TypeOf(a.DbxrefID))
reflect.Indirect(reflect.ValueOf(&a.DbxrefID)).Set(zero)
if err = a.Reload(tx); err != nil {
t.Fatal("failed to reload", err)
}
if a.DbxrefID != x.DbxrefID {
t.Error("foreign key was wrong value", a.DbxrefID, x.DbxrefID)
}
}
}