Exemplo n.º 1
1
// 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
}
// 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
}
Exemplo n.º 3
0
// DeleteAll deletes all rows in the slice, using an executor.
func (o FeaturepropPubSlice) DeleteAll(exec boil.Executor) error {
	if o == nil {
		return errors.New("chado: no FeaturepropPub slice provided for delete all")
	}

	if len(o) == 0 {
		return nil
	}

	if len(featurepropPubBeforeDeleteHooks) != 0 {
		for _, obj := range o {
			if err := obj.doBeforeDeleteHooks(exec); err != nil {
				return err
			}
		}
	}

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

	sql := fmt.Sprintf(
		"DELETE 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)),
	)

	if boil.DebugMode {
		fmt.Fprintln(boil.DebugWriter, sql)
		fmt.Fprintln(boil.DebugWriter, args)
	}

	_, err := exec.Exec(sql, args...)
	if err != nil {
		return errors.Wrap(err, "chado: unable to delete all from featurepropPub slice")
	}

	if len(featurepropPubAfterDeleteHooks) != 0 {
		for _, obj := range o {
			if err := obj.doAfterDeleteHooks(exec); err != nil {
				return err
			}
		}
	}

	return nil
}
Exemplo n.º 4
0
// 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
}
Exemplo n.º 5
0
// 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
}
Exemplo n.º 6
0
// 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
}
Exemplo n.º 7
0
// 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
}
Exemplo n.º 8
0
// 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
}
Exemplo n.º 9
0
// 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
}
Exemplo n.º 10
0
Arquivo: files.go Projeto: zqzca/back
// 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
}
Exemplo n.º 11
0
// 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
}
Exemplo n.º 12
0
// 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
}
Exemplo n.º 13
0
// 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
}
Exemplo n.º 14
0
// 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
}