Ejemplo n.º 1
0
// LoadAuthRole allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (authUserRoleL) LoadAuthRole(e boil.Executor, singular bool, maybeAuthUserRole interface{}) error {
	var slice []*AuthUserRole
	var object *AuthUserRole

	count := 1
	if singular {
		object = maybeAuthUserRole.(*AuthUserRole)
	} else {
		slice = *maybeAuthUserRole.(*AuthUserRoleSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &authUserRoleR{}
		args[0] = object.AuthRoleID
	} else {
		for i, obj := range slice {
			obj.R = &authUserRoleR{}
			args[i] = obj.AuthRoleID
		}
	}

	query := fmt.Sprintf(
		"select * from \"auth_role\" where \"auth_role_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load AuthRole")
	}
	defer results.Close()

	var resultSlice []*AuthRole
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice AuthRole")
	}

	if len(authUserRoleAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.AuthRole = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.AuthRoleID == foreign.AuthRoleID {
				local.R.AuthRole = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 2
0
// LoadPub allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (featurepropPubL) LoadPub(e boil.Executor, singular bool, maybeFeaturepropPub interface{}) error {
	var slice []*FeaturepropPub
	var object *FeaturepropPub

	count := 1
	if singular {
		object = maybeFeaturepropPub.(*FeaturepropPub)
	} else {
		slice = *maybeFeaturepropPub.(*FeaturepropPubSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &featurepropPubR{}
		args[0] = object.PubID
	} else {
		for i, obj := range slice {
			obj.R = &featurepropPubR{}
			args[i] = obj.PubID
		}
	}

	query := fmt.Sprintf(
		"select * from \"pub\" where \"pub_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Pub")
	}
	defer results.Close()

	var resultSlice []*Pub
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Pub")
	}

	if len(featurepropPubAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.Pub = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.PubID == foreign.PubID {
				local.R.Pub = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 3
0
// LoadStockcollections allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (contactL) LoadStockcollections(e boil.Executor, singular bool, maybeContact interface{}) error {
	var slice []*Contact
	var object *Contact

	count := 1
	if singular {
		object = maybeContact.(*Contact)
	} else {
		slice = *maybeContact.(*ContactSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &contactR{}
		args[0] = object.ContactID
	} else {
		for i, obj := range slice {
			obj.R = &contactR{}
			args[i] = obj.ContactID
		}
	}

	query := fmt.Sprintf(
		"select * from \"stockcollection\" where \"contact_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)
	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load stockcollection")
	}
	defer results.Close()

	var resultSlice []*Stockcollection
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice stockcollection")
	}

	if len(stockcollectionAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}
	if singular {
		object.R.Stockcollections = resultSlice
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.ContactID == foreign.ContactID.Int {
				local.R.Stockcollections = append(local.R.Stockcollections, foreign)
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 4
0
// LoadDbxref allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (cvtermDbxrefL) LoadDbxref(e boil.Executor, singular bool, maybeCvtermDbxref interface{}) error {
	var slice []*CvtermDbxref
	var object *CvtermDbxref

	count := 1
	if singular {
		object = maybeCvtermDbxref.(*CvtermDbxref)
	} else {
		slice = *maybeCvtermDbxref.(*CvtermDbxrefSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &cvtermDbxrefR{}
		args[0] = object.DbxrefID
	} else {
		for i, obj := range slice {
			obj.R = &cvtermDbxrefR{}
			args[i] = obj.DbxrefID
		}
	}

	query := fmt.Sprintf(
		"select * from \"dbxref\" where \"dbxref_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Dbxref")
	}
	defer results.Close()

	var resultSlice []*Dbxref
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Dbxref")
	}

	if len(cvtermDbxrefAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.Dbxref = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.DbxrefID == foreign.DbxrefID {
				local.R.Dbxref = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 5
0
// LoadStockcollectionprop allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (stockcollectionL) LoadStockcollectionprop(e boil.Executor, singular bool, maybeStockcollection interface{}) error {
	var slice []*Stockcollection
	var object *Stockcollection

	count := 1
	if singular {
		object = maybeStockcollection.(*Stockcollection)
	} else {
		slice = *maybeStockcollection.(*StockcollectionSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &stockcollectionR{}
		args[0] = object.StockcollectionID
	} else {
		for i, obj := range slice {
			obj.R = &stockcollectionR{}
			args[i] = obj.StockcollectionID
		}
	}

	query := fmt.Sprintf(
		"select * from \"stockcollectionprop\" where \"stockcollection_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Stockcollectionprop")
	}
	defer results.Close()

	var resultSlice []*Stockcollectionprop
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Stockcollectionprop")
	}

	if len(stockcollectionAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.Stockcollectionprop = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.StockcollectionID == foreign.StockcollectionID {
				local.R.Stockcollectionprop = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 6
0
Archivo: files.go Proyecto: zqzca/back
// LoadThumbnails allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (fileL) LoadThumbnails(e boil.Executor, singular bool, maybeFile interface{}) error {
	var slice []*File
	var object *File

	count := 1
	if singular {
		object = maybeFile.(*File)
	} else {
		slice = *maybeFile.(*FileSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &fileR{}
		args[0] = object.ID
	} else {
		for i, obj := range slice {
			obj.R = &fileR{}
			args[i] = obj.ID
		}
	}

	query := fmt.Sprintf(
		"select * from \"thumbnails\" where \"file_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)
	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load thumbnails")
	}
	defer results.Close()

	var resultSlice []*Thumbnail
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice thumbnails")
	}

	if len(thumbnailAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}
	if singular {
		object.R.Thumbnails = resultSlice
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.ID == foreign.FileID {
				local.R.Thumbnails = append(local.R.Thumbnails, foreign)
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 7
0
// LoadType allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (pubRelationshipL) LoadType(e boil.Executor, singular bool, maybePubRelationship interface{}) error {
	var slice []*PubRelationship
	var object *PubRelationship

	count := 1
	if singular {
		object = maybePubRelationship.(*PubRelationship)
	} else {
		slice = *maybePubRelationship.(*PubRelationshipSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &pubRelationshipR{}
		args[0] = object.TypeID
	} else {
		for i, obj := range slice {
			obj.R = &pubRelationshipR{}
			args[i] = obj.TypeID
		}
	}

	query := fmt.Sprintf(
		"select * from \"cvterm\" where \"cvterm_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Cvterm")
	}
	defer results.Close()

	var resultSlice []*Cvterm
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Cvterm")
	}

	if len(pubRelationshipAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.Type = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.TypeID == foreign.CvtermID {
				local.R.Type = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 8
0
// LoadEnvironment allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (phenstatementL) LoadEnvironment(e boil.Executor, singular bool, maybePhenstatement interface{}) error {
	var slice []*Phenstatement
	var object *Phenstatement

	count := 1
	if singular {
		object = maybePhenstatement.(*Phenstatement)
	} else {
		slice = *maybePhenstatement.(*PhenstatementSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &phenstatementR{}
		args[0] = object.EnvironmentID
	} else {
		for i, obj := range slice {
			obj.R = &phenstatementR{}
			args[i] = obj.EnvironmentID
		}
	}

	query := fmt.Sprintf(
		"select * from \"environment\" where \"environment_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load Environment")
	}
	defer results.Close()

	var resultSlice []*Environment
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice Environment")
	}

	if len(phenstatementAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.Environment = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.EnvironmentID == foreign.EnvironmentID {
				local.R.Environment = foreign
				break
			}
		}
	}

	return nil
}
Ejemplo n.º 9
0
// LoadJbrowseTrack allows an eager lookup of values, cached into the
// loaded structs of the objects.
func (jbrowseOrganismL) LoadJbrowseTrack(e boil.Executor, singular bool, maybeJbrowseOrganism interface{}) error {
	var slice []*JbrowseOrganism
	var object *JbrowseOrganism

	count := 1
	if singular {
		object = maybeJbrowseOrganism.(*JbrowseOrganism)
	} else {
		slice = *maybeJbrowseOrganism.(*JbrowseOrganismSlice)
		count = len(slice)
	}

	args := make([]interface{}, count)
	if singular {
		object.R = &jbrowseOrganismR{}
		args[0] = object.JbrowseOrganismID
	} else {
		for i, obj := range slice {
			obj.R = &jbrowseOrganismR{}
			args[i] = obj.JbrowseOrganismID
		}
	}

	query := fmt.Sprintf(
		"select * from \"jbrowse_track\" where \"jbrowse_organism_id\" in (%s)",
		strmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),
	)

	if boil.DebugMode {
		fmt.Fprintf(boil.DebugWriter, "%s\n%v\n", query, args)
	}

	results, err := e.Query(query, args...)
	if err != nil {
		return errors.Wrap(err, "failed to eager load JbrowseTrack")
	}
	defer results.Close()

	var resultSlice []*JbrowseTrack
	if err = queries.Bind(results, &resultSlice); err != nil {
		return errors.Wrap(err, "failed to bind eager loaded slice JbrowseTrack")
	}

	if len(jbrowseOrganismAfterSelectHooks) != 0 {
		for _, obj := range resultSlice {
			if err := obj.doAfterSelectHooks(e); err != nil {
				return err
			}
		}
	}

	if singular && len(resultSlice) != 0 {
		object.R.JbrowseTrack = resultSlice[0]
		return nil
	}

	for _, foreign := range resultSlice {
		for _, local := range slice {
			if local.JbrowseOrganismID == foreign.JbrowseOrganismID {
				local.R.JbrowseTrack = foreign
				break
			}
		}
	}

	return nil
}