• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang strmangle.SetParamNames函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/vattle/sqlboiler/strmangle.SetParamNames函数的典型用法代码示例。如果您正苦于以下问题:Golang SetParamNames函数的具体用法?Golang SetParamNames怎么用?Golang SetParamNames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了SetParamNames函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Update

// Update uses an executor to update the AuthRolePermission.
// Whitelist behavior: If a whitelist is provided, only the columns given are updated.
// No whitelist behavior: Without a whitelist, columns are inferred by the following rules:
// - All columns are inferred to start with
// - All primary keys are subtracted from this set
// Update does not automatically update the record in case of default values. Use .Reload()
// to refresh the records.
func (o *AuthRolePermission) Update(exec boil.Executor, whitelist ...string) error {
	currTime := time.Now().In(boil.GetLocation())

	o.UpdatedAt.Time = currTime
	o.UpdatedAt.Valid = true

	var err error
	if err = o.doBeforeUpdateHooks(exec); err != nil {
		return err
	}
	key := makeCacheKey(whitelist, nil)
	authRolePermissionUpdateCacheMut.RLock()
	cache, cached := authRolePermissionUpdateCache[key]
	authRolePermissionUpdateCacheMut.RUnlock()

	if !cached {
		wl := strmangle.UpdateColumnSet(authRolePermissionColumns, authRolePermissionPrimaryKeyColumns, whitelist)
		if len(wl) == 0 {
			return errors.New("chado: unable to update auth_role_permission, could not build whitelist")
		}

		cache.query = fmt.Sprintf("UPDATE \"auth_role_permission\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, wl),
			strmangle.WhereClause("\"", "\"", len(wl)+1, authRolePermissionPrimaryKeyColumns),
		)
		cache.valueMapping, err = queries.BindMapping(authRolePermissionType, authRolePermissionMapping, append(wl, authRolePermissionPrimaryKeyColumns...))
		if err != nil {
			return err
		}
	}

	values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	_, err = exec.Exec(cache.query, values...)
	if err != nil {
		return errors.Wrap(err, "chado: unable to update auth_role_permission row")
	}

	if !cached {
		authRolePermissionUpdateCacheMut.Lock()
		authRolePermissionUpdateCache[key] = cache
		authRolePermissionUpdateCacheMut.Unlock()
	}

	return o.doAfterUpdateHooks(exec)
}
开发者ID:dictyBase,项目名称:Modware,代码行数:58,代码来源:auth_role_permission.go


示例2: SetEnvironment2PhenotypeComparison

