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

Golang queries.Raw函数代码示例

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

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



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

示例1: ReloadAll

// ReloadAll refetches every row with matching primary key column values
// and overwrites the original object slice with the newly updated slice.
func (o *FeaturepropPubSlice) ReloadAll(exec boil.Executor) error {
	if o == nil || len(*o) == 0 {
		return nil
	}

	featurepropPubs := FeaturepropPubSlice{}
	var args []interface{}
	for _, obj := range *o {
		pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), featurepropPubPrimaryKeyMapping)
		args = append(args, pkeyArgs...)
	}

	sql := fmt.Sprintf(
		"SELECT \"featureprop_pub\".* FROM \"featureprop_pub\" WHERE (%s) IN (%s)",
		strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, featurepropPubPrimaryKeyColumns), ","),
		strmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(featurepropPubPrimaryKeyColumns), 1, len(featurepropPubPrimaryKeyColumns)),
	)

	q := queries.Raw(exec, sql, args...)

	err := q.Bind(&featurepropPubs)
	if err != nil {
		return errors.Wrap(err, "chado: unable to reload all in FeaturepropPubSlice")
	}

	*o = featurepropPubs

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


示例2: ReloadAll

// ReloadAll refetches every row with matching primary key column values
// and overwrites the original object slice with the newly updated slice.
func (o *PhenotypeComparisonCvtermSlice) ReloadAll(exec boil.Executor) error {
	if o == nil || len(*o) == 0 {
		return nil
	}

	phenotypeComparisonCvterms := PhenotypeComparisonCvtermSlice{}
	var args []interface{}
	for _, obj := range *o {
		pkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), phenotypeComparisonCvtermPrimaryKeyMapping)
		args = append(args, pkeyArgs...)
	}

	sql := fmt.Sprintf(
		"SELECT \"phenotype_comparison_cvterm\".* FROM \"phenotype_comparison_cvterm\" WHERE (%s) IN (%s)",
		strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, phenotypeComparisonCvtermPrimaryKeyColumns), ","),
		strmangle.Placeholders(dialect.IndexPlaceholders, len(*o)*len(phenotypeComparisonCvtermPrimaryKeyColumns), 1, len(phenotypeComparisonCvtermPrimaryKeyColumns)),
	)

	q := queries.Raw(exec, sql, args...)

	err := q.Bind(&phenotypeComparisonCvterms)
	if err != nil {
		return errors.Wrap(err, "chado: unable to reload all in PhenotypeComparisonCvtermSlice")
	}

	*o = phenotypeComparisonCvterms

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


示例3: FindFeaturepropPub

// FindFeaturepropPub retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindFeaturepropPub(exec boil.Executor, featurepropPubID int, selectCols ...string) (*FeaturepropPub, error) {
	featurepropPubObj := &FeaturepropPub{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"featureprop_pub\" where \"featureprop_pub_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, featurepropPubID)

	err := q.Bind(featurepropPubObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from featureprop_pub")
	}

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


示例4: FindTableinfo

// FindTableinfo retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindTableinfo(exec boil.Executor, tableinfoID int, selectCols ...string) (*Tableinfo, error) {
	tableinfoObj := &Tableinfo{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"tableinfo\" where \"tableinfo_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, tableinfoID)

	err := q.Bind(tableinfoObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from tableinfo")
	}

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


示例5: FindAuthUserRole

// FindAuthUserRole retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindAuthUserRole(exec boil.Executor, authUserRoleID int, selectCols ...string) (*AuthUserRole, error) {
	authUserRoleObj := &AuthUserRole{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"auth_user_role\" where \"auth_user_role_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, authUserRoleID)

	err := q.Bind(authUserRoleObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from auth_user_role")
	}

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


示例6: FindCvtermDbxref

// FindCvtermDbxref retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindCvtermDbxref(exec boil.Executor, cvtermDbxrefID int, selectCols ...string) (*CvtermDbxref, error) {
	cvtermDbxrefObj := &CvtermDbxref{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"cvterm_dbxref\" where \"cvterm_dbxref_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, cvtermDbxrefID)

	err := q.Bind(cvtermDbxrefObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from cvterm_dbxref")
	}

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


示例7: FindStockcollection

// FindStockcollection retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindStockcollection(exec boil.Executor, stockcollectionID int, selectCols ...string) (*Stockcollection, error) {
	stockcollectionObj := &Stockcollection{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"stockcollection\" where \"stockcollection_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, stockcollectionID)

	err := q.Bind(stockcollectionObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from stockcollection")
	}

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


示例8: FindDbxrefprop

// FindDbxrefprop retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindDbxrefprop(exec boil.Executor, dbxrefpropID int, selectCols ...string) (*Dbxrefprop, error) {
	dbxrefpropObj := &Dbxrefprop{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"dbxrefprop\" where \"dbxrefprop_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, dbxrefpropID)

	err := q.Bind(dbxrefpropObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from dbxrefprop")
	}

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


示例9: FindFile

// FindFile retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindFile(exec boil.Executor, id string, selectCols ...string) (*File, error) {
	fileObj := &File{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"files\" where \"id\"=$1", sel,
	)

	q := queries.Raw(exec, query, id)

	err := q.Bind(fileObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "models: unable to select from files")
	}

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


示例10: FindPubRelationship

// FindPubRelationship retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindPubRelationship(exec boil.Executor, pubRelationshipID int, selectCols ...string) (*PubRelationship, error) {
	pubRelationshipObj := &PubRelationship{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"pub_relationship\" where \"pub_relationship_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, pubRelationshipID)

	err := q.Bind(pubRelationshipObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from pub_relationship")
	}

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


示例11: FindPhenstatement

// FindPhenstatement retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindPhenstatement(exec boil.Executor, phenstatementID int, selectCols ...string) (*Phenstatement, error) {
	phenstatementObj := &Phenstatement{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"phenstatement\" where \"phenstatement_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, phenstatementID)

	err := q.Bind(phenstatementObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from phenstatement")
	}

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


示例12: FindEnvironmentCvterm

// FindEnvironmentCvterm retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindEnvironmentCvterm(exec boil.Executor, environmentCvtermID int, selectCols ...string) (*EnvironmentCvterm, error) {
	environmentCvtermObj := &EnvironmentCvterm{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"environment_cvterm\" where \"environment_cvterm_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, environmentCvtermID)

	err := q.Bind(environmentCvtermObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from environment_cvterm")
	}

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


示例13: FindJbrowseOrganism

// FindJbrowseOrganism retrieves a single record by ID with an executor.
// If selectCols is empty Find will return all columns.
func FindJbrowseOrganism(exec boil.Executor, jbrowseOrganismID int, selectCols ...string) (*JbrowseOrganism, error) {
	jbrowseOrganismObj := &JbrowseOrganism{}

	sel := "*"
	if len(selectCols) > 0 {
		sel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), ",")
	}
	query := fmt.Sprintf(
		"select %s from \"jbrowse_organism\" where \"jbrowse_organism_id\"=$1", sel,
	)

	q := queries.Raw(exec, query, jbrowseOrganismID)

	err := q.Bind(jbrowseOrganismObj)
	if err != nil {
		if errors.Cause(err) == sql.ErrNoRows {
			return nil, sql.ErrNoRows
		}
		return nil, errors.Wrap(err, "chado: unable to select from jbrowse_organism")
	}

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang queries.SetCount函数代码示例发布时间:2022-05-28
下一篇:
Golang queries.PtrsFromMapping函数代码示例发布时间: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