// OnlyID is like Only, but returns the only FactType ID in the query.
// Returns a *NotSingularError when exactly one FactType ID is not found.
// Returns a *NotFoundError when no entities are found.
OnlyID is like Only, but returns the only FactType ID in the query.
Returns a *NotSingularError when exactly one FactType ID is not found.
Returns a *NotFoundError when no entities are found.
// OnlyID is like Only but returns the only FactType ID in the query . // Returns a * NotSingularError when exactly one FactType ID is not found . // Returns a * NotFoundError when no entities are found .
func (ftq *FactTypeQuery) OnlyID(ctx context.Context) (id string, err error) {
	var ids []string
	if ids, err = ftq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{facttype.Label}
	default:
		err = &NotSingularError{facttype.Label}
	}
	return
}
func ( ftq * FactTypeQuery ) OnlyID ( ctx context . Context ) ( id string , err error ) { var ids [ ] string if ids , err = ftq . Limit ( 2 ) . IDs ( ctx ) ; err != nil { return } switch len ( ids ) { case 1 : id = ids [ 0 ] case 0 : err = & NotFoundError { facttype . Label } default : err = & NotSingularError { facttype . Label } } return }
OnlyID is like Only, but returns the only FactType ID in the query.
OnlyID is like Only but returns the only FactType ID in the query .