// SetEnvironment2PhenotypeComparison of the environment to the related item.
// Sets o.R.Environment2PhenotypeComparison to related.
// Adds o to related.R.Environment2.
func (o *Environment) SetEnvironment2PhenotypeComparison(exec boil.Executor, insert bool, related *PhenotypeComparison) error {
	var err error

	if insert {
		related.Environment2ID = o.EnvironmentID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"phenotype_comparison\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"environment2_id"}),
			strmangle.WhereClause("\"", "\"", 2, phenotypeComparisonPrimaryKeyColumns),
		)
		values := []interface{}{o.EnvironmentID, related.PhenotypeComparisonID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.Environment2ID = o.EnvironmentID

	}

	if o.R == nil {
		o.R = &environmentR{
			Environment2PhenotypeComparison: related,
		}
	} else {
		o.R.Environment2PhenotypeComparison = related
	}

	if related.R == nil {
		related.R = &phenotypeComparisonR{
			Environment2: o,
		}
	} else {
		related.R.Environment2 = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:environment.go


示例3: SetCvterm

// SetCvterm of the cv to the related item.
// Sets o.R.Cvterm to related.
// Adds o to related.R.CV.
func (o *CV) SetCvterm(exec boil.Executor, insert bool, related *Cvterm) error {
	var err error

	if insert {
		related.CVID = o.CVID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"cvterm\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"cv_id"}),
			strmangle.WhereClause("\"", "\"", 2, cvtermPrimaryKeyColumns),
		)
		values := []interface{}{o.CVID, related.CvtermID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.CVID = o.CVID

	}

	if o.R == nil {
		o.R = &cvR{
			Cvterm: related,
		}
	} else {
		o.R.Cvterm = related
	}

	if related.R == nil {
		related.R = &cvtermR{
			CV: o,
		}
	} else {
		related.R.CV = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:cv.go


示例4: SetFeaturepropPub

// SetFeaturepropPub of the featureprop to the related item.
// Sets o.R.FeaturepropPub to related.
// Adds o to related.R.Featureprop.
func (o *Featureprop) SetFeaturepropPub(exec boil.Executor, insert bool, related *FeaturepropPub) error {
	var err error

	if insert {
		related.FeaturepropID = o.FeaturepropID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"featureprop_pub\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"featureprop_id"}),
			strmangle.WhereClause("\"", "\"", 2, featurepropPubPrimaryKeyColumns),
		)
		values := []interface{}{o.FeaturepropID, related.FeaturepropPubID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.FeaturepropID = o.FeaturepropID

	}

	if o.R == nil {
		o.R = &featurepropR{
			FeaturepropPub: related,
		}
	} else {
		o.R.FeaturepropPub = related
	}

	if related.R == nil {
		related.R = &featurepropPubR{
			Featureprop: o,
		}
	} else {
		related.R.Featureprop = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:featureprop.go


示例5: SetSubjectContactRelationship

// SetSubjectContactRelationship of the contact to the related item.
// Sets o.R.SubjectContactRelationship to related.
// Adds o to related.R.Subject.
func (o *Contact) SetSubjectContactRelationship(exec boil.Executor, insert bool, related *ContactRelationship) error {
	var err error

	if insert {
		related.SubjectID = o.ContactID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"contact_relationship\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"subject_id"}),
			strmangle.WhereClause("\"", "\"", 2, contactRelationshipPrimaryKeyColumns),
		)
		values := []interface{}{o.ContactID, related.ContactRelationshipID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.SubjectID = o.ContactID

	}

	if o.R == nil {
		o.R = &contactR{
			SubjectContactRelationship: related,
		}
	} else {
		o.R.SubjectContactRelationship = related
	}

	if related.R == nil {
		related.R = &contactRelationshipR{
			Subject: o,
		}
	} else {
		related.R.Subject = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:contact.go


示例6: SetAnalysisfeature

// SetAnalysisfeature of the analysi to the related item.
// Sets o.R.Analysisfeature to related.
// Adds o to related.R.Analysi.
func (o *Analysi) SetAnalysisfeature(exec boil.Executor, insert bool, related *Analysisfeature) error {
	var err error

	if insert {
		related.AnalysisID = o.AnalysisID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"analysisfeature\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"analysis_id"}),
			strmangle.WhereClause("\"", "\"", 2, analysisfeaturePrimaryKeyColumns),
		)
		values := []interface{}{o.AnalysisID, related.AnalysisfeatureID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.AnalysisID = o.AnalysisID

	}

	if o.R == nil {
		o.R = &analysiR{
			Analysisfeature: related,
		}
	} else {
		o.R.Analysisfeature = related
	}

	if related.R == nil {
		related.R = &analysisfeatureR{
			Analysi: o,
		}
	} else {
		related.R.Analysi = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:analysis.go


示例7: SetStockcollectionprop

// SetStockcollectionprop of the stockcollection to the related item.
// Sets o.R.Stockcollectionprop to related.
// Adds o to related.R.Stockcollection.
func (o *Stockcollection) SetStockcollectionprop(exec boil.Executor, insert bool, related *Stockcollectionprop) error {
	var err error

	if insert {
		related.StockcollectionID = o.StockcollectionID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"stockcollectionprop\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"stockcollection_id"}),
			strmangle.WhereClause("\"", "\"", 2, stockcollectionpropPrimaryKeyColumns),
		)
		values := []interface{}{o.StockcollectionID, related.StockcollectionpropID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.StockcollectionID = o.StockcollectionID

	}

	if o.R == nil {
		o.R = &stockcollectionR{
			Stockcollectionprop: related,
		}
	} else {
		o.R.Stockcollectionprop = related
	}

	if related.R == nil {
		related.R = &stockcollectionpropR{
			Stockcollection: o,
		}
	} else {
		related.R.Stockcollection = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:stockcollection.go


示例8: SetAuthRolePermission

// SetAuthRolePermission of the auth_permission to the related item.
// Sets o.R.AuthRolePermission to related.
// Adds o to related.R.AuthPermission.
func (o *AuthPermission) SetAuthRolePermission(exec boil.Executor, insert bool, related *AuthRolePermission) error {
	var err error

	if insert {
		related.AuthPermissionID = o.AuthPermissionID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"auth_role_permission\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"auth_permission_id"}),
			strmangle.WhereClause("\"", "\"", 2, authRolePermissionPrimaryKeyColumns),
		)
		values := []interface{}{o.AuthPermissionID, related.AuthRolePermissionID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.AuthPermissionID = o.AuthPermissionID

	}

	if o.R == nil {
		o.R = &authPermissionR{
			AuthRolePermission: related,
		}
	} else {
		o.R.AuthRolePermission = related
	}

	if related.R == nil {
		related.R = &authRolePermissionR{
			AuthPermission: o,
		}
	} else {
		related.R.AuthPermission = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:auth_permission.go


示例9: SetJbrowseTrack

// SetJbrowseTrack of the jbrowse_organism to the related item.
// Sets o.R.JbrowseTrack to related.
// Adds o to related.R.JbrowseOrganism.
func (o *JbrowseOrganism) SetJbrowseTrack(exec boil.Executor, insert bool, related *JbrowseTrack) error {
	var err error

	if insert {
		related.JbrowseOrganismID = o.JbrowseOrganismID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"jbrowse_track\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"jbrowse_organism_id"}),
			strmangle.WhereClause("\"", "\"", 2, jbrowseTrackPrimaryKeyColumns),
		)
		values := []interface{}{o.JbrowseOrganismID, related.JbrowseTrackID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.JbrowseOrganismID = o.JbrowseOrganismID

	}

	if o.R == nil {
		o.R = &jbrowseOrganismR{
			JbrowseTrack: related,
		}
	} else {
		o.R.JbrowseTrack = related
	}

	if related.R == nil {
		related.R = &jbrowseTrackR{
			JbrowseOrganism: o,
		}
	} else {
		related.R.JbrowseOrganism = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:jbrowse_organism.go


示例10: SetDbxref

// SetDbxref of the db to the related item.
// Sets o.R.Dbxref to related.
// Adds o to related.R.DB.
func (o *DB) SetDbxref(exec boil.Executor, insert bool, related *Dbxref) error {
	var err error

	if insert {
		related.DBID = o.DBID

		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	} else {
		updateQuery := fmt.Sprintf(
			"UPDATE \"dbxref\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, []string{"db_id"}),
			strmangle.WhereClause("\"", "\"", 2, dbxrefPrimaryKeyColumns),
		)
		values := []interface{}{o.DBID, related.DbxrefID}

		if boil.DebugMode {
			fmt.Fprintln(boil.DebugWriter, updateQuery)
			fmt.Fprintln(boil.DebugWriter, values)
		}

		if _, err = exec.Exec(updateQuery, values...); err != nil {
			return errors.Wrap(err, "failed to update foreign table")
		}

		related.DBID = o.DBID

	}

	if o.R == nil {
		o.R = &dbR{
			Dbxref: related,
		}
	} else {
		o.R.Dbxref = related
	}

	if related.R == nil {
		related.R = &dbxrefR{
			DB: o,
		}
	} else {
		related.R.DB = o
	}
	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:50,代码来源:db.go


示例11: Update

// Update uses an executor to update the FeaturepropPub.
// Whitelist behavior: If a whitelist is provided, only the columns given are updated.
// No whitelist behavior: Without a whitelist, columns are inferred by the following rules:
// - All columns are inferred to start with
// - All primary keys are subtracted from this set
// Update does not automatically update the record in case of default values. Use .Reload()
// to refresh the records.
func (o *FeaturepropPub) Update(exec boil.Executor, whitelist ...string) error {
	var err error
	if err = o.doBeforeUpdateHooks(exec); err != nil {
		return err
	}
	key := makeCacheKey(whitelist, nil)
	featurepropPubUpdateCacheMut.RLock()
	cache, cached := featurepropPubUpdateCache[key]
	featurepropPubUpdateCacheMut.RUnlock()

	if !cached {
		wl := strmangle.UpdateColumnSet(featurepropPubColumns, featurepropPubPrimaryKeyColumns, whitelist)
		if len(wl) == 0 {
			return errors.New("chado: unable to update featureprop_pub, could not build whitelist")
		}

		cache.query = fmt.Sprintf("UPDATE \"featureprop_pub\" SET %s WHERE %s",
			strmangle.SetParamNames("\"", "\"", 1, wl),
			strmangle.WhereClause("\"", "\"", len(wl)+1, featurepropPubPrimaryKeyColumns),
		)
		cache.valueMapping, err = queries.BindMapping(featurepropPubType, featurepropPubMapping, append(wl, featurepropPubPrimaryKeyColumns...))
		if err != nil {
			return err
		}
	}

	values := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, cache.query)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	_, err = exec.Exec(cache.query, values...)
	if err != nil {
		return errors.Wrap(err, "chado: unable to update featureprop_pub row")
	}

	if !cached {
		featurepropPubUpdateCacheMut.Lock()
		featurepropPubUpdateCache[key] = cache
		featurepropPubUpdateCacheMut.Unlock()
	}

	return o.doAfterUpdateHooks(exec)
}
开发者ID:dictyBase,项目名称:Modware,代码行数:53,代码来源:featureprop_pub.go


示例12: SetFile

// SetFile of the download to the related item.
// Sets o.R.File to related.
// Adds o to related.R.Downloads.
func (o *Download) SetFile(exec boil.Executor, insert bool, related *File) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"downloads\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"file_id"}),
		strmangle.WhereClause("\"", "\"", 2, downloadPrimaryKeyColumns),
	)
	values := []interface{}{related.ID, o.ID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.FileID.String = related.ID
	o.FileID.Valid = true

	if o.R == nil {
		o.R = &downloadR{
			File: related,
		}
	} else {
		o.R.File = related
	}

	if related.R == nil {
		related.R = &fileR{
			Downloads: DownloadSlice{o},
		}
	} else {
		related.R.Downloads = append(related.R.Downloads, o)
	}

	return nil
}
开发者ID:zqzca,项目名称:back,代码行数:48,代码来源:downloads.go


示例13: SetPub

// SetPub of the stock_relationship_cvterm to the related item.
// Sets o.R.Pub to related.
// Adds o to related.R.StockRelationshipCvterms.
func (o *StockRelationshipCvterm) SetPub(exec boil.Executor, insert bool, related *Pub) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"stock_relationship_cvterm\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"pub_id"}),
		strmangle.WhereClause("\"", "\"", 2, stockRelationshipCvtermPrimaryKeyColumns),
	)
	values := []interface{}{related.PubID, o.StockRelationshipCvtermID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.PubID.Int = related.PubID
	o.PubID.Valid = true

	if o.R == nil {
		o.R = &stockRelationshipCvtermR{
			Pub: related,
		}
	} else {
		o.R.Pub = related
	}

	if related.R == nil {
		related.R = &pubR{
			StockRelationshipCvterms: StockRelationshipCvtermSlice{o},
		}
	} else {
		related.R.StockRelationshipCvterms = append(related.R.StockRelationshipCvterms, o)
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:48,代码来源:stock_relationship_cvterm.go


示例14: SetChromosome

// SetChromosome of the feature_genotype to the related item.
// Sets o.R.Chromosome to related.
// Adds o to related.R.ChromosomeFeatureGenotype.
func (o *FeatureGenotype) SetChromosome(exec boil.Executor, insert bool, related *Feature) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"feature_genotype\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"chromosome_id"}),
		strmangle.WhereClause("\"", "\"", 2, featureGenotypePrimaryKeyColumns),
	)
	values := []interface{}{related.FeatureID, o.FeatureGenotypeID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.ChromosomeID.Int = related.FeatureID
	o.ChromosomeID.Valid = true

	if o.R == nil {
		o.R = &featureGenotypeR{
			Chromosome: related,
		}
	} else {
		o.R.Chromosome = related
	}

	if related.R == nil {
		related.R = &featureR{
			ChromosomeFeatureGenotype: o,
		}
	} else {
		related.R.ChromosomeFeatureGenotype = o
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:48,代码来源:feature_genotype.go


示例15: SetType

// SetType of the contact to the related item.
// Sets o.R.Type to related.
// Adds o to related.R.TypeContacts.
func (o *Contact) SetType(exec boil.Executor, insert bool, related *Cvterm) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"contact\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"type_id"}),
		strmangle.WhereClause("\"", "\"", 2, contactPrimaryKeyColumns),
	)
	values := []interface{}{related.CvtermID, o.ContactID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.TypeID.Int = related.CvtermID
	o.TypeID.Valid = true

	if o.R == nil {
		o.R = &contactR{
			Type: related,
		}
	} else {
		o.R.Type = related
	}

	if related.R == nil {
		related.R = &cvtermR{
			TypeContacts: ContactSlice{o},
		}
	} else {
		related.R.TypeContacts = append(related.R.TypeContacts, o)
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:48,代码来源:contact.go


示例16: SetContact

// SetContact of the stockcollection to the related item.
// Sets o.R.Contact to related.
// Adds o to related.R.Stockcollections.
func (o *Stockcollection) SetContact(exec boil.Executor, insert bool, related *Contact) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"stockcollection\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"contact_id"}),
		strmangle.WhereClause("\"", "\"", 2, stockcollectionPrimaryKeyColumns),
	)
	values := []interface{}{related.ContactID, o.StockcollectionID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.ContactID.Int = related.ContactID
	o.ContactID.Valid = true

	if o.R == nil {
		o.R = &stockcollectionR{
			Contact: related,
		}
	} else {
		o.R.Contact = related
	}

	if related.R == nil {
		related.R = &contactR{
			Stockcollections: StockcollectionSlice{o},
		}
	} else {
		related.R.Stockcollections = append(related.R.Stockcollections, o)
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:48,代码来源:stockcollection.go


示例17: SetStock

// SetStock of the stock_cvterm to the related item.
// Sets o.R.Stock to related.
// Adds o to related.R.StockCvterm.
func (o *StockCvterm) SetStock(exec boil.Executor, insert bool, related *Stock) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"stock_cvterm\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"stock_id"}),
		strmangle.WhereClause("\"", "\"", 2, stockCvtermPrimaryKeyColumns),
	)
	values := []interface{}{related.StockID, o.StockCvtermID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.StockID = related.StockID

	if o.R == nil {
		o.R = &stockCvtermR{
			Stock: related,
		}
	} else {
		o.R.Stock = related
	}

	if related.R == nil {
		related.R = &stockR{
			StockCvterm: o,
		}
	} else {
		related.R.StockCvterm = o
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:47,代码来源:stock_cvterm.go


示例18: SetType

// SetType of the featureprop to the related item.
// Sets o.R.Type to related.
// Adds o to related.R.TypeFeatureprop.
func (o *Featureprop) SetType(exec boil.Executor, insert bool, related *Cvterm) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"featureprop\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"type_id"}),
		strmangle.WhereClause("\"", "\"", 2, featurepropPrimaryKeyColumns),
	)
	values := []interface{}{related.CvtermID, o.FeaturepropID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.TypeID = related.CvtermID

	if o.R == nil {
		o.R = &featurepropR{
			Type: related,
		}
	} else {
		o.R.Type = related
	}

	if related.R == nil {
		related.R = &cvtermR{
			TypeFeatureprop: o,
		}
	} else {
		related.R.TypeFeatureprop = o
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:47,代码来源:featureprop.go


示例19: SetAuthRole

// SetAuthRole of the auth_user_role to the related item.
// Sets o.R.AuthRole to related.
// Adds o to related.R.AuthUserRoles.
func (o *AuthUserRole) SetAuthRole(exec boil.Executor, insert bool, related *AuthRole) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"auth_user_role\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"auth_role_id"}),
		strmangle.WhereClause("\"", "\"", 2, authUserRolePrimaryKeyColumns),
	)
	values := []interface{}{related.AuthRoleID, o.AuthUserRoleID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.AuthRoleID = related.AuthRoleID

	if o.R == nil {
		o.R = &authUserRoleR{
			AuthRole: related,
		}
	} else {
		o.R.AuthRole = related
	}

	if related.R == nil {
		related.R = &authRoleR{
			AuthUserRoles: AuthUserRoleSlice{o},
		}
	} else {
		related.R.AuthUserRoles = append(related.R.AuthUserRoles, o)
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:47,代码来源:auth_user_role.go


示例20: SetPhenotype

// SetPhenotype of the phenstatement to the related item.
// Sets o.R.Phenotype to related.
// Adds o to related.R.Phenstatement.
func (o *Phenstatement) SetPhenotype(exec boil.Executor, insert bool, related *Phenotype) error {
	var err error
	if insert {
		if err = related.Insert(exec); err != nil {
			return errors.Wrap(err, "failed to insert into foreign table")
		}
	}

	updateQuery := fmt.Sprintf(
		"UPDATE \"phenstatement\" SET %s WHERE %s",
		strmangle.SetParamNames("\"", "\"", 1, []string{"phenotype_id"}),
		strmangle.WhereClause("\"", "\"", 2, phenstatementPrimaryKeyColumns),
	)
	values := []interface{}{related.PhenotypeID, o.PhenstatementID}

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, updateQuery)
		fmt.Fprintln(boil.DebugWriter, values)
	}

	if _, err = exec.Exec(updateQuery, values...); err != nil {
		return errors.Wrap(err, "failed to update local table")
	}

	o.PhenotypeID = related.PhenotypeID

	if o.R == nil {
		o.R = &phenstatementR{
			Phenotype: related,
		}
	} else {
		o.R.Phenotype = related
	}

	if related.R == nil {
		related.R = &phenotypeR{
			Phenstatement: o,
		}
	} else {
		related.R.Phenstatement = o
	}

	return nil
}
开发者ID:dictyBase,项目名称:Modware,代码行数:47,代码来源:phenstatement.go



注:本文中的github.com/vattle/sqlboiler/strmangle.SetParamNames函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang strmangle.UpdateColumnSet函数代码示例发布时间:2022-05-28
下一篇:
Golang strmangle.SetComplement函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